Skip to content

Commit 5be8a84

Browse files
committed
Do not default dst_ep to 0
1 parent 9122929 commit 5be8a84

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

zigpy_znp/zigbee/application.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -794,36 +794,29 @@ async def _send_request_raw(
794794
Picks the correct request sending mechanism and fixes endpoint information.
795795
"""
796796

797-
if dst_ep is None:
798-
dst_ep = 0
799-
800797
if radius is None:
801798
radius = 0
802799

803-
if relays is not None and not isinstance(dst_addr.address, t.NWK):
804-
LOGGER.warning("Packets with relays can only be sent with NWK addressing")
805-
relays = None
806-
807800
# Zigpy just sets src == dst, which doesn't work for devices with many endpoints
808801
# We pick ours based on the registered endpoints when using an older firmware
809802
src_ep = self._find_endpoint(dst_ep=dst_ep, profile=profile, cluster=cluster)
810803

811804
if relays is None:
812805
request = c.AF.DataRequestExt.Req(
813806
DstAddrModeAddress=dst_addr,
814-
DstEndpoint=dst_ep,
807+
DstEndpoint=dst_ep or 0,
815808
DstPanId=0x0000,
816809
SrcEndpoint=src_ep,
817810
ClusterId=cluster,
818811
TSN=sequence,
819812
Options=options,
820-
Radius=radius,
813+
Radius=10,
821814
Data=data,
822815
)
823816
else:
824817
request = c.AF.DataRequestSrcRtg.Req(
825818
DstAddr=dst_addr.address,
826-
DstEndpoint=dst_ep,
819+
DstEndpoint=dst_ep or 0,
827820
SrcEndpoint=src_ep,
828821
ClusterId=cluster,
829822
TSN=sequence,
@@ -874,13 +867,24 @@ async def _send_request_raw(
874867
dst_addr.mode == t.AddrMode.NWK
875868
and dst_addr.address == self._device.nwk
876869
):
877-
self.handle_message(
878-
sender=self._device,
879-
profile=profile,
880-
cluster=cluster,
881-
src_ep=src_ep,
882-
dst_ep=dst_ep,
883-
message=data,
870+
self.packet_received(
871+
zigpy.types.ZigbeePacket(
872+
src=zigpy.types.AddrModeAddress(
873+
addr_mode=zigpy.types.AddrMode.NWK,
874+
address=self._device.nwk,
875+
),
876+
src_ep=src_ep,
877+
dst=zigpy.types.AddrModeAddress(
878+
addr_mode=zigpy.types.AddrMode.NWK,
879+
address=self._device.nwk,
880+
),
881+
dst_ep=dst_ep,
882+
tsn=sequence,
883+
profile_id=profile,
884+
cluster_id=cluster,
885+
data=t.SerializableBytes(data),
886+
radius=radius,
887+
)
884888
)
885889

886890
if dst_ep == ZDO_ENDPOINT or dst_addr.mode == t.AddrMode.Broadcast:

0 commit comments

Comments
 (0)