-
Notifications
You must be signed in to change notification settings - Fork 5
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
API cleanup and bugfixes to get minimal functionality #13
base: master
Are you sure you want to change the base?
Conversation
CC @Maxwelltoo, as you mentioned having interest in helping out. |
Understood, I’ll take a look at these issues. |
@puddly Please see the explain as follows:
zigpy_espzb.api DEBUG Sending CommandId.extpanid_set{'panid': d6:75:3d:9a:a8:8a:8c:01} (seq=36)
|
Fixed, thanks.
I've tried adding We expect that
After a reset, the old settings are still there. I think there is some issue with the order in which these commands are called. I've tried removing some and changing
We expect that the Alternatively, is there a specific time when |
I've cleaned up the command serialization and deserialization. All commands are now in a |
Start command mean start ZigBee stack, once call, it'll start top level commissioning and indication information when formed network successfully, like this:
It'll only return command response but don't do anything if repeat call start command when has called start command. the follow steps is suggestion:
The add_endpoint must be be called after |
Thank you. I've tried the modified startup sequence but there doesn't appear to be a change, settings still aren't persisting. # 1. Reset to get into a known state
2024-04-16 23:47:23.247 macbook.local zigpy_espzb.api DEBUG Reset complete
# 2. network_init()
2024-04-16 23:47:23.247 macbook.local zigpy_espzb.api DEBUG Sending NetworkInitReq() (seq=27)
2024-04-16 23:47:23.247 macbook.local zigpy_espzb.uart DEBUG Send: 000000001b0000
2024-04-16 23:47:23.260 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x100000001b010000
2024-04-16 23:47:23.261 macbook.local zigpy_espzb.api DEBUG Received response NetworkInitRsp(status=<Status.SUCCESS: 0>) (seq 27)
# 3. form_network(role=DeviceType.COORDINATOR)
2024-04-16 23:47:23.261 macbook.local zigpy_espzb.api DEBUG Sending FormNetworkReq(role=<DeviceType.COORDINATOR: 0>, install_code_policy=<Bool.false: 0>, max_children=20) (seq=28)
2024-04-16 23:47:23.261 macbook.local zigpy_espzb.uart DEBUG Send: 000004001c0300000014
2024-04-16 23:47:23.292 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x100004001c010000
2024-04-16 23:47:23.293 macbook.local zigpy_espzb.api DEBUG Received response FormNetworkRsp(status=<Status.SUCCESS: 0>) (seq 28)
# 4. Write all of the new settings.
2024-04-16 23:47:25.295 macbook.local zigpy_espzb.api DEBUG Sending NetworkRoleSetReq(role=<DeviceType.COORDINATOR: 0>) (seq=29)
2024-04-16 23:47:25.295 macbook.local zigpy_espzb.uart DEBUG Send: 00001c001d010000
2024-04-16 23:47:25.308 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10001c001d010000
2024-04-16 23:47:25.309 macbook.local zigpy_espzb.api DEBUG Received response NetworkRoleSetRsp(status=<Status.SUCCESS: 0>) (seq 29)
2024-04-16 23:47:25.309 macbook.local zigpy_espzb.api DEBUG Sending ShortAddrSetReq(short_addr=0x0000) (seq=30)
2024-04-16 23:47:25.310 macbook.local zigpy_espzb.uart DEBUG Send: 00001e001e02000000
2024-04-16 23:47:25.324 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10001e001e010000
2024-04-16 23:47:25.325 macbook.local zigpy_espzb.api DEBUG Received response ShortAddrSetRsp(status=<Status.SUCCESS: 0>) (seq 30)
2024-04-16 23:47:25.325 macbook.local zigpy_espzb.api DEBUG Sending LongAddrGetReq() (seq=31)
2024-04-16 23:47:25.325 macbook.local zigpy_espzb.uart DEBUG Send: 00001f001f0000
2024-04-16 23:47:25.340 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10001f001f08000000000000000000
2024-04-16 23:47:25.341 macbook.local zigpy_espzb.api DEBUG Received response LongAddrGetRsp(ieee=00:00:00:00:00:00:00:00) (seq 31)
2024-04-16 23:47:25.341 macbook.local zigpy_espzb.api DEBUG Sending UsePredefinedNwkPanidSetReq(predefined=<Bool.true: 1>) (seq=32)
2024-04-16 23:47:25.341 macbook.local zigpy_espzb.uart DEBUG Send: 00002b0020010001
2024-04-16 23:47:25.356 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10002b0020010000
2024-04-16 23:47:25.357 macbook.local zigpy_espzb.api DEBUG Received response UsePredefinedNwkPanidSetRsp(status=<Status.SUCCESS: 0>) (seq 32)
2024-04-16 23:47:25.357 macbook.local zigpy_espzb.api DEBUG Sending PanidSetReq(panid=0xB1B5) (seq=33)
2024-04-16 23:47:25.357 macbook.local zigpy_espzb.uart DEBUG Send: 00000c00210200b5b1
2024-04-16 23:47:25.372 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10000c0021010000
2024-04-16 23:47:25.372 macbook.local zigpy_espzb.api DEBUG Received response PanidSetRsp(status=<Status.SUCCESS: 0>) (seq 33)
2024-04-16 23:47:25.373 macbook.local zigpy_espzb.api DEBUG Sending ExtpanidSetReq(ieee=2e:80:5a:e0:9c:83:8c:b3) (seq=34)
2024-04-16 23:47:25.373 macbook.local zigpy_espzb.uart DEBUG Send: 00000e00220800b38c839ce05a802e
2024-04-16 23:47:25.388 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10000e0022010000
2024-04-16 23:47:25.389 macbook.local zigpy_espzb.api DEBUG Received response ExtpanidSetRsp(status=<Status.SUCCESS: 0>) (seq 34)
2024-04-16 23:47:25.389 macbook.local zigpy_espzb.api DEBUG Sending NwkUpdateIdSetReq(nwk_update_id=0) (seq=35)
2024-04-16 23:47:25.389 macbook.local zigpy_espzb.uart DEBUG Send: 0000240023010000
2024-04-16 23:47:25.404 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x1000240023010000
2024-04-16 23:47:25.404 macbook.local zigpy_espzb.api DEBUG Received response NwkUpdateIdSetRsp(status=<Status.SUCCESS: 0>) (seq 35)
2024-04-16 23:47:25.405 macbook.local zigpy_espzb.api DEBUG Sending NetworkKeySetReq(nwk_key=89:e9:fb:14:90:67:a6:ab:15:30:59:e7:1b:fa:66:f0) (seq=36)
2024-04-16 23:47:25.405 macbook.local zigpy_espzb.uart DEBUG Send: 0000180024100089e9fb149067a6ab153059e71bfa66f0
2024-04-16 23:47:25.420 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x1000180024010000
2024-04-16 23:47:25.420 macbook.local zigpy_espzb.api DEBUG Received response NetworkKeySetRsp(status=<Status.SUCCESS: 0>) (seq 36)
2024-04-16 23:47:25.421 macbook.local zigpy_espzb.api DEBUG Sending NwkFrameCounterSetReq(nwk_frame_counter=0) (seq=37)
2024-04-16 23:47:25.421 macbook.local zigpy_espzb.uart DEBUG Send: 00001a0025040000000000
2024-04-16 23:47:25.436 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10001a0025010000
2024-04-16 23:47:25.437 macbook.local zigpy_espzb.api DEBUG Received response NwkFrameCounterSetRsp(status=<Status.SUCCESS: 0>) (seq 37)
2024-04-16 23:47:25.437 macbook.local zigpy_espzb.api DEBUG Sending TrustCenterAddressSetReq(trust_center_addr=00:00:00:00:00:00:00:00) (seq=38)
2024-04-16 23:47:25.437 macbook.local zigpy_espzb.uart DEBUG Send: 000026002608000000000000000000
2024-04-16 23:47:25.452 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x1000260026010000
2024-04-16 23:47:25.452 macbook.local zigpy_espzb.api DEBUG Received response TrustCenterAddressSetRsp(status=<Status.SUCCESS: 0>) (seq 38)
2024-04-16 23:47:25.453 macbook.local zigpy_espzb.api DEBUG Sending LinkKeySetReq(key=5a:69:67:42:65:65:41:6c:6c:69:61:6e:63:65:30:39) (seq=39)
2024-04-16 23:47:25.453 macbook.local zigpy_espzb.uart DEBUG Send: 000028002710005a6967426565416c6c69616e63653039
2024-04-16 23:47:25.468 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x1000280027010000
2024-04-16 23:47:25.468 macbook.local zigpy_espzb.api DEBUG Received response LinkKeySetRsp(status=<Status.SUCCESS: 0>) (seq 39)
2024-04-16 23:47:25.469 macbook.local zigpy_espzb.api DEBUG Sending SecurityModeSetReq(security_mode=<SecurityMode.PRECONFIGURED_NETWORK_KEY: 1>) (seq=40)
2024-04-16 23:47:25.469 macbook.local zigpy_espzb.uart DEBUG Send: 00002a0028010001
2024-04-16 23:47:25.484 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10002a0028010000
2024-04-16 23:47:25.484 macbook.local zigpy_espzb.api DEBUG Received response SecurityModeSetRsp(status=<Status.SUCCESS: 0>) (seq 40)
2024-04-16 23:47:25.485 macbook.local zigpy_espzb.api DEBUG Sending CurrentChannelSetReq(channel=15) (seq=41)
2024-04-16 23:47:25.485 macbook.local zigpy_espzb.uart DEBUG Send: 000014002901000f
2024-04-16 23:47:25.500 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x1000140029010000
2024-04-16 23:47:25.500 macbook.local zigpy_espzb.api DEBUG Received response CurrentChannelSetRsp(status=<Status.SUCCESS: 0>) (seq 41)
# 5. start(autostart=True) or start(autostart=False)
2024-04-16 23:47:25.501 macbook.local zigpy_espzb.api DEBUG Sending StartReq(autostart=<Bool.true: 1>) (seq=42)
2024-04-16 23:47:25.501 macbook.local zigpy_espzb.uart DEBUG Send: 000001002a010001
2024-04-16 23:47:25.533 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x100001002a010000
2024-04-16 23:47:25.533 macbook.local zigpy_espzb.api DEBUG Received response StartRsp(status=<Status.SUCCESS: 0>) (seq 42)
2024-04-16 23:47:25.533 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x20000500e5010000
2024-04-16 23:47:25.533 macbook.local zigpy_espzb.api DEBUG Received indication PermitJoiningInd(duration=0) (seq 229)
# ?? `FormNetworkInd` is received but with the wrong PAN ID, EPID, and channel
2024-04-16 23:47:25.548 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x20000400b80b00ae3c60feffbd4d74044d19
2024-04-16 23:47:25.548 macbook.local zigpy_espzb.api DEBUG Received indication FormNetworkInd(extended_panid=74:4d:bd:ff:fe:60:3c:ae, panid=0x4D04, channel=25) (seq 184)
2024-04-16 23:47:26.141 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x20000500220100b4
2024-04-16 23:47:26.143 macbook.local zigpy_espzb.api DEBUG Received indication PermitJoiningInd(duration=180) (seq 34)
# Resetting again
2024-04-16 23:47:27.536 macbook.local zigpy_espzb.api DEBUG Resetting via crash...
2024-04-16 23:47:27.537 macbook.local zigpy_espzb.api DEBUG Sending FormNetworkReq(role=<DeviceType.COORDINATOR: 0>, install_code_policy=<Bool.false: 0>, max_children=20) (seq=43)
2024-04-16 23:47:27.538 macbook.local zigpy_espzb.uart DEBUG Send: 000004002b0300000014
2024-04-16 23:47:29.340 macbook.local zigpy_espzb.api DEBUG No response to 'FormNetworkReq(role=<DeviceType.COORDINATOR: 0>, install_code_policy=<Bool.false: 0>, max_children=20)' command with seq 43
2024-04-16 23:47:31.344 macbook.local zigpy_espzb.api DEBUG Reset complete
# Performing a backup to read current settings
2024-04-16 23:47:31.345 macbook.local zigpy_espzb.api DEBUG Sending NetworkInitReq() (seq=44)
2024-04-16 23:47:31.346 macbook.local zigpy_espzb.uart DEBUG Send: 000000002c0000
2024-04-16 23:47:31.356 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x100000002c010000
2024-04-16 23:47:31.357 macbook.local zigpy_espzb.api DEBUG Received response NetworkInitRsp(status=<Status.SUCCESS: 0>) (seq 44)
2024-04-16 23:47:31.357 macbook.local zigpy_espzb.api DEBUG Sending FormNetworkReq(role=<DeviceType.COORDINATOR: 0>, install_code_policy=<Bool.false: 0>, max_children=20) (seq=45)
2024-04-16 23:47:31.357 macbook.local zigpy_espzb.uart DEBUG Send: 000004002d0300000014
2024-04-16 23:47:31.388 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x100004002d010000
2024-04-16 23:47:31.389 macbook.local zigpy_espzb.api DEBUG Received response FormNetworkRsp(status=<Status.SUCCESS: 0>) (seq 45)
2024-04-16 23:47:33.393 macbook.local zigpy_espzb.api DEBUG Sending StartReq(autostart=<Bool.true: 1>) (seq=46)
2024-04-16 23:47:33.394 macbook.local zigpy_espzb.uart DEBUG Send: 000001002e010001
2024-04-16 23:47:33.420 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x100001002e010000
2024-04-16 23:47:33.421 macbook.local zigpy_espzb.api DEBUG Received response StartRsp(status=<Status.SUCCESS: 0>) (seq 46)
2024-04-16 23:47:33.436 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x200005007f010000
2024-04-16 23:47:33.437 macbook.local zigpy_espzb.api DEBUG Received indication PermitJoiningInd(duration=0) (seq 127)
2024-04-16 23:47:33.452 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x20000400a80b00ae3c60feffbd4d74044d19
2024-04-16 23:47:33.453 macbook.local zigpy_espzb.api DEBUG Received indication FormNetworkInd(extended_panid=74:4d:bd:ff:fe:60:3c:ae, panid=0x4D04, channel=25) (seq 168)
2024-04-16 23:47:34.046 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x200005008a0100b4
2024-04-16 23:47:34.047 macbook.local zigpy_espzb.api DEBUG Received indication PermitJoiningInd(duration=180) (seq 138)
2024-04-16 23:47:35.425 macbook.local zigpy_espzb.api DEBUG Sending NetworkRoleGetReq() (seq=47)
2024-04-16 23:47:35.426 macbook.local zigpy_espzb.uart DEBUG Send: 00001b002f0000
2024-04-16 23:47:35.437 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10001b002f010000
2024-04-16 23:47:35.437 macbook.local zigpy_espzb.api DEBUG Received response NetworkRoleGetRsp(role=<DeviceType.COORDINATOR: 0>) (seq 47)
2024-04-16 23:47:35.437 macbook.local zigpy_espzb.api DEBUG Sending ShortAddrGetReq() (seq=48)
2024-04-16 23:47:35.438 macbook.local zigpy_espzb.uart DEBUG Send: 00001d00300000
2024-04-16 23:47:35.452 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10001d003002000000
2024-04-16 23:47:35.453 macbook.local zigpy_espzb.api DEBUG Received response ShortAddrGetRsp(short_addr=0x0000) (seq 48)
2024-04-16 23:47:35.454 macbook.local zigpy_espzb.api DEBUG Sending LongAddrGetReq() (seq=49)
2024-04-16 23:47:35.454 macbook.local zigpy_espzb.uart DEBUG Send: 00001f00310000
2024-04-16 23:47:35.468 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10001f00310800ae3c60feffbd4d74
2024-04-16 23:47:35.469 macbook.local zigpy_espzb.api DEBUG Received response LongAddrGetRsp(ieee=74:4d:bd:ff:fe:60:3c:ae) (seq 49)
2024-04-16 23:47:35.470 macbook.local zigpy_espzb.api DEBUG Sending PanidGetReq() (seq=50)
2024-04-16 23:47:35.470 macbook.local zigpy_espzb.uart DEBUG Send: 00000b00320000
2024-04-16 23:47:35.484 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10000b00320200044d
2024-04-16 23:47:35.485 macbook.local zigpy_espzb.api DEBUG Received response PanidGetRsp(panid=0x4D04) (seq 50)
2024-04-16 23:47:35.485 macbook.local zigpy_espzb.api DEBUG Sending ExtpanidGetReq() (seq=51)
2024-04-16 23:47:35.485 macbook.local zigpy_espzb.uart DEBUG Send: 00000d00330000
2024-04-16 23:47:35.500 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10000d00330800ae3c60feffbd4d74
2024-04-16 23:47:35.500 macbook.local zigpy_espzb.api DEBUG Received response ExtpanidGetRsp(ieee=74:4d:bd:ff:fe:60:3c:ae) (seq 51)
2024-04-16 23:47:35.501 macbook.local zigpy_espzb.api DEBUG Sending CurrentChannelGetReq() (seq=52)
2024-04-16 23:47:35.501 macbook.local zigpy_espzb.uart DEBUG Send: 00001300340000
2024-04-16 23:47:35.516 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x1000130034010019
2024-04-16 23:47:35.517 macbook.local zigpy_espzb.api DEBUG Received response CurrentChannelGetRsp(channel=25) (seq 52)
2024-04-16 23:47:35.517 macbook.local zigpy_espzb.api DEBUG Sending PrimaryChannelMaskGetReq() (seq=53)
2024-04-16 23:47:35.517 macbook.local zigpy_espzb.uart DEBUG Send: 00000f00350000
2024-04-16 23:47:35.532 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10000f0035040000000000
2024-04-16 23:47:35.533 macbook.local zigpy_espzb.api DEBUG Received response PrimaryChannelMaskGetRsp(channel_mask=<ShiftedChannels.NO_CHANNELS: 0>) (seq 53)
2024-04-16 23:47:35.533 macbook.local zigpy_espzb.api DEBUG Sending NwkUpdateIdGetReq() (seq=54)
2024-04-16 23:47:35.533 macbook.local zigpy_espzb.uart DEBUG Send: 00002300360000
2024-04-16 23:47:35.548 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x1000230036010001
2024-04-16 23:47:35.548 macbook.local zigpy_espzb.api DEBUG Received response NwkUpdateIdGetRsp(nwk_update_id=1) (seq 54)
2024-04-16 23:47:35.549 macbook.local zigpy_espzb.api DEBUG Sending NetworkKeyGetReq() (seq=55)
2024-04-16 23:47:35.549 macbook.local zigpy_espzb.uart DEBUG Send: 00001700370000
2024-04-16 23:47:35.565 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10001700371000332555ec57be4b36ec7d087c2dfa1316
2024-04-16 23:47:35.565 macbook.local zigpy_espzb.api DEBUG Received response NetworkKeyGetRsp(nwk_key=33:25:55:ec:57:be:4b:36:ec:7d:08:7c:2d:fa:13:16) (seq 55)
2024-04-16 23:47:35.565 macbook.local zigpy_espzb.api DEBUG Sending NwkFrameCounterGetReq() (seq=56)
2024-04-16 23:47:35.565 macbook.local zigpy_espzb.uart DEBUG Send: 00001900380000
2024-04-16 23:47:35.580 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x1000190038040088130000
2024-04-16 23:47:35.580 macbook.local zigpy_espzb.api DEBUG Received response NwkFrameCounterGetRsp(nwk_frame_counter=5000) (seq 56)
2024-04-16 23:47:35.581 macbook.local zigpy_espzb.api DEBUG Sending LinkKeyGetReq() (seq=57)
2024-04-16 23:47:35.581 macbook.local zigpy_espzb.uart DEBUG Send: 00002700390000
2024-04-16 23:47:35.596 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x10002700391800ae3c60feffbd4d745a6967426565416c6c69616e63653039
2024-04-16 23:47:35.596 macbook.local zigpy_espzb.api DEBUG Received response LinkKeyGetRsp(ieee=74:4d:bd:ff:fe:60:3c:ae, key=5a:69:67:42:65:65:41:6c:6c:69:61:6e:63:65:30:39) (seq 57)
2024-04-16 23:47:35.597 macbook.local zigpy_espzb.api DEBUG Sending TrustCenterAddressGetReq() (seq=58)
2024-04-16 23:47:35.597 macbook.local zigpy_espzb.uart DEBUG Send: 000025003a0000
2024-04-16 23:47:35.612 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x100025003a0800ab9809ffff2e2100
2024-04-16 23:47:35.612 macbook.local zigpy_espzb.api DEBUG Received response TrustCenterAddressGetRsp(trust_center_addr=00:21:2e:ff:ff:09:98:ab) (seq 58)
2024-04-16 23:47:35.613 macbook.local zigpy_espzb.api DEBUG Sending SecurityModeGetReq() (seq=59)
2024-04-16 23:47:35.613 macbook.local zigpy_espzb.uart DEBUG Send: 000029003b0000
2024-04-16 23:47:35.628 macbook.local zigpy_espzb.uart DEBUG Frame received: 0x100029003b010000
2024-04-16 23:47:35.628 macbook.local zigpy_espzb.api DEBUG Received response SecurityModeGetRsp(security_mode=<SecurityMode.NO_SECURITY: 0>) (seq 59)
# Same problem, wrong settings are read
2024-04-16 23:47:35.629 macbook.local zigpy.backups DEBUG Adding a new backup NetworkBackup(version=1, backup_time=datetime.datetime(2024, 4, 17, 3, 47, 35, 629149, tzinfo=datetime.timezone.utc), network_info=NetworkInfo(extended_pan_id=74:4d:bd:ff:fe:60:3c:ae, pan_id=0x4D04, nwk_update_id=1, nwk_manager_id=0x0000, channel=25, channel_mask=<Channels.NO_CHANNELS: 0>, security_level=0, network_key=Key(key=33:25:55:ec:57:be:4b:36:ec:7d:08:7c:2d:fa:13:16, tx_counter=5000, rx_counter=0, seq=0, partner_ieee=ff:ff:ff:ff:ff:ff:ff:ff), tc_link_key=Key(key=5a:69:67:42:65:65:41:6c:6c:69:61:6e:63:65:30:39, tx_counter=0, rx_counter=0, seq=0, partner_ieee=00:21:2e:ff:ff:09:98:ab), key_table=[], children=[], nwk_addresses={}, stack_specific={}, metadata={}, source='[email protected]'), node_info=NodeInfo(nwk=0x0000, ieee=74:4d:bd:ff:fe:60:3c:ae, logical_type=<LogicalType.Coordinator: 0>, model='ESP32H2', manufacturer='Espressif Systems', version='0x00000000'))
2024-04-16 23:47:35.629 macbook.local zigpy_espzb.api DEBUG Serial '/dev/cu.usbserial-A94TYUSB' connection lost unexpectedly: None |
Write all of the new settings.
only return command response because of do not allow set short address, will add it.
only return command response beacuse of do not allow set PAN ID, will add it.
only return command response beacuse of do not allow set extended PAN ID, could use long_addr_set command?
only return command response, will add it.
it means channel mask, please use primary_channel_mask_set command set it as 1 < 15 if you want to work on 15 channel |
Performing a backup to read current settings
return the generate address
return the long address by
return the generate PAN ID
return the generate EXTENDED PAN ID
return channel which match
return default channel mask when reset device
return default update ID when reset device
return the generate KEY
return default count
return default trust center
return default secure mode |
@puddly Could we don't write these network information but can read it continue because of there are not handle action for some command? BTW, i checked the function by end device, it can join the network. |
What means about the reset command? restart or factory the device? |
Please download the firmware as follows which support system frame ID and match with feature/serialization-fixes branch. |
@puddly Any update about this? |
@lhespress Are you Espressif developer?) |
@KlimovVladimir Yes,It'll be update once the firmware as the attachment has been checked and match the function. |
@lhespress Sorry for the delay. I've tested the firmware and made some adjustments to this branch. It looks like things are getting better. Things that now work:
Things that do not:
I think I am confused about the stack startup sequence. Could you explain how to do the following?
Other than that, it would be nice if the stack sent some sort of indication upon boot or reset, as this would allow the |
@lhespress Any updates on this? |
That's because of it'll form a network automatic after start command, i changed the startup sequence which can read and write the network information without form command. BTW, it must call factory command when write network information with forming a network.
It can't load network setting without forming a network in the build0516.zip firmware. I have changed in the follow firmware.
That's because of it'll form a network automatic after start command, so it'll forming a new network in the build0516.zip firmware. It'll sent an factory indication without forming a new one in the follow firmware.
It'll sent an indication when factory or reset in the follow firmware. Please download the firmware build0717.zip which change startup sequence and match with fixes-serialization branch. |
@puddly Any update about the newest firmware? |
I will try to work on testing the new firmware some time this week. |
Hey everyone, I'm interested in using an ESP32-C6 as a zigbee coordinator radio as part of the zigpy stack. I see this PR is linked in various upstream issues as a blocker and wanted to see if there's some way I can help with testing or bug fixes. Any specific areas you think are good to jump in and help? |
@robbawebba Thanks for your help firstly. Could you help confirm the function use the firmware build_1016.zip on ESP32-C6 which UART use GPIO4 (RX) and GPIO5 (TX)? |
@lhespress I have a request. Would it be possible for you to build a version of the ESP32-H2 firmware that uses the USB-C UART port of the device? Testing it with a USB-UART adapter requires extra wires and USB ports compared to other coordinators that can function just over USB. Unfortunately, the new firmware doesn't appear to work very well. Reset indications are not sent on startup and network formation no longer respects the written settings. Just to make sure we're on the same page, here is exactly how I am testing: # In the zigpy-espzb virtualenv
pip install git+https://github.com/lhespress/zigpy-cli@feature/zigpy_espzb
pip install -e . # To install the development version of zigpy-espzb
# Leave the current network and erase all settings
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB reset
# If you try to read settings, you should get a `NetworkNotFormed` error
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB backup -z
# Form a temporary network, perform an energy scan to find a good channel, then use the settings provided by zigpy
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB form
# Dump the current network settings
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB backup -z > backup.json
### At this point, read `backup.json` and make sure the settings match what zigpy wrote
# Form a new network with random settings
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB form
# Restore the old network settings
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB restore backup.json
# Dump the settings again
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB backup -z > backup2.json
# They should be identical except for the frame counter increasing by 5000 and the backup timestamp changing
diff backup.json backup2.json
# Energy scanning should work
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB energy-scan
# And finally, new devices can join the network and be interviewed by zigpy
zigpy -vvv radio --baudrate 115200 znsp /dev/cu.usbserial-A94TYUSB permit You will see in the log output what settings the
I feel there is some mistake with the |
@puddly Please check build_1022.zip which use the USB-C UART port of the device for command. BTW, if you want to show the log which use GPIO4 (RX) and GPIO5 (TX) as UART. |
Hi @lhespress, I was able to test the same functionality outlined above on ESP32-C6. I observed a few results that don't match the expected outcome, but I'll let you be the judge of that since I'm new to this effort. Below are the test steps and observations. Attached are the zigby cli debug logs.
Please let me know if you need additional testing help or more logs! Maybe I'll try setting this up with ZHA too. |
@lhespress You can see from @robbawebba running the tests that there are still some problems. Can you explain what exact commands I need to run, from the moment I connect to the serial port, to:
I feel there is some mistake with the |
|
@robbawebba Thanks for you share the test result.
|
This is a fairly large PR but until the radio library is actually functional I don't see a need to split it up.
I've made a few changes:
get_
prefix and setters to useset_
.At the moment, a few things do not work:
Active_EP_req
with anything other than[242, 242]
(also a bug?).set_nwk_extended_panid
is called. If this call is removed, backup restoration "works" but no new settings are actually written.permit
similarly doesn't work and crashes with the same error as above.I believe that many of these issues stem from the network startup/shutdown/settings writing sequence being unclear. I wasn't able to find anything in the documentation about forming a new network with specific settings, especially with the radio already running.
For the library to be functional with ZHA, the following need to work and they are what I am currently trying to fix:
Could you explain a little more the process to read/write network settings like I have above? The
write_network_info
function should be pretty simple at this point so let me know what should be changed to get it working. I've added# TODO
comments throughout the library in places where I ran into trouble.Let me know if you have any questions!