ZHA - binding to specific endpoints?

Hi all,

I spent a lot of time getting support for these devices in zigbee2mqtt, and just recently aquired a Nortek HUSBZB-1 to test ZHA out (should I say…natively?).

Actual switches are working great, but having issues determining how I can bind specific scene (virtual) buttons to specific switchpoints.

The switches with relays are made of up to 3 endpoints depending on model. I also have ‘scene’ switches that consist of 1 or 4 buttons which connect to the power supply but have no physical relays - these are designed to bind to the individual endpoints. The best I can manage to do is have a single scene switch bind to all the endpoints on say a 3 gang switch. There appears to be no ability to select the specific endpoint seemingly and in HA only the name and area appears to be configurable on the scene switch entity - no toggle etc.

Is this supported, and if so, what should I be looking to do?

If not supported, how can I help?

Below is the log of a single scene (virtual) switch.

[0x0000:zdo] ZDO request 0x0036: [60, <Bool.false: 0>]
[0x6c01:1:0x0001] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=1 command_id=Command.Report_Attributes>
[0x6c01:1:0x0001] ZCL request 0x000a: [[<Attribute attrid=53 value=<TypeValue type=uint8_t, value=0>>]]
[0x6c01:1:0x0001] Attribute report received: battery_alarm_mask=0
Device 0xa6ec (00:12:4b:00:1b:d3:bc:ce) joined the network
[0xa6ec] Requesting 'Node Descriptor'
[0xa6ec] Extending timeout for 0xa7 request
Device 0xa6ec (00:12:4b:00:1b:d3:bc:ce) joined the network
Skip initialization for existing device 00:12:4b:00:1b:d3:bc:ce
[0xa6ec] Node Descriptor: <Optional byte1=1 byte2=64 mac_capability_flags=142 manufacturer_code=4478 maximum_buffer_size=80 maximum_incoming_transfer_size=160 server_mask=0 maximum_outgoing_transfer_size=160 descriptor_capability_field=0>
[0xa6ec] Discovering endpoints
[0xa6ec] Discovered endpoints: [1]
[0xa6ec:1] Discovering endpoint information
[0xa6ec:1] Discovered endpoint information: <SimpleDescriptor endpoint=1 profile=260 device_type=4 device_version=0 input_clusters=[0, 3] output_clusters=[3, 4, 5, 6, 1]>
[0xa6ec:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=173 command_id=Command.Read_Attributes_rsp>
[0xa6ec:1] Manufacturer: Feibit CO.,LTD  
[0xa6ec:1] Model: FTB56+ZSN15HG1.0
Checking quirks for Feibit CO.,LTD   FTB56+ZSN15HG1.0 (00:12:4b:00:1b:d3:bc:ce)
Considering <class 'zigpy.quirks.smartthings.SmartthingsMultiPurposeSensor'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.gledopto.soposhgu10.SoposhGU10'>
Fail because endpoint list mismatch: {11, 13} {1}
Considering <class 'zhaquirks.lutron.lzl4bwhl01remote.LutronLZL4BWHL01Remote2'>
Fail because profile_id mismatch on at least one endpoint
Considering <class 'zhaquirks.netvox.z308e3ed.Z308E3ED'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.osram.a19twhite.A19TunableWhite'>
Fail because endpoint list mismatch: {3} {1}
Considering <class 'zhaquirks.philips.rwl021.PhilipsRWL021'>
Fail because endpoint list mismatch: {1, 2} {1}
Considering <class 'zhaquirks.smartthings.tag_v4.SmartThingsTagV4'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.xbee.xbee3_io.XBee3Sensor'>
Fail because endpoint list mismatch: {232, 230} {1}
Considering <class 'zhaquirks.xbee.xbee_io.XbeeSensor'>
Fail because endpoint list mismatch: {232, 230} {1}
Considering <class 'zhaquirks.xiaomi.mija.smoke.MijiaHoneywellSmokeDetectorSensor'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'bellows.zigbee.application.EZSPCoordinator'>
Fail because device_type mismatch on at least one endpoint
device - 0xa6ec:00:12:4b:00:1b:d3:bc:ce entering async_device_initialized - is_new_join: True
device - 0xa6ec:00:12:4b:00:1b:d3:bc:ce has joined the ZHA zigbee network
[0xa6ec](FTB56+ZSN15HG1.0): started configuration
[0xa6ec:ZDO](FTB56+ZSN15HG1.0): channel: 'async_configure' stage succeeded
[0xa6ec:1:0x0000]: bound 'basic' cluster: Status.SUCCESS
[0xa6ec:1:0x0000]: finished channel configuration
[0xa6ec:1:0x0005]: bound 'scenes' cluster: Status.SUCCESS
[0xa6ec:1:0x0005]: finished channel configuration
[0xa6ec:1:0x0005]: channel: 'async_configure' stage succeeded
[0xa6ec:1:0x0006]: bound 'on_off' cluster: Status.SUCCESS
[0xa6ec:1:0x0006]: finished channel configuration
[0xa6ec:1:0x0006]: channel: 'async_configure' stage succeeded
Device 0xa6ec (00:12:4b:00:1b:d3:bc:ce) joined the network
Skip initialization for existing device 00:12:4b:00:1b:d3:bc:ce
[0xa6ec:zdo] ZDO request 0x0013: [0xa6ec, 00:12:4b:00:1b:d3:bc:ce, 142]
[0xa6ec:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=181 command_id=Command.Read_Attributes_rsp>
[0xa6ec:1:0x0000]: initializing channel: from_cache: False
[0xa6ec:1:0x0000]: channel: 'async_configure' stage succeeded
[0xa6ec](FTB56+ZSN15HG1.0): completed configuration
[0xa6ec](FTB56+ZSN15HG1.0): stored in registry: ZhaDeviceEntry(name='Feibit CO.,LTD   FTB56+ZSN15HG1.0', ieee='00:12:4b:00:1b:d3:bc:ce', last_seen=1571556565.95105)
[0xa6ec](FTB56+ZSN15HG1.0): started initialization
[0xa6ec:ZDO](FTB56+ZSN15HG1.0): entry loaded from storage: ZhaDeviceEntry(name='Feibit CO.,LTD   FTB56+ZSN15HG1.0', ieee='00:12:4b:00:1b:d3:bc:ce', last_seen=1571556565.95105)
[0xa6ec:ZDO](FTB56+ZSN15HG1.0): channel: 'async_initialize' stage succeeded
[0xa6ec:1:0x0005]: initializing channel: from_cache: False
[0xa6ec:1:0x0005]: channel: 'async_initialize' stage succeeded
[0xa6ec:1:0x0006]: initializing channel: from_cache: False
[0xa6ec:1:0x0006]: channel: 'async_initialize' stage succeeded
[0xa6ec:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=183 command_id=Command.Read_Attributes_rsp>
[0xa6ec:1:0x0000]: initializing channel: from_cache: False
[0xa6ec:1:0x0000]: channel: 'async_initialize' stage succeeded
[0xa6ec](FTB56+ZSN15HG1.0): power source: Mains
[0xa6ec](FTB56+ZSN15HG1.0): completed initialization
[0x1c16:zdo] ZDO request 0x0006: [0xfffd, 260, [25], []]
[0x8c08:zdo] ZDO request 0x0006: [0xfffd, 260, [25], []]
[0x1c16:zdo] ZDO request 0x0001: [0x0000, 0, 0]
[0xa6ec:1:0x0001] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=1 command_id=Command.Report_Attributes>
[0xa6ec:1:0x0001] ZCL request 0x000a: [[<Attribute attrid=53 value=<TypeValue type=uint8_t, value=0>>]]
[0xa6ec:1:0x0001] Attribute report received: battery_alarm_mask=0
[0x8c08:zdo] ZDO request 0x0001: [0x0000, 0, 0]
[0x1c16:1:0x0019] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=55 command_id=Command.Read_Attributes_rsp>
[0x1c16:1:0x0019] ZCL request 0x0101: [0, 4478, 0, 1, None]
[0x1c16:1:0x0019] OTA query_next_image handler for 'FeiBit FNB56-ZSW03LX2.0': field_control=0, manufacture_id=4478, image_type=0, current_file_version=1, hardware_version=None
[0x1c16:1:0x0019] No OTA image is available
[0x8c08:11:0x0019] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=148 command_id=Command.Read_Attributes_rsp>
[0x8c08:11:0x0019] ZCL request 0x0101: [0, 4478, 0, 1, None]
[0x8c08:11:0x0019] OTA query_next_image handler for 'FeiBit FNB56-ZSW01LX2.0': field_control=0, manufacture_id=4478, image_type=0, current_file_version=1, hardware_version=None
[0x8c08:11:0x0019] No OTA image is available

If I bind the above device to a 3-way switch, this is what I get in the event viewer when pressing the scene switch (and all 3 switches activate at once):

{
    "event_type": "zha_event",
    "data": {
        "unique_id": "00:12:4b:00:1b:d3:bc:ce:1:0x0006",
        "device_ieee": "00:12:4b:00:1b:d3:bc:ce",
        "endpoint_id": 1,
        "cluster_id": 6,
        "command": "on",
        "args": []
    },
    "origin": "LOCAL",
    "time_fired": "2019-10-20T08:16:33.152879+00:00",
    "context": {
        "id": "8cb6c64560c0494284bfb90b09813ff5",
        "parent_id": null,
        "user_id": null
    }
}

I looked a while ago and the ZHA Configuration page doesn’t currently allow endpoint selection when binding with another device.

However, in the zha_event you should be able to see what endpoint the command is coming from. Binding with the coordinator (Home Assistant) is done automatically.

Thanks @rpress. I’ve managed to get a automation sort of working that might allow me to at least pick an endpoint, but it doesn’t give correct feedback (e.g. scene button light can be incorrect). But it would also be far easier if I could just get each scene switch button to be an entity, which would give more flexibility.

A while back certain out clusters used to create individual entities. There were some cases where that functionality wasn’t appropriate, so it seems most clusters are now events. I’m not sure if scenes ever had an individual entity.

Unfortunately the automation engine doesn’t have the same support for events as entities, like wait_template. I’m sure there are more examples of event limitations.