Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename add_neighbour to update_neighbor and document action field #238

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,8 @@ async def test_add_neighbour(api, mock_command_rsp):

assert api._command.mock_calls == [
call(
deconz_api.CommandId.add_neighbour,
unknown=0x01,
deconz_api.CommandId.update_neighbor,
action=deconz_api.UpdateNeighborAction.ADD,
nwk=0x1234,
ieee=t.EUI64.convert("aa:bb:cc:dd:11:22:33:44"),
mac_capability_flags=0x12,
Expand Down
16 changes: 10 additions & 6 deletions zigpy_deconz/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class CommandId(t.enum8):
aps_data_indication = 0x17
zigbee_green_power = 0x19
mac_poll = 0x1C
add_neighbour = 0x1D
update_neighbor = 0x1D
mac_beacon_indication = 0x1F


Expand Down Expand Up @@ -168,6 +168,10 @@ class IndexedEndpoint(Struct):
descriptor: SimpleDescriptor


class UpdateNeighborAction(t.enum8):
ADD = 0x01


NETWORK_PARAMETER_TYPES = {
NetworkParameter.mac_address: (None, t.EUI64),
NetworkParameter.nwk_panid: (None, t.PanId),
Expand Down Expand Up @@ -199,12 +203,12 @@ class Command(Struct):


COMMAND_SCHEMAS = {
CommandId.add_neighbour: (
CommandId.update_neighbor: (
{
"status": Status.SUCCESS,
"frame_length": FRAME_LENGTH,
"payload_length": PAYLOAD_LENGTH,
"unknown": t.uint8_t,
"action": UpdateNeighborAction,
"nwk": t.NWK,
"ieee": t.EUI64,
"mac_capability_flags": t.uint8_t,
Expand All @@ -213,7 +217,7 @@ class Command(Struct):
"status": Status,
"frame_length": t.uint16_t,
"payload_length": t.uint16_t,
"unknown": t.uint8_t,
"action": UpdateNeighborAction,
"nwk": t.NWK,
"ieee": t.EUI64,
"mac_capability_flags": t.uint8_t,
Expand Down Expand Up @@ -837,8 +841,8 @@ async def add_neighbour(
self, nwk: t.NWK, ieee: t.EUI64, mac_capability_flags: t.uint8_t
) -> None:
await self._command(
CommandId.add_neighbour,
unknown=0x01,
CommandId.update_neighbor,
action=UpdateNeighborAction.ADD,
nwk=nwk,
ieee=ieee,
mac_capability_flags=mac_capability_flags,
Expand Down
Loading