Skip to content

ZDOCmd.Unbind_req not implemented (needed to unbind device from coordinator) #54

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

Closed
TheJulianJES opened this issue Jan 6, 2021 · 5 comments

Comments

@TheJulianJES
Copy link
Contributor

After home-assistant/core#42854 was merged, Home Assistant can now unbind a device from the Zigbee coordinator. This is required for a Philips Hue Dimmer Switch (RWL021) as they can only be bound to one group/device because of the binding table size being 1.
When trying this using a ZZH with zigpy-znp, the following is displayed in the (debug) logs:

2021-01-06 19:51:31 DEBUG (MainThread) [zigpy_znp.zigbee.application] Intercepted a ZDO request: dst_addr=AddrModeAddress(mode=<AddrMode.NWK: 2>, address=0x577A), dst_ep=0, src_ep=0, cluster=ZDOCmd.Unbind_req, sequence=203, options=TransmitOptions.SUPPRESS_ROUTE_DISC_NETWORK|ACK_REQUEST, radius=30, data=b'\xcb\xb7\xd6t\x08\x01\x88\x17\x00\x01\x08\x00\x03\xf5\xf3\xa5\xfe\xff\xcc\xcc\xcc\x01'
2021-01-06 19:51:31 ERROR (MainThread) [zigpy_znp.zigbee.application] ZDO converter for cluster ZDOCmd.Unbind_req has not been implemented! Please open a GitHub issue and attach a debug log: https://github.com/zigpy/zigpy-znp/issues/new
2021-01-06 19:51:31 DEBUG (MainThread) [zigpy.zdo] [0x577a:zdo] cluster: 6 Unbind_req --> [cc:cc:cc:ff:fe:a5:f3:f5] failed: No ZDO converter
2021-01-06 19:51:31 DEBUG (MainThread) [zigpy.zdo] [0x577a:zdo] cluster: 8 Unbind_req --> [cc:cc:cc:ff:fe:a5:f3:f5] failed: No ZDO converter
2021-01-06 19:51:31 INFO (MainThread) [homeassistant.components.zha.api] Devices un-bound: source_ieee: [00:17:88:01:08:74:d6:b7] target_ieee: [cc:cc:cc:ff:fe:a5:f3:f5]

It looks like the ZDOCmd.Unbind_req "command" isn't implemented in https://github.com/zigpy/zigpy-znp/blob/dev/zigpy_znp/zigbee/zdo_converters.py.

@puddly
Copy link
Collaborator

puddly commented Jan 6, 2021

I'll add that to the next release. Thanks!

@MattWestb
Copy link

MattWestb commented Jan 6, 2021

@TheJulianJES If you is having one groupe 0x0000 (the default coordinator group if ZHA have making it) you can trying unbinding it from the dimmer switch and if its working you is losing the event reporting if not the new groupe is having the coordinator added.
It was working most of the time with EZSP before the fix was made.

Edit first binding and then unbinding the group 0x0000.

@TheJulianJES
Copy link
Contributor Author

Tried calling reset_all on the Groups cluster of the dimmer switch. It also didn't seem to work.

@MattWestb
Copy link

I think the coordinator is bonded with device NWK 0x0000 and not with group binding ala Philips HUE.
In tasmota it was possible binding group but was not working until sending unbind device 0x0000 then it was start working.

@TheJulianJES
Copy link
Contributor Author

TheJulianJES commented Jan 6, 2021

I tried simply adding adding this to zdo_converters:

    ZDOCmd.Unbind_req: (
        (
            lambda addr, SrcAddress, SrcEndpoint, ClusterID, DstAddress: (
                c.ZDO.UnBindReq.Req(
                    Dst=addr.address,
                    Src=SrcAddress,
                    SrcEndpoint=SrcEndpoint,
                    ClusterId=ClusterID,
                    Address=addr.mode,
                    DstEndpoint=SrcEndpoint, # What should be here?
                )
            )
        ),
        (lambda addr: c.ZDO.UnBindRsp.Callback(partial=True, Src=addr.address)),
        (lambda rsp: (ZDOCmd.Unbind_rsp, {"Status": rsp.Status})),
    ),

But zigpy calls this without "giving" the DstEndpoint. However, it seems to be required by zdo.py: UnBindReq.
Should DstEndpoint=SrcEndpoint?

There's also the difference between zigpy_znp.types.named.AddrModeAddress and AddrMode
I guess you got this, puddly

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

No branches or pull requests

3 participants