Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2bcfa9a
[WIP] Implement new zigpy network state
puddly Dec 12, 2021
d2c1129
[WIP] Implement writing network settings
puddly Dec 16, 2021
b160490
Set NWK and APS frame counters
puddly Dec 20, 2021
8b8b313
Change key table size only if the new keys don't fit
puddly Jan 13, 2022
0d486e4
Style cleanup
puddly Jan 13, 2022
f51152b
Directly create `EZSPCoordinator` instead of using a quirk
puddly Mar 7, 2022
dfa5791
Use zigpy types when creating network state objects
puddly Mar 7, 2022
539f2b6
Allow `load_network_info` to be called before/after `start_network`
puddly Mar 7, 2022
c6223c4
Allow `node_info.ieee` to be `None`
puddly Mar 15, 2022
71aab0f
Use `t.EUI64.UNKNOWN` instead of `None` to represent an unset IEEE addr
puddly Mar 15, 2022
bbd71fd
Do not leak EZSP types into zigpy
puddly Mar 21, 2022
1bd1c8e
Fix network formation when a hashed TCLK is generated
puddly Mar 23, 2022
febed7a
Joins were not being properly permitting after fcf0b49bc141fd81
puddly Mar 23, 2022
1d267a4
Use the new zigpy `add_endpoint` method
puddly Apr 19, 2022
26e297f
Call `register_endpoints` when connecting
puddly Apr 19, 2022
d56d8c6
Always leave the current network during formation
puddly Apr 19, 2022
ae46b54
Get some unit tests passing
puddly May 2, 2022
68e492f
Add unit tests for `bellows.zigbee.util`
puddly May 3, 2022
8c84e62
Increase `bellows.uart` test coverage to 100%
puddly May 4, 2022
de1e1e3
Ignore `.DS_Store` files
puddly May 4, 2022
3579f0f
Use new `pytest-asyncio` behavior
puddly May 4, 2022
47fa174
Newer versions of EmberZNet use a different response for `getChildData`
puddly May 5, 2022
4db1ee4
Use zigpy data types when populating `state`
puddly May 5, 2022
4b5f4ea
Correct the TCLK's `partner_ieee` to use the node's IEEE address
puddly May 5, 2022
0818745
Unit test `load_network_info`
puddly May 5, 2022
d017860
Assume the TCLK is always the well-known key
puddly May 5, 2022
1ce47e3
Add a few more unknown bitfields
puddly May 5, 2022
07f21b7
Refactor code dealing with keys and add some comments
puddly May 5, 2022
31da303
Write initial unit tests for `write_network_info`
puddly May 5, 2022
82924fc
Remove ignored flake8 errors from unit tests
puddly May 5, 2022
8465454
Only use one pair of `network_info` and `node_info` fixtures
puddly May 5, 2022
defc081
Test new code in `bellows.zigbee.util`
puddly May 5, 2022
eadf4ab
Add unit test for when `getMfgToken` is missing
puddly May 5, 2022
76831bb
Unit test `_ensure_network_running`
puddly May 5, 2022
cb013f1
Fix startup delay caused by slow coordinator initialization
puddly May 5, 2022
f897655
Key table size can't be adjusted
puddly May 5, 2022
90a6b48
Unit test `getChildData` for EZSP v6
puddly May 5, 2022
2925708
Unit test `leaveNetwork` failing with `INVALID_CALL`
puddly May 5, 2022
10e7ef4
Add the coordinator to the zigpy device dictionary before initialization
puddly May 5, 2022
46cfa92
Do not back up the address tables on EZSPv4, it is unstable
puddly May 5, 2022
e049ddc
Do not set frame counters when using EZSPv4
puddly May 5, 2022
b2ee3d4
Fix UART port close on RSTACK message during startup
agners May 10, 2022
74165f2
Unit test EZSP v4 changes
puddly May 10, 2022
c59b92f
Fix tests
agners May 10, 2022
90223f2
Merge branch 'fix-uart-close-race-at-startup' into puddly/zigpy-radio…
puddly May 13, 2022
c4c8d3b
Include radio library metadata in network info
puddly May 15, 2022
8741573
Fix unit tests broken by new `metadata` key
puddly May 15, 2022
2f073ec
Merge remote-tracking branch 'zigpy/dev' into puddly/zigpy-radio-api
puddly May 20, 2022
549632a
Do not set the `HAVE_TRUST_CENTER_EUI64` bit when forming a network
puddly May 28, 2022
ad2c318
Merge remote-tracking branch 'zigpy/dev' into puddly/zigpy-radio-api
puddly Jun 9, 2022
080e7b4
Bump minimum required zigpy version to 0.47.0
puddly Jun 15, 2022
aa865b3
Fix unit tests for Python 3.7
puddly Jun 16, 2022
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,8 @@ ENV/
.*.swp

# Visual Studio Code
.vscode
.vscode


# macOS
.DS_Store
2 changes: 1 addition & 1 deletion bellows/ezsp/v7/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"getChildData": (
0x4A,
(t.uint8_t,),
(t.EmberStatus, t.EmberNodeId, t.EmberEUI64, t.EmberNodeType),
(t.EmberStatus, t.EmberChildData),
),
"getSourceRouteTableTotalSize": (0xC3, (), (t.uint8_t,)),
"getSourceRouteTableFilledSize": (0xC2, (), (t.uint8_t,)),
Expand Down
22 changes: 22 additions & 0 deletions bellows/ezsp/v7/types/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,25 @@ class EmberPerDeviceDutyCycle(EzspStruct):
nodeId: named.EmberNodeId
# Amount of overall duty cycle consumed (up to suspend limit).
dutyCycleConsumed: named.EmberDutyCycleHectoPct


class EmberChildData(EzspStruct):
"""A structure containing a child node's data."""

# The EUI64 of the child
eui64: named.EmberEUI64
# The node type of the child
type: named.EmberNodeType
# The short address of the child
id: named.EmberNodeId
# The phy of the child
phy: basic.uint8_t
# The power of the child
power: basic.uint8_t
# The timeout of the child
timeout: basic.uint8_t

# The GPD's EUI64.
# gpdIeeeAddress: named.EmberEUI64
# The GPD's source ID.
# sourceId: basic.uint32_t
2 changes: 1 addition & 1 deletion bellows/ezsp/v8/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"getChildData": (
0x004A,
(t.uint8_t,),
(t.EmberStatus, t.EmberNodeId, t.EmberEUI64, t.EmberNodeType),
(t.EmberStatus, t.EmberChildData),
),
"getSourceRouteTableTotalSize": (0x00C3, (), (t.uint8_t,)),
"getSourceRouteTableFilledSize": (0x00C2, (), (t.uint8_t,)),
Expand Down
22 changes: 22 additions & 0 deletions bellows/ezsp/v8/types/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,25 @@ class EmberTransientKeyData(EzspStruct):
# The number of seconds remaining before the key is automatically timed out of the
# transient key table.
remainingTimeSeconds: basic.uint16_t


class EmberChildData(EzspStruct):
"""A structure containing a child node's data."""

# The EUI64 of the child
eui64: named.EmberEUI64
# The node type of the child
type: named.EmberNodeType
# The short address of the child
id: named.EmberNodeId
# The phy of the child
phy: basic.uint8_t
# The power of the child
power: basic.uint8_t
# The timeout of the child
timeout: basic.uint8_t

# The GPD's EUI64.
# gpdIeeeAddress: named.EmberEUI64
# The GPD's source ID.
# sourceId: basic.uint32_t
30 changes: 30 additions & 0 deletions bellows/types/named.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,9 @@ class EmberStatus(basic.enum8):
# An index was passed into the function that was larger than the valid
# range.
INDEX_OUT_OF_RANGE = 0xB1
# The passed key data is not valid. A key of all zeros or all F's are reserved
# values and cannot be used.
KEY_INVALID = 0xB2
# There are no empty entries left in the table.
TABLE_FULL = 0xB4
# The requested table entry has been erased and contains no valid data.
Expand Down Expand Up @@ -970,6 +973,8 @@ class EmberCurrentSecurityBitmask(basic.bitmap16):
GLOBAL_LINK_KEY = 0x0004
# This denotes that the node has a Trust Center Link Key.
HAVE_TRUST_CENTER_LINK_KEY = 0x0010
# TODO: 0x0020 is unknown
# TODO: 0x0040 is unknown
# This denotes that the Trust Center is using a Hashed Link Key.
TRUST_CENTER_USES_HASHED_LINK_KEY = 0x0084

Expand All @@ -994,6 +999,12 @@ class EmberKeyStructBitmask(basic.bitmap16):
# hears a device announce from the partner indicating it is not
# an 'RX on when idle' device.
KEY_PARTNER_IS_SLEEPY = 0x0020
# This indicates that the transient key which is being added is unconfirmed. This
# bit is set when we add a transient key while the EmberTcLinkKeyRequestPolicy is
# EMBER_ALLOW_TC_LINK_KEY_REQUEST_AND_GENERATE_NEW_KEY
UNCONFIRMED_TRANSIENT_KEY = 0x0040

# TODO: 0x0080 is unknown


class EmberKeyStatus(basic.enum8):
Expand Down Expand Up @@ -1757,3 +1768,22 @@ class sl_Status(basic.enum32):
SL_STATUS_WIFI_RETRY_EXCEEDED = 0x0B1F
# The request failed because the MSDU life time was exceeded
SL_STATUS_WIFI_TX_LIFETIME_EXCEEDED = 0x0B20


class EmberDistinguishedNodeId(basic.enum16):
"""A distinguished network ID that will never be assigned to any node"""

# This value is used when getting the remote node ID from the address or binding
# tables. It indicates that the address or binding table entry is currently in use
# and network address discovery is underway.
DISCOVERY_ACTIVE = 0xFFFC

# This value is used when getting the remote node ID from the address or binding
# tables. It indicates that the address or binding table entry is currently in use
# but the node ID corresponding to the EUI64 in the table is currently unknown.
UNKNOWN = 0xFFFD

# This value is used when setting or getting the remote node ID in the address table
# or getting the remote node ID from the binding table. It indicates that the
# address or binding table entry is not in use.
TABLE_ENTRY_UNUSED = 0xFFFF
15 changes: 0 additions & 15 deletions bellows/types/struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import inspect
import typing

import zigpy.state as app_state

from . import basic, named

NoneType = type(None)
Expand Down Expand Up @@ -282,19 +280,6 @@ class EmberNetworkParameters(EzspStruct):
# method.
channels: named.Channels

@property
def zigpy_network_information(self) -> app_state.NetworkInformation:
"""Convert to NetworkInformation."""
r = app_state.NetworkInformation(
self.extendedPanId,
app_state.t.PanId(self.panId),
self.nwkUpdateId,
app_state.t.NWK(self.nwkManagerId),
self.radioChannel,
channel_mask=self.channels,
)
return r


class EmberZigbeeNetwork(EzspStruct):
# The parameters of a ZigBee network.
Expand Down
Loading