Skip to content

Commit ea308a5

Browse files
authored
Merge pull request #130 from puddly/rc
0.16.1 Release
2 parents b2e2b9d + 0fba87c commit ea308a5

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

zigpy_xbee/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MAJOR_VERSION = 0
22
MINOR_VERSION = 16
3-
PATCH_VERSION = "0"
3+
PATCH_VERSION = "1"
44
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}"
55
__version__ = f"{__short_version__}.{PATCH_VERSION}"

zigpy_xbee/zigbee/application.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ async def _get_association_state(self):
182182
async def send_packet(self, packet: zigpy.types.ZigbeePacket) -> None:
183183
LOGGER.debug("Sending packet %r", packet)
184184

185+
try:
186+
device = self.get_device_with_address(packet.dst)
187+
except (KeyError, ValueError):
188+
device = None
189+
185190
tx_opts = TXOptions.NONE
186191

187192
if packet.extended_timeout:
@@ -193,17 +198,25 @@ async def send_packet(self, packet: zigpy.types.ZigbeePacket) -> None:
193198
long_addr = UNKNOWN_IEEE
194199
short_addr = UNKNOWN_NWK
195200

196-
if packet.dst.addr_mode == zigpy.types.AddrMode.IEEE:
197-
long_addr = packet.dst.address
198-
elif packet.dst.addr_mode == zigpy.types.AddrMode.Broadcast:
201+
if packet.dst.addr_mode == zigpy.types.AddrMode.Broadcast:
199202
long_addr = EUI64(
200203
[
201204
zigpy.types.uint8_t(b)
202205
for b in packet.dst.address.to_bytes(8, "little")
203206
]
204207
)
205-
else:
206208
short_addr = packet.dst.address
209+
elif packet.dst.addr_mode == zigpy.types.AddrMode.Group:
210+
short_addr = packet.dst.address
211+
elif packet.dst.addr_mode == zigpy.types.AddrMode.IEEE:
212+
long_addr = EUI64(packet.dst.address)
213+
elif device is not None:
214+
long_addr = EUI64(device.ieee)
215+
short_addr = device.nwk
216+
else:
217+
raise zigpy.exceptions.DeliveryError(
218+
"Cannot send a packet to a device without a known IEEE address"
219+
)
207220

208221
send_req = self._api.tx_explicit(
209222
long_addr,

0 commit comments

Comments
 (0)