Skip to content

Commit

Permalink
Fix some EZSP v14 commands
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Oct 15, 2024
1 parent 03dc152 commit 9cf3aad
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
37 changes: 37 additions & 0 deletions bellows/ezsp/v14/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,43 @@ async def get_tc_link_key(self) -> zigpy.state.Key:

return zigpy.state.Key(key=tc_link_key_data)

async def send_unicast(
self,
nwk: t.NWK,
aps_frame: t.EmberApsFrame,
message_tag: t.uint8_t,
data: bytes,
) -> tuple[t.sl_Status, t.uint8_t]:
status, sequence = await self.sendUnicast(
message_type=t.EmberOutgoingMessageType.OUTGOING_DIRECT,
nwk=nwk,
aps_frame=aps_frame,
message_tag=message_tag,
message=data,
)

return t.sl_Status.from_ember_status(status), sequence

async def send_multicast(
self,
aps_frame: t.EmberApsFrame,
radius: t.uint8_t,
non_member_radius: t.uint8_t,
message_tag: t.uint8_t,
data: bytes,
) -> tuple[t.sl_Status, t.uint8_t]:
status, sequence = await self.sendMulticast(
aps_frame=aps_frame,
hops=non_member_radius,
broadcast_addr=aps_frame.groupId,
alias=0x0000,
sequence=aps_frame.sequence,
message_tag=message_tag,
message=data,
)

return t.sl_Status.from_ember_status(status), sequence

async def send_broadcast(
self,
address: t.BroadcastAddress,
Expand Down
18 changes: 17 additions & 1 deletion bellows/ezsp/v14/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class GetTokenDataRsp(Struct):
},
),
"sendBroadcast": (
0x0034,
0x0036,
{
"alias": t.uint16_t,
"destination": BroadcastAddress,
Expand All @@ -128,6 +128,22 @@ class GetTokenDataRsp(Struct):
"sequence": t.uint8_t,
},
),
"sendMulticast": (
0x0038,
{
"aps_frame": t.EmberApsFrame,
"hops": t.uint8_t,
"broadcast_addr": t.NWK,
"alias": t.uint16_t,
"sequence": t.uint8_t,
"message_tag": t.uint8_t,
"message": t.LVBytes,
},
{
"status": t.sl_Status,
"sequence": t.uint8_t,
},
),
"launchStandaloneBootloader": (
0x008F,
{
Expand Down

0 comments on commit 9cf3aad

Please sign in to comment.