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

Implement new radio API #172

Merged
merged 31 commits into from
Jun 19, 2022
Merged

Implement new radio API #172

merged 31 commits into from
Jun 19, 2022

Conversation

puddly
Copy link
Contributor

@puddly puddly commented Nov 13, 2021

zigpy/zigpy#848

So far the only data that's "lost" during migration is the channel mask if it isn't just a single channel. This isn't a problem for coordinators and can be addressed if we ever support router mode.

I was able to migrate my network from a ZZH to a Conbee II with fairly boilerplate code:

import coloredlogs
coloredlogs.install(level="DEBUG")

from zigpy_deconz.zigbee.application import ControllerApplication as DeconzControllerApplication
from zigpy_znp.zigbee.application import ControllerApplication as ZNPControllerApplication

znp_config = ZNPControllerApplication.SCHEMA({"device": {"path": "/dev/..."}})
deconz_config = DeconzControllerApplication.SCHEMA({"device": {"path": "/dev/..."}})

znp = ZNPControllerApplication(znp_config)
deconz = DeconzControllerApplication(deconz_config)

await znp.connect()
await deconz.connect()

# Perhaps it would be better to have this method return a tuple instead of changing attributes?
await znp.load_network_info(load_devices=True)
await deconz.write_network_info(network_info=znp.state.network_info, node_info=znp.state.node_info)

await znp.disconnect()
await deconz.disconnect()

@puddly puddly mentioned this pull request Mar 11, 2022
@Hedda
Copy link
Contributor

Hedda commented Mar 15, 2022

@puddly FYI, it was just mentioned by @pipiche38 in dresden-elektronik/deconz-serial-protocol#17 that for "Wiser (legacy) devices by Schneider Electric" they like to use this in new radio API for zigpy-deconz, which is possible zigpy-znp and bellows:

  • Not possible to form a new network and to change the Extended PAN Id ( a must for Legacy Wiser devices)
  • Not possible to add coordinator Endpoint as for ZNP or Ezsp (for exemple) this prevent having
    Wiser legacy and Wiser paired and working Livolo switch

the Extended PAN Id seems to be implemented in the new Radio Api, however the force_form new network I have issues with.

For adding Ep, I didn't find any api for that (probably because we are the only one having Schneider Wiser eco-system running)

According to @manup reply dresden-elektronik/deconz-serial-protocol#17 both should be possible via deCONZ Serial Protocol?

The serial protocol allows to specify Extended PANID ("APS Use Extended PANID" parameter) and to configure custom endpoints/clusters. These need be set while the network is disconnected and become active after network start.

@pipiche38
Copy link

Any reason why there is no permit() api ?

@puddly
Copy link
Contributor Author

puddly commented Mar 16, 2022

Zigpy implements permit, the radio implements only permit_ncp.

@pipiche38
Copy link

pipiche38 commented Apr 19, 2022

Just trying the latest update and I'm unable to launch, did you do some changes which could explain such error ?
I'm able to run ZNP, Bellows without issues !

Error while launching App_deconz Can't instantiate abstract class App_deconz with abstract method register_endpoint

App_deconz is called like that
https://github.com/zigbeefordomoticz/Domoticz-Zigbee/blob/56e3e85e2e356ba34d35704aa17aaec2e579ea8c/Classes/ZigpyTransport/zigpyThread.py#L150

and is defined here: https://github.com/zigbeefordomoticz/Domoticz-Zigbee/blob/56e3e85e2e356ba34d35704aa17aaec2e579ea8c/Classes/ZigpyTransport/AppDeconz.py#L43

@puddly
Copy link
Contributor Author

puddly commented Apr 19, 2022

I've created an add_endpoint method on all the radio libraries, called by ControllerApplication.register_endpoints. This is the current implementation:

https://github.com/puddly/zigpy/blob/8593f1ab36ab43bf696beec0095ad5fb64512680/zigpy/application.py#L450-L487

It's a combination of the default deCONZ endpoints with the ZNP defaults. If you have any suggestions for additional clusters or another endpoint (since the Conbee can only support three), let me know.

@pipiche38
Copy link

pipiche38 commented Apr 20, 2022

I've created an add_endpoint method on all the radio libraries, called by ControllerApplication.register_endpoints. This is the current implementation:

https://github.com/puddly/zigpy/blob/8593f1ab36ab43bf696beec0095ad5fb64512680/zigpy/application.py#L450-L487

It's a combination of the default deCONZ endpoints with the ZNP defaults. If you have any suggestions for additional clusters or another endpoint (since the Conbee can only support three), let me know.

Excellent, so can you tell me how I should use it ?

Here after would be to do the standard way

    async def register_endpoint(self, endpoint=0x01):
        await super().add_endpoint(endpoint)   # Standard ZCL 0x01

If now I want to add additional endpoint like 0x03

@pipiche38
Copy link

I've created an add_endpoint method on all the radio libraries, called by ControllerApplication.register_endpoints. This is the current implementation:
https://github.com/puddly/zigpy/blob/8593f1ab36ab43bf696beec0095ad5fb64512680/zigpy/application.py#L450-L487
It's a combination of the default deCONZ endpoints with the ZNP defaults. If you have any suggestions for additional clusters or another endpoint (since the Conbee can only support three), let me know.

Excellent, so can you tell me how I should use it ?

Here after would be to do the standard way

    async def register_endpoint(self, endpoint=0x01):
        await super().add_endpoint(endpoint)   # Standard ZCL 0x01

If now I want to add additional endpoint like 0x03

In addition if I do the following:

    async def register_endpoints(self):
        await super().register_endpoints()  
I'm getting this error message

2022-04-20 14:24:22,887 DEBUG   :Frame received: 0x0b19000800010026
2022-04-20 14:24:22,888 DEBUG   :Write parameter watchdog_ttl: SUCCESS
2022-04-20 14:24:22,892 ERROR   :Error Traceback (most recent call last):
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/Classes/ZigpyTransport/AppDeconz.py", line 59, in startup
    await super().startup(auto_form=True)
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy/application.py", line 75, in startup
    await self.start_network()
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/zigbee/application.py", line 109, in start_network
    await self.register_endpoints()
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/Classes/ZigpyTransport/AppDeconz.py", line 94, in register_endpoints
    await super().register_endpoints()
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy/application.py", line 478, in register_endpoints
    await self.add_endpoint(
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/zigbee/application.py", line 375, in add_endpoint
    await self._api.write_parameter(
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/api.py", line 326, in _command
    return await asyncio.wait_for(fut, timeout=COMMAND_TIMEOUT)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 481, in wait_for
    return fut.result()
zigpy_deconz.exception.CommandError: Command.write_parameter, status: Status.UNSUPPORTED

@Hedda
Copy link
Contributor

Hedda commented Apr 20, 2022

I've created an add_endpoint method on all the radio libraries, called by ControllerApplication.register_endpoints.

@puddly Is it possible to also create a remove_endpoint method on all the radio libraries as well?

That request was brought up by @pipiche38 in zigbeefordomoticz/Domoticz-Zigbee#1145

Originally posted by @pipiche38 in zigbeefordomoticz/Domoticz-Zigbee#1145 (comment)

Ok, sound fine with, but right now from zigpy standpoint I can only add_endpoints and not remove any

@puddly
Copy link
Contributor Author

puddly commented Apr 20, 2022

Excellent, so can you tell me how I should use it ?

from zigpy_deconz.zigbee.application import ControllerApplication as DeconzControllerApplication

class YourDeconzControllerApplication(DeconzControllerApplication):
    async def register_endpoints(self):
        await self.add_endpoint(
            zdo_types.SimpleDescriptor(
                endpoint=1,
                profile=zigpy.profiles.zha.PROFILE_ID,
                ...

I'm getting this error message

Please post the full DEBUG-level log output of the entire application. The error message alone doesn't contain much information.

Is it possible to also create a remove_endpoint method on all the radio libraries as well?

I don't think this is possible.

  1. Only ZNP allows deleting endpoints, EZSP does not seem to have a command to do this.
  2. If you override register_endpoints and register three endpoints, the coordinator will not define any unnecessary endpoints on startup so there's no reason to explicitly delete any.

@pipiche38
Copy link

pipiche38 commented Apr 20, 2022

Here are the logs. And line 94 is AppDeconz is the call to await super().register_endpoints()

2022-04-20 19:12:55,583 DEBUG   :Connection made
2022-04-20 19:12:55,584 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.protocol_version: 34>, b'')
2022-04-20 19:12:55,585 DEBUG   :Send: 0x0a02000800010022
2022-04-20 19:12:55,587 DEBUG   :Frame received: 0x0a02000a000300220e01
2022-04-20 19:12:55,589 DEBUG   :Read parameter protocol_version response: [270]
2022-04-20 19:12:55,589 DEBUG   :Command Command.version (0,)
2022-04-20 19:12:55,590 DEBUG   :Send: 0x0d0300090000000000
2022-04-20 19:12:55,597 DEBUG   :Frame received: 0x0d0300090000077226
2022-04-20 19:12:55,598 DEBUG   :Version response: 26720700
2022-04-20 19:12:55,599 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.mac_address: 1>, b'')
2022-04-20 19:12:55,600 DEBUG   :Send: 0x0a04000800010001
2022-04-20 19:12:55,603 DEBUG   :Frame received: 0x0a040010000900017ffe05ffff2e2100
2022-04-20 19:12:55,604 DEBUG   :Frame received: 0x0e05000700a200
2022-04-20 19:12:55,604 DEBUG   :Device state changed response: [<DeviceState.128|APSDE_DATA_REQUEST_SLOTS_AVAILABLE|2: 162>, 0]
2022-04-20 19:12:55,605 DEBUG   :Network state transition: OFFLINE -> CONNECTED
2022-04-20 19:12:55,606 DEBUG   :Read parameter mac_address response: [00:21:2e:ff:ff:05:fe:7f]
2022-04-20 19:12:55,607 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.aps_designed_coordinator: 9>, b'')
2022-04-20 19:12:55,608 DEBUG   :Send: 0x0a05000800010009
2022-04-20 19:12:55,609 DEBUG   :Frame received: 0x0a0500090002000901
2022-04-20 19:12:55,610 DEBUG   :Read parameter aps_designed_coordinator response: [1]
2022-04-20 19:12:55,610 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.nwk_address: 7>, b'')
2022-04-20 19:12:55,611 DEBUG   :Send: 0x0a06000800010007
2022-04-20 19:12:55,619 DEBUG   :Frame received: 0x0a06000a000300070000
2022-04-20 19:12:55,620 DEBUG   :Read parameter nwk_address response: [0x0000]
2022-04-20 19:12:55,620 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.nwk_panid: 5>, b'')
2022-04-20 19:12:55,621 DEBUG   :Send: 0x0a07000800010005
2022-04-20 19:12:55,623 DEBUG   :Frame received: 0x0a07000a000300057e1e
2022-04-20 19:12:55,624 DEBUG   :Read parameter nwk_panid response: [0x1e7e]
2022-04-20 19:12:55,624 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.aps_extended_panid: 11>, b'')
2022-04-20 19:12:55,625 DEBUG   :Send: 0x0a0800080001000b
2022-04-20 19:12:55,632 DEBUG   :Frame received: 0x0a0800100009000b105e01044548badc
2022-04-20 19:12:55,633 DEBUG   :Read parameter aps_extended_panid response: [dc:ba:48:45:04:01:5e:10]
2022-04-20 19:12:55,634 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.current_channel: 28>, b'')
2022-04-20 19:12:55,634 DEBUG   :Send: 0x0a0900080001001c
2022-04-20 19:12:55,636 DEBUG   :Frame received: 0x0a0900090002001c0f
2022-04-20 19:12:55,637 DEBUG   :Read parameter current_channel response: [15]
2022-04-20 19:12:55,637 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.channel_mask: 10>, b'')
2022-04-20 19:12:55,638 DEBUG   :Send: 0x0a0a00080001000a
2022-04-20 19:12:55,646 DEBUG   :Frame received: 0x0a0a000c0005000a00800000
2022-04-20 19:12:55,647 DEBUG   :Read parameter channel_mask response: [<Channels.CHANNEL_15: 32768>]
2022-04-20 19:12:55,647 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.nwk_update_id: 36>, b'')
2022-04-20 19:12:55,648 DEBUG   :Send: 0x0a0b000800010024
2022-04-20 19:12:55,650 DEBUG   :Frame received: 0x0a0b00090002002400
2022-04-20 19:12:55,651 DEBUG   :Read parameter nwk_update_id response: [0]
2022-04-20 19:12:55,651 DEBUG   :Command Command.read_parameter (2, <NetworkParameter.network_key: 24>, b'\x00')
2022-04-20 19:12:55,652 DEBUG   :Send: 0x0a0c00090002001800
2022-04-20 19:12:55,659 DEBUG   :Frame received: 0x0a0c00190012001800cf1ee7a852c404ef4aef7b35c60f34a5
2022-04-20 19:12:55,660 DEBUG   :Read parameter network_key response: [0, [207, 30, 231, 168, 82, 196, 4, 239, 74, 239, 123, 53, 198, 15, 52, 165]]
2022-04-20 19:12:55,661 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.nwk_frame_counter: 39>, b'')
2022-04-20 19:12:55,661 DEBUG   :Send: 0x0a0d000800010027
2022-04-20 19:12:55,663 DEBUG   :Frame received: 0x0a0d000c00050027e82c0700
2022-04-20 19:12:55,664 DEBUG   :Read parameter nwk_frame_counter response: [470248]
2022-04-20 19:12:55,664 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.trust_center_address: 14>, b'')
2022-04-20 19:12:55,665 DEBUG   :Send: 0x0a0e00080001000e
2022-04-20 19:12:55,672 DEBUG   :Frame received: 0x0a0e00100009000e7ffe05ffff2e2100
2022-04-20 19:12:55,673 DEBUG   :Read parameter trust_center_address response: [00:21:2e:ff:ff:05:fe:7f]
2022-04-20 19:12:55,674 DEBUG   :Command Command.read_parameter (9, <NetworkParameter.link_key: 25>, b'\x7f\xfe\x05\xff\xff.!\x00')
2022-04-20 19:12:55,674 DEBUG   :Send: 0x0a0f0010000900197ffe05ffff2e2100
2022-04-20 19:12:55,676 DEBUG   :Frame received: 0x0a0f0020001900197ffe05ffff2e21005a6967426565416c6c69616e63653039
2022-04-20 19:12:55,677 DEBUG   :Read parameter link_key response: [00:21:2e:ff:ff:05:fe:7f, [90, 105, 103, 66, 101, 101, 65, 108, 108, 105, 97, 110, 99, 101, 48, 57]]
2022-04-20 19:12:55,678 DEBUG   :Command Command.read_parameter (1, <NetworkParameter.security_mode: 16>, b'')
2022-04-20 19:12:55,679 DEBUG   :Send: 0x0a10000800010010
2022-04-20 19:12:55,686 DEBUG   :Frame received: 0x0a1000090002001003
2022-04-20 19:12:55,687 DEBUG   :Read parameter security_mode response: [3]
2022-04-20 19:12:55,688 DEBUG   :Command Command.read_parameter (2, <NetworkParameter.configure_endpoint: 19>, b'\x00')
2022-04-20 19:12:55,689 DEBUG   :Send: 0x0a1100090002001300
2022-04-20 19:12:55,691 DEBUG   :Frame received: 0x0a110023001c00130001040100040005000006000a0019000105040100200000050205
2022-04-20 19:12:55,693 DEBUG   :Read parameter configure_endpoint response: [0, SimpleDescriptor(endpoint=1, profile=260, device_type=1024, device_version=0, input_clusters=[0, 6, 10, 25, 1281], output_clusters=[1, 32, 1280, 1282])]
2022-04-20 19:12:55,694 DEBUG   :Command Command.read_parameter (2, <NetworkParameter.configure_endpoint: 19>, b'\x01')
2022-04-20 19:12:55,694 DEBUG   :Send: 0x0a1200090002001301
2022-04-20 19:12:55,700 DEBUG   :Frame received: 0x0a120011000a0013015000de0100010000
2022-04-20 19:12:55,702 DEBUG   :Read parameter configure_endpoint response: [1, SimpleDescriptor(endpoint=80, profile=56832, device_type=1, device_version=1, input_clusters=[], output_clusters=[])]
2022-04-20 19:12:55,702 DEBUG   :Command Command.read_parameter (2, <NetworkParameter.configure_endpoint: 19>, b'\x02')
2022-04-20 19:12:55,703 DEBUG   :Send: 0x0a1300090002001302
2022-04-20 19:12:55,710 DEBUG   :Frame received: 0x0a1304090002001302
2022-04-20 19:12:55,711 DEBUG   :Got endpoint slots: {0: SimpleDescriptor(endpoint=1, profile=260, device_type=1024, device_version=0, input_clusters=[0, 6, 10, 25, 1281], output_clusters=[1, 32, 1280, 1282]), 1: SimpleDescriptor(endpoint=80, profile=56832, device_type=1, device_version=1, input_clusters=[], output_clusters=[]), 2: None}
2022-04-20 19:12:55,711 DEBUG   :Writing SimpleDescriptor(endpoint=1, profile=260, device_type=<DeviceType.IAS_CONTROL: 1024>, device_version=0, input_clusters=[0, 6, 10, 25, 1281], output_clusters=[1, 32, 1280, 1282]) to slot 0
2022-04-20 19:12:55,712 DEBUG   :Command Command.write_parameter (28, <NetworkParameter.configure_endpoint: 19>, b'\x00\x01\x04\x01\x00\x04\x00\x05\x00\x00\x06\x00\n\x00\x19\x00\x01\x05\x04\x01\x00 \x00\x00\x05\x02\x05')
2022-04-20 19:12:55,712 DEBUG   :Send: 0x0b140023001c00130001040100040005000006000a0019000105040100200000050205
2022-04-20 19:12:55,716 DEBUG   :Frame received: 0x0b14000800010013
2022-04-20 19:12:55,716 DEBUG   :Write parameter configure_endpoint: SUCCESS
2022-04-20 19:12:55,717 DEBUG   :Command Command.read_parameter (2, <NetworkParameter.configure_endpoint: 19>, b'\x00')
2022-04-20 19:12:55,717 DEBUG   :Send: 0x0a1500090002001300
2022-04-20 19:12:55,719 DEBUG   :Frame received: 0x0a150023001c00130001040100040005000006000a0019000105040100200000050205
2022-04-20 19:12:55,720 DEBUG   :Read parameter configure_endpoint response: [0, SimpleDescriptor(endpoint=1, profile=260, device_type=1024, device_version=0, input_clusters=[0, 6, 10, 25, 1281], output_clusters=[1, 32, 1280, 1282])]
2022-04-20 19:12:55,720 DEBUG   :Command Command.read_parameter (2, <NetworkParameter.configure_endpoint: 19>, b'\x01')
2022-04-20 19:12:55,721 DEBUG   :Send: 0x0a1600090002001301
2022-04-20 19:12:55,728 DEBUG   :Frame received: 0x0a160011000a0013015000de0100010000
2022-04-20 19:12:55,729 DEBUG   :Read parameter configure_endpoint response: [1, SimpleDescriptor(endpoint=80, profile=56832, device_type=1, device_version=1, input_clusters=[], output_clusters=[])]
2022-04-20 19:12:55,729 DEBUG   :Command Command.read_parameter (2, <NetworkParameter.configure_endpoint: 19>, b'\x02')
2022-04-20 19:12:55,730 DEBUG   :Send: 0x0a1700090002001302
2022-04-20 19:12:55,731 DEBUG   :Frame received: 0x0a1704090002001302
2022-04-20 19:12:55,732 DEBUG   :Got endpoint slots: {0: SimpleDescriptor(endpoint=1, profile=260, device_type=1024, device_version=0, input_clusters=[0, 6, 10, 25, 1281], output_clusters=[1, 32, 1280, 1282]), 1: SimpleDescriptor(endpoint=80, profile=56832, device_type=1, device_version=1, input_clusters=[], output_clusters=[]), 2: None}
2022-04-20 19:12:55,732 DEBUG   :Writing SimpleDescriptor(endpoint=2, profile=49246, device_type=<DeviceType.CONTROLLER: 2080>, device_version=0, input_clusters=[0], output_clusters=[]) to slot 2
2022-04-20 19:12:55,733 DEBUG   :Command Command.write_parameter (12, <NetworkParameter.configure_endpoint: 19>, b'\x02\x02^\xc0 \x08\x00\x01\x00\x00\x00')
2022-04-20 19:12:55,733 DEBUG   :Send: 0x0b180013000c001302025ec020080001000000
2022-04-20 19:12:55,740 DEBUG   :Frame received: 0x0b18040800010013
2022-04-20 19:12:55,741 ERROR   :Couldn't start application
2022-04-20 19:12:55,741 DEBUG   :Command Command.write_parameter (5, <NetworkParameter.watchdog_ttl: 38>, b'\x00\x00\x00\x00')
2022-04-20 19:12:55,741 DEBUG   :Send: 0x0b19000c0005002600000000
2022-04-20 19:12:55,743 DEBUG   :Frame received: 0x0b19000800010026
2022-04-20 19:12:55,743 DEBUG   :Write parameter watchdog_ttl: SUCCESS
2022-04-20 19:12:55,748 ERROR   :Error Traceback (most recent call last):
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/Classes/ZigpyTransport/AppDeconz.py", line 59, in startup
    await super().startup(auto_form=True)
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy/application.py", line 75, in startup
    await self.start_network()
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/zigbee/application.py", line 109, in start_network
    await self.register_endpoints()
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/Classes/ZigpyTransport/AppDeconz.py", line 94, in register_endpoints
    await super().register_endpoints()
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy/application.py", line 478, in register_endpoints
    await self.add_endpoint(
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/zigbee/application.py", line 375, in add_endpoint
    await self._api.write_parameter(
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/api.py", line 326, in _command
    return await asyncio.wait_for(fut, timeout=COMMAND_TIMEOUT)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 481, in wait_for
    return fut.result()
zigpy_deconz.exception.CommandError: Command.write_parameter, status: Status.UNSUPPORTED

@puddly
Copy link
Contributor Author

puddly commented Apr 20, 2022

Your 0x50 endpoint looks like this: SimpleDescriptor(endpoint=80, profile=56832, device_type=1, device_version=1, input_clusters=[], output_clusters=[])

Can you try deleting this line of code?

https://github.com/puddly/zigpy-deconz/blob/99df53f0f1a6dff93b1e419e0552f07b926f87ce/zigpy_deconz/zigbee/application.py#L364

@pipiche38
Copy link

This looks much better, and there is no more hang/crash .

Now what should I do if I want to add an extra EndPoint like 0x03 ?

I was thinking to do taht:


            await super().add_endpoint(
                zdo_types.SimpleDescriptor(
                    Endpoint=0x03,
                    profile=zigpy.profiles.zha.PROFILE_ID,
                    device_type=zigpy.profiles.zll.DeviceType.CONTROLLER,
                    device_version=0b0000,
                    input_clusters=[zigpy.zcl.clusters.general.Basic.cluster_id,],
                    output_clusters=[],
                )
            )

@puddly
Copy link
Contributor Author

puddly commented Apr 20, 2022

That should work, just make sure Endpoint is lowercase and use self.add_endpoint instead of super().add_endpoint (since your class doesn't likely override add_endpoint itself, only register_endpoints).

@pipiche38
Copy link

pipiche38 commented Apr 21, 2022

Looks like write of EndPoint 0x03 doesn't work. This is a deconz issue, as it works well with ZNP

2022-04-21 09:21:19,265 DEBUG   :Got endpoint slots: {0: SimpleDescriptor(endpoint=1, profile=260, device_type=1024, device_version=0, input_clusters=[0, 6, 10, 25, 1281], output_clusters=[1, 32, 1280, 1282]), 1: SimpleDescriptor(endpoint=2, profile=49246, device_type=2080, device_version=0, input_clusters=[0], output_clusters=[]), 2: None}
2022-04-21 09:21:19,266 DEBUG   :Writing SimpleDescriptor(endpoint=3, profile=260, device_type=<DeviceType.CONTROLLER: 2080>, device_version=0, input_clusters=[0], output_clusters=[]) to slot 2
2022-04-21 09:21:19,267 DEBUG   :Command Command.write_parameter (12, <NetworkParameter.configure_endpoint: 19>, b'\x02\x03\x04\x01 \x08\x00\x01\x00\x00\x00')
2022-04-21 09:21:19,267 DEBUG   :Send: 0x0b1c0013000c00130203040120080001000000
2022-04-21 09:21:19,269 DEBUG   :Frame received: 0x0b1c040800010013
2022-04-21 09:21:19,269 ERROR   :Couldn't start application
2022-04-21 09:21:19,270 DEBUG   :Command Command.write_parameter (5, <NetworkParameter.watchdog_ttl: 38>, b'\x00\x00\x00\x00')
2022-04-21 09:21:19,270 DEBUG   :Send: 0x0b1d000c0005002600000000
2022-04-21 09:21:19,279 DEBUG   :Frame received: 0x0b1d000800010026
2022-04-21 09:21:19,279 DEBUG   :Write parameter watchdog_ttl: SUCCESS
2022-04-21 09:21:19,284 ERROR   :Error Traceback (most recent call last):
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/Classes/ZigpyTransport/AppDeconz.py", line 59, in startup
    await super().startup(auto_form=True)
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy/application.py", line 75, in startup
    await self.start_network()
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/zigbee/application.py", line 109, in start_network
    await self.register_endpoints()
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/Classes/ZigpyTransport/AppDeconz.py", line 97, in register_endpoints
    await self.add_endpoint(
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/zigbee/application.py", line 374, in add_endpoint
    await self._api.write_parameter(
  File "/home/domoticz/domoticz/plugins/Domoticz-Zigbee/zigpy_deconz/api.py", line 326, in _command
    return await asyncio.wait_for(fut, timeout=COMMAND_TIMEOUT)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 481, in wait_for
    return fut.result()
zigpy_deconz.exception.CommandError: Command.write_parameter, status: Status.UNSUPPORTED

Copy link

@pipiche38 pipiche38 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can the limitation be to 2 EndPoints, while on a default ConBee we are able to see 3 EndPoints ?

@puddly puddly marked this pull request as ready for review June 16, 2022 18:53
@codecov-commenter
Copy link

codecov-commenter commented Jun 16, 2022

Codecov Report

Merging #172 (2945eac) into dev (9f21510) will increase coverage by 0.06%.
The diff coverage is 97.74%.

@@            Coverage Diff             @@
##              dev     #172      +/-   ##
==========================================
+ Coverage   96.93%   97.00%   +0.06%     
==========================================
  Files           7        7              
  Lines         980     1067      +87     
==========================================
+ Hits          950     1035      +85     
- Misses         30       32       +2     
Impacted Files Coverage Δ
zigpy_deconz/uart.py 95.14% <0.00%> (ø)
zigpy_deconz/zigbee/application.py 98.63% <98.08%> (-0.32%) ⬇️
zigpy_deconz/api.py 93.71% <100.00%> (+0.09%) ⬆️
zigpy_deconz/types.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9f21510...2945eac. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants