zigpy / zha-device-handlers

ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
Apache License 2.0
759 stars 697 forks source link

Add support for Legrand Dimmer switch w/o neutral #299

Closed pdecat closed 4 years ago

pdecat commented 4 years ago

Hi, I'm looking into getting support for the Legrand Dimmer switch w/o neutral (ref 067771, same as ref 067721 and ref 064891)

I've managed to pair it, here's its SimpleDescriptor:

2020-03-11 08:10:04 DEBUG (MainThread) [zigpy_zigate.zigbee.application] zigate_callback_handler [0, 0, 32772, 0, 0, <Address address_mode=ADDRESS_MODE.NWK address=0x5bd8>, <Address add
ress_mode=ADDRESS_MODE.NWK address=0x0000>, b'\xe2\x00\xd8[\x1e\x01\x04\x01\x00\x01\x01\x08\x00\x00\x03\x00\x04\x00\x08\x00\x06\x00\x05\x00\x0f\x00\x01\xfc\x03\x00\x00\x01\xfc\x19\x00']
2020-03-11 08:10:04 INFO (MainThread) [zigpy.endpoint] [0x5bd8:1] Discovered endpoint information: <SimpleDescriptor endpoint=1 profile=260 device_type=256 device_version=1 input_clusters=[0, 3, 4, 8, 6, 5, 15, 64513] output_clusters=[0, 64513, 25]>

Controlling its on/off state with ZHA is ok and adding it to a group to control it with a Legrand Remote switch (ref 067773, same as ref 067723 and ref 064893) works fine too.

This switch has a manufacturer specific cluster 0xfc01 (64513 decimal) that is used to enable/disable features:

Would it be possible to add support for this?

Related:

dmulcahey commented 4 years ago

Absolutely. Remove the device from ZHA wait a minute or so and then add it again through the add devices screen. Take the content of the log panel after on the screen after it joins and add it to a code block in the issue please. I'll try to get to it this weekend if you provide the info.

pdecat commented 4 years ago

Awesome!

Here you go:

Device 0x409e (00:04:74:00:00:8b:0e:a2) joined the network
[0x409e] Requesting 'Node Descriptor'
[0x409e] Extending timeout for 0x4a request
[0x409e:zdo] ZDO request 0x0013: [0x409e, 00:04:74:00:00:8b:0e:a2, 142]
[0x409e] Node Descriptor: <Optional byte1=17 byte2=64 mac_capability_flags=142 manufacturer_code=4129 maximum_buffer_size=89 maximum_incoming_transfer_size=63 server_mask=10752 maximum_outgoing_transfer_size=63 descriptor_capability_field=0>
[0x409e] Discovering endpoints
[0x409e] Discovered endpoints: [1]
[0x409e:1] Discovering endpoint information
[0x409e:1] Discovered endpoint information: <SimpleDescriptor endpoint=1 profile=260 device_type=256 device_version=1 input_clusters=[0, 3, 4, 8, 6, 5, 15, 64513] output_clusters=[0, 64513, 25]>
[0x409e: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=80 command_id=Command.Read_Attributes_rsp>
[0x409e:1] Manufacturer:  Legrand
[0x409e:1] Model:  Dimmer switch w/o neutral
Checking quirks for  Legrand  Dimmer switch w/o neutral (00:04:74:00:00:8b:0e:a2)
Considering <class 'bellows.zigbee.application.EZSPCoordinator'>
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.rom001.PhilipsROM001'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.philips.rwl021.PhilipsRWL021'>
Fail because endpoint list mismatch: {1, 2} {1}
Considering <class 'zhaquirks.smartthings.multi.SmartthingsMultiPurposeSensor'>
Fail because device_type mismatch on at least one endpoint
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
device - 0x409e:00:04:74:00:00:8b:0e:a2 entering async_device_initialized - is_new_join: True
device - 0x409e:00:04:74:00:00:8b:0e:a2 has joined the ZHA zigbee network
[0x409e]( Dimmer switch w/o neutral): started configuration
[0x409e:ZDO]( Dimmer switch w/o neutral): channel: 'async_configure' stage succeeded
[0x409e: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=80 command_id=Command.Read_Attributes_rsp>
[0x409e:1:0x0000] ZCL request 0x0001: [[<ReadAttributeRecord attrid=4 status=Status.SUCCESS value= Legrand>, <ReadAttributeRecord attrid=5 status=Status.SUCCESS value= Dimmer switch w/o neutral>]]
[0x409e: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=80 command_id=Command.Read_Attributes_rsp>
[0x409e:1:0x0000] ZCL request 0x0001: [[<ReadAttributeRecord attrid=4 status=Status.SUCCESS value= Legrand>, <ReadAttributeRecord attrid=5 status=Status.SUCCESS value= Dimmer switch w/o neutral>]]
[0x409e] Delivery error for seq # 0x52, on endpoint id 0 cluster 0x0021: ZiGate doesn't answer to command
[0x409e:1:0x0008]: Failed to bind 'level' cluster: [0x409e:0:0x0021]: Message send failure
[0x409e] Delivery error for seq # 0x54, on endpoint id 0 cluster 0x0021: ZiGate doesn't answer to command
[0x409e:1:0x0006]: Failed to bind 'on_off' cluster: [0x409e:0:0x0021]: Message send failure
[0x409e:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=88 command_id=Command.Configure_Reporting_rsp>
[0x409e:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=90 command_id=Command.Configure_Reporting_rsp>
[0x409e:1:0x0006]: reporting 'on_off' attr on 'on_off' cluster: 0/900/1: Result: '[[<ConfigureReportingResponseRecord status=Status.SUCCESS>, <ConfigureReportingResponseRecord status=Status.SUCCESS>, <ConfigureReportingResponseRecord status=Status.SUCCESS>, <ConfigureReportingResponseRecord status=Status.SUCCESS>]]'
[0x409e:1:0x0006]: finished channel configuration
[0x409e:1:0x0006]: channel: 'async_configure' stage succeeded
[0x409e:1:0x0000]: Failed to bind 'basic' cluster: 
[0x409e:1:0x0000]: finished channel configuration
[0x409e: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=92 command_id=Command.Read_Attributes_rsp>
[0x409e:1:0x0000]: initializing channel: from_cache: False
[0x409e:1:0x0000]: channel: 'async_configure' stage succeeded
[0x409e: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=92 command_id=Command.Read_Attributes_rsp>
[0x409e:1:0x0000] ZCL request 0x0001: [[<ReadAttributeRecord attrid=7 status=Status.SUCCESS value=1>]]
[0x409e] Delivery error for seq # 0x58, on endpoint id 1 cluster 0x0008: ZiGate doesn't answer to command
[0x409e:1:0x0008]: failed to set reporting for 'current_level' attr on 'level' cluster: [0x409e:1:0x0008]: Message send failure
[0x409e:1:0x0008]: finished channel configuration
[0x409e:1:0x0008]: channel: 'async_configure' stage succeeded
[0x409e]( Dimmer switch w/o neutral): completed configuration
[0x409e]( Dimmer switch w/o neutral): stored in registry: ZhaDeviceEntry(name='unk_manufacturer unk_model', ieee='00:04:74:00:00:8b:0e:a2', last_seen=1584120110.616019)
[0x409e]( Dimmer switch w/o neutral): started initialization
[0x409e:ZDO]( Dimmer switch w/o neutral): entry loaded from storage: ZhaDeviceEntry(name='unk_manufacturer unk_model', ieee='00:04:74:00:00:8b:0e:a2', last_seen=1584120110.616019)
[0x409e:ZDO]( Dimmer switch w/o neutral): channel: 'async_initialize' stage succeeded
[0x409e:1:0x0006]: attempting to update onoff state - from cache: False
[0x409e:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=94 command_id=Command.Read_Attributes_rsp>
[0x409e:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=94 command_id=Command.Read_Attributes_rsp>
[0x409e] Invalid state on future for 0x5e seq -- probably duplicate response
[0x409e:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=96 command_id=Command.Read_Attributes_rsp>
[0x409e:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=96 command_id=Command.Read_Attributes_rsp>
[0x409e] Invalid state on future for 0x60 seq -- probably duplicate response
[0x409e: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=98 command_id=Command.Read_Attributes_rsp>
[0x409e: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=98 command_id=Command.Read_Attributes_rsp>
[0x409e] Invalid state on future for 0x62 seq -- probably duplicate response
[0x409e:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=100 command_id=Command.Read_Attributes_rsp>
None: polling current state
[0x409e:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=100 command_id=Command.Read_Attributes_rsp>
[0x409e:1:0x0006] ZCL request 0x0001: [[<ReadAttributeRecord attrid=0 status=Status.SUCCESS value=Bool.false>]]
[0x409e:1:0x0000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=True is_reply=False disable_default_response=True> manufacturer=4129 tsn=5 command_id=Command.Read_Attributes>
[0x409e:1:0x0000] ZCL request 0x0000: [[61440]]
Device 0x0000 (00:04:74:00:00:8b:0e:a2) left the network
[0x409e] Delivery error for seq # 0x5e, on endpoint id 1 cluster 0x0008: ZiGate doesn't answer to command
[0x409e:1:0x0008]: initializing channel: from_cache: False
[0x409e:1:0x0008]: channel: 'async_initialize' stage succeeded
[0x409e] Delivery error for seq # 0x60, on endpoint id 1 cluster 0x0006: ZiGate doesn't answer to command
[0x409e:1:0x0006]: initializing channel: from_cache: False
[0x409e:1:0x0006]: channel: 'async_initialize' stage succeeded
[0x409e] Delivery error for seq # 0x62, on endpoint id 1 cluster 0x0000: ZiGate doesn't answer to command
[0x409e:1:0x0000]: initializing channel: from_cache: False
[0x409e:1:0x0000]: channel: 'async_initialize' stage succeeded
[0x409e]( Dimmer switch w/o neutral): power source: Mains
[0x409e]( Dimmer switch w/o neutral): completed initialization

Thanks!

pdecat commented 4 years ago

As I also have a Legrand Micromodule wired switch (ref 064888) device currently in test, I figured I'll post the same information for it too here:

Device 0xfb49 (00:04:74:00:00:0c:2b:bf) joined the network
[0xfb49] Requesting 'Node Descriptor'
[0xfb49] Extending timeout for 0x42 request
[0xfb49:zdo] ZDO request 0x0013: [0xfb49, 00:04:74:00:00:0c:2b:bf, 142]
[0xfb49] Node Descriptor: <Optional byte1=17 byte2=64 mac_capability_flags=142 manufacturer_code=4129 maximum_buffer_size=89 maximum_incoming_transfer_size=63 server_mask=10752 maximum_outgoing_transfer_size=63 descriptor_capability_field=0>
[0xfb49] Discovering endpoints
[0xfb49] Discovered endpoints: [1, 242]
[0xfb49:1] Discovering endpoint information
[0xfb49:1] Discovered endpoint information: <SimpleDescriptor endpoint=1 profile=260 device_type=256 device_version=1 input_clusters=[0, 3, 4, 6, 5, 15, 64513] output_clusters=[0, 64513, 25]>
[0xfb49: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=72 command_id=Command.Read_Attributes_rsp>
[0xfb49:1] Manufacturer:  Legrand
[0xfb49:1] Model:  Micromodule switch
[0xfb49:242] Discovering endpoint information
[0xfb49: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=72 command_id=Command.Read_Attributes_rsp>
[0xfb49:1:0x0000] ZCL request 0x0001: [[<ReadAttributeRecord attrid=4 status=Status.SUCCESS value= Legrand>, <ReadAttributeRecord attrid=5 status=Status.SUCCESS value= Micromodule switch>]]
[0xfb49: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=72 command_id=Command.Read_Attributes_rsp>
[0xfb49:1:0x0000] ZCL request 0x0001: [[<ReadAttributeRecord attrid=4 status=Status.SUCCESS value= Legrand>, <ReadAttributeRecord attrid=5 status=Status.SUCCESS value= Micromodule switch>]]
[0xfb49:242] Discovered endpoint information: <SimpleDescriptor endpoint=242 profile=41440 device_type=97 device_version=0 input_clusters=[] output_clusters=[33]>
Checking quirks for  Legrand  Micromodule switch (00:04:74:00:00:0c:2b:bf)
Considering <class 'bellows.zigbee.application.EZSPCoordinator'>
Fail because endpoint list mismatch: {1} {1, 242}
Considering <class 'zhaquirks.gledopto.soposhgu10.SoposhGU10'>
Fail because endpoint list mismatch: {11, 13} {1, 242}
Considering <class 'zhaquirks.lutron.lzl4bwhl01remote.LutronLZL4BWHL01Remote2'>
Fail because endpoint list mismatch: {1} {1, 242}
Considering <class 'zhaquirks.netvox.z308e3ed.Z308E3ED'>
Fail because endpoint list mismatch: {1} {1, 242}
Considering <class 'zhaquirks.osram.a19twhite.A19TunableWhite'>
Fail because endpoint list mismatch: {3} {1, 242}
Considering <class 'zhaquirks.philips.rom001.PhilipsROM001'>
Fail because endpoint list mismatch: {1} {1, 242}
Considering <class 'zhaquirks.philips.rwl021.PhilipsRWL021'>
Fail because endpoint list mismatch: {1, 2} {1, 242}
Considering <class 'zhaquirks.smartthings.multi.SmartthingsMultiPurposeSensor'>
Fail because endpoint list mismatch: {1} {1, 242}
Considering <class 'zhaquirks.smartthings.tag_v4.SmartThingsTagV4'>
Fail because endpoint list mismatch: {1} {1, 242}
Considering <class 'zhaquirks.xbee.xbee3_io.XBee3Sensor'>
Fail because endpoint list mismatch: {232, 230} {1, 242}
Considering <class 'zhaquirks.xbee.xbee_io.XBeeSensor'>
Fail because endpoint list mismatch: {232, 230} {1, 242}
Considering <class 'zhaquirks.xiaomi.mija.smoke.MijiaHoneywellSmokeDetectorSensor'>
Fail because endpoint list mismatch: {1} {1, 242}
device - 0xfb49:00:04:74:00:00:0c:2b:bf entering async_device_initialized - is_new_join: True
device - 0xfb49:00:04:74:00:00:0c:2b:bf has joined the ZHA zigbee network
[0xfb49]( Micromodule switch): started configuration
[0xfb49:ZDO]( Micromodule switch): channel: 'async_configure' stage succeeded
[0xfb49] Delivery error for seq # 0x4e, on endpoint id 0 cluster 0x0021: Message send failure 166
[0xfb49:1:0x0000]: Failed to bind 'basic' cluster: [0xfb49:0:0x0021]: Message send failure
[0xfb49:1:0x0000]: finished channel configuration
[0xfb49] Delivery error for seq # 0x50, on endpoint id 1 cluster 0x0000: Message send failure 166
[0xfb49:1:0x0000]: initializing channel: from_cache: False
[0xfb49:1:0x0000]: channel: 'async_configure' stage succeeded
[0xfb49] Delivery error for seq # 0x4c, on endpoint id 0 cluster 0x0021: ZiGate doesn't answer to command
[0xfb49:1:0x0006]: Failed to bind 'on_off' cluster: [0xfb49:0:0x0021]: Message send failure
[0xfb49] Delivery error for seq # 0x5e, on endpoint id 1 cluster 0x0006: Message send failure 166
[0xfb49:1:0x0006]: failed to set reporting for 'on_off' attr on 'on_off' cluster: [0xfb49:1:0x0006]: Message send failure
[0xfb49:1:0x0006]: finished channel configuration
[0xfb49:1:0x0006]: channel: 'async_configure' stage succeeded
[0xfb49]( Micromodule switch): completed configuration
[0xfb49]( Micromodule switch): stored in registry: ZhaDeviceEntry(name=' Legrand  Micromodule switch', ieee='00:04:74:00:00:0c:2b:bf', last_seen=1584034541.6285045)
[0xfb49]( Micromodule switch): started initialization
[0xfb49:ZDO]( Micromodule switch): entry loaded from storage: ZhaDeviceEntry(name=' Legrand  Micromodule switch', ieee='00:04:74:00:00:0c:2b:bf', last_seen=1584034541.6285045)
[0xfb49:ZDO]( Micromodule switch): channel: 'async_initialize' stage succeeded
[0xfb49:1:0x0006]: attempting to update onoff state - from cache: False
[0xfb49] Delivery error for seq # 0x64, on endpoint id 1 cluster 0x0006: Message send failure 166
None: polling current state
[0xfb49] Delivery error for seq # 0x60, on endpoint id 1 cluster 0x0006: ZiGate doesn't answer to command
[0xfb49:1:0x0006]: initializing channel: from_cache: False
[0xfb49:1:0x0006]: channel: 'async_initialize' stage succeeded
[0xfb49] Delivery error for seq # 0x62, on endpoint id 1 cluster 0x0000: ZiGate doesn't answer to command
[0xfb49:1:0x0000]: initializing channel: from_cache: False
[0xfb49:1:0x0000]: channel: 'async_initialize' stage succeeded
[0xfb49]( Micromodule switch): power source: Mains
[0xfb49]( Micromodule switch): completed initialization
pdecat commented 4 years ago

And here's the information for the Legrand Remote switch (ref 067773, same as ref 067723 and ref 064893):

Device 0x2f9d (00:04:74:00:00:a9:0c:75) joined the network
[0x2f9d] Requesting 'Node Descriptor'
[0x2f9d] Extending timeout for 0xde request
[0x2f9d:zdo] ZDO request 0x0013: [0x2f9d, 00:04:74:00:00:a9:0c:75, 128]
Ignoring message (b'142110010000f0') on cluster 0: unknown endpoint or cluster id: 1
Get bindable devices: source_ieee: [00:04:74:00:00:0c:2b:bf], bindable devices: [[]]
[0x2f9d] Extending timeout for 0xec request
[0x2f9d] Node Descriptor: <Optional byte1=18 byte2=64 mac_capability_flags=128 manufacturer_code=4129 maximum_buffer_size=89 maximum_incoming_transfer_size=63 server_mask=10752 maximum_outgoing_transfer_size=63 descriptor_capability_field=0>
[0x2f9d] Discovering endpoints
[0x2f9d] Extending timeout for 0xee request
[0x2f9d] Discovered endpoints: [1]
[0x2f9d:1] Discovering endpoint information
[0x2f9d] Extending timeout for 0xf0 request
[0x2f9d:1] Discovered endpoint information: <SimpleDescriptor endpoint=1 profile=260 device_type=260 device_version=1 input_clusters=[0, 3, 15, 32, 1, 64513] output_clusters=[3, 6, 8, 0, 64513, 25]>
[0x2f9d] Extending timeout for 0xf2 request
[0x2f9d: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=242 command_id=Command.Read_Attributes_rsp>
[0x2f9d:1] Manufacturer:  Legrand
[0x2f9d:1] Model:  Remote switch
Checking quirks for  Legrand  Remote switch (00:04:74:00:00:a9:0c:75)
Considering <class 'bellows.zigbee.application.EZSPCoordinator'>
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.rom001.PhilipsROM001'>
Fail because device_type mismatch on at least one endpoint
Considering <class 'zhaquirks.philips.rwl021.PhilipsRWL021'>
Fail because endpoint list mismatch: {1, 2} {1}
Considering <class 'zhaquirks.smartthings.multi.SmartthingsMultiPurposeSensor'>
Fail because device_type mismatch on at least one endpoint
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
device - 0x2f9d:00:04:74:00:00:a9:0c:75 entering async_device_initialized - is_new_join: True
device - 0x2f9d:00:04:74:00:00:a9:0c:75 has joined the ZHA zigbee network
[0x2f9d]( Remote switch): started configuration
[0x2f9d:ZDO]( Remote switch): channel: 'async_configure' stage succeeded
[0x2f9d: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=242 command_id=Command.Read_Attributes_rsp>
[0x2f9d:1:0x0000] ZCL request 0x0001: [[<ReadAttributeRecord attrid=4 status=Status.SUCCESS value= Legrand>, <ReadAttributeRecord attrid=5 status=Status.SUCCESS value= Remote switch>]]
[0x2f9d: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=242 command_id=Command.Read_Attributes_rsp>
[0x2f9d:1:0x0000] ZCL request 0x0001: [[<ReadAttributeRecord attrid=4 status=Status.SUCCESS value= Legrand>, <ReadAttributeRecord attrid=5 status=Status.SUCCESS value= Remote switch>]]
[0x2f9d] Extending timeout for 0xf4 request
[0x2f9d] Extending timeout for 0xf6 request
[0x2f9d] Extending timeout for 0xf8 request
[0x2f9d] Delivery error for seq # 0xf4, on endpoint id 0 cluster 0x0021: ZiGate doesn't answer to command
[0x2f9d:1:0x0000]: Failed to bind 'basic' cluster: [0x2f9d:0:0x0021]: Message send failure
[0x2f9d:1:0x0000]: finished channel configuration
[0x2f9d] Extending timeout for 0xfa request
[0x2f9d] Delivery error for seq # 0xf6, on endpoint id 0 cluster 0x0021: ZiGate doesn't answer to command
[0x2f9d:1:0x0001]: Failed to bind 'power' cluster: [0x2f9d:0:0x0021]: Message send failure
[0x2f9d] Extending timeout for 0xfc request
[0x2f9d] Delivery error for seq # 0xfa, on endpoint id 1 cluster 0x0000: ZiGate doesn't answer to command
[0x2f9d:1:0x0000]: initializing channel: from_cache: False
[0x2f9d:1:0x0000]: channel: 'async_configure' stage succeeded
[0x2f9d] Extending timeout for 0xfe request
pdecat commented 4 years ago

Hi @dmulcahey, did I miss something in the provided information?

dmulcahey commented 4 years ago

No, just time on my end

dmulcahey commented 4 years ago

@pdecat what are you expecting for the other 2 devices?

pdecat commented 4 years ago

Well, not much actually, I thought maybe it would help knowing those devices features.

Thanks for the PR, I'll give an eye to learn how to implement such changes in the future and help contribute.

t0mg commented 4 years ago

Hi @pdecat apologies for bothering you here, but I'm super new to zigbee and am having a hard time getting the dimmer to work. I just got my host zigate today and tried pairing it with a brand new Legrand dimmer switch (that hasn't been paired with the Legrand base). It does pair, and the quirk does get picked up correctly. I can also turn the switch on and off. However in ZHA interface for the entity, when I select LegrandCluster, I can't seem to get or set the attribute for dimmer mode (or led level). set_zigbee_cluster_attribute service call fails. Is there anything obvious I may be missing? How am I supposed to set the value from the UI? Thanks!

pdecat commented 4 years ago

Hi @t0mg, apparently some Legrand dimmer switches need their firmware to be updated to stack version >= 66 and/or software build >= 020 with the Legrand Hub to have all features available, see:

That may be your issue.

You can query these attributes on the Basic cluster (endpoint id: 1, id: 0x0000, type: in):

t0mg commented 4 years ago

Thanks for the detailed help @pdecat !

Ok so I have stack version 66 and sw version 26. I was hoping that I could avoid purchasing the Legrand hub which I don't intend to use, but was also starting to think the ota would be the problem. However according to your reply it seems the switch should already support the dimmer feature 🤔

Edit: uh oh, from one of your links: "In order to enable the Dimmer feature on the Switch w/o neutral, you must have Zigate firmware 3.1b". I think I have v3.1a... that must be it. I will try to upgrade, I think I'll need to switch from homeassistant to a raspbian to to that. Thanks again for your help!

pdecat commented 4 years ago

What logs do you get when set_zigbee_cluster_attribute fails?

t0mg commented 4 years ago

Hello @pdecat - I've updated the zigate to 3.1c but then I found another problem. My zigate is a PiZiGate (connects directly to the GPIO) and it seems that ZHA doesn't fully support that hardware: the PiZiGate needs to be set to production mode. When done manually it looks like this:

$ gpio mode 0 out
$ gpio mode 2 out
$ gpio write 2 1 
$ gpio write 0 0
$ gpio write 0 1

If not done, the ZiGate doesn't operate properly. I never noticed because I initially tried the homeassistant-zigate custom integration before switching to ZHA, and I didn't power down the raspberry when I switched (only a couple of reboots) so the PiZigate remained in production mode after it was set by the homeassistant-zigate plugin. But when I returned after flashing the ZiGate from a different raspberry pi with a full raspbian, HassOS booted up with ZHA directly, and the ZiGate was no longer recognized. I had to switch back to the custom integration for the GPIO to be properly set.

From ZHA I was still not able to use the LegrandCluster. However going back to the custom integration again I was able to send a raw command, and successfully enable the dimmer mode. I was also able to set the brightness through that custom integration's entity. Alas, back again in ZHA I couldn't set the brightness of the dimmer that well. It behaved as if I was sending +1/-1 increments instead of setting a value out of 255.

Debug logs

First off, I noticed these "Received unhandled response 0x8035" occuring constantly:

2020-06-02 17:55:15 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 80350006b1030000000100
2020-06-02 17:55:15 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8035 b'0300000001' LQI:0
2020-06-02 17:55:15 ERROR (MainThread) [zigpy_zigate.api] Received unhandled response 0x8035
2020-06-02 17:55:15 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 80000005870000000200
2020-06-02 17:55:15 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8000 b'00000002' LQI:0
2020-06-02 17:55:15 DEBUG (MainThread) [zigpy_zigate.zigbee.application] zigate_callback_handler [0, 0, 2, b'']

Now here's a debug when I try to set the dimmer mode from ZHA/LegrandCluster with value 0101

2020-06-02 18:02:52 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=zha, service=set_zigbee_cluster_attribute, service_data=ieee=00:04:74:00:00:8b:5a:50, endpoint_id=1, cluster_id=64513, cluster_type=in, attribute=0, value=0101>
2020-06-02 18:02:52 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1719997328] 
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service
    connection.context(msg),
  File "/usr/src/homeassistant/homeassistant/core.py", line 1253, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1288, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 518, in admin_handler
    await result
  File "/usr/src/homeassistant/homeassistant/components/zha/api.py", line 876, in set_zigbee_cluster_attributes
    manufacturer=manufacturer,
  File "/usr/src/homeassistant/homeassistant/components/zha/core/device.py", line 508, in write_zigbee_attribute
    {attribute: value}, manufacturer=manufacturer
  File "/usr/local/lib/python3.7/site-packages/zigpy/zcl/__init__.py", line 346, in write_attributes
    result = await self._write_attributes(args, manufacturer=manufacturer)
  File "/usr/local/lib/python3.7/site-packages/zigpy/zcl/__init__.py", line 536, in general_command
    tsn=tsn,
  File "/usr/local/lib/python3.7/site-packages/zigpy/util.py", line 131, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/zigpy/zcl/__init__.py", line 143, in request
    data = hdr.serialize() + t.serialize(args, schema)
  File "/usr/local/lib/python3.7/site-packages/zigpy/types/__init__.py", line 15, in serialize
    return b"".join(t(v).serialize() for t, v in zip(schema, data))
  File "/usr/local/lib/python3.7/site-packages/zigpy/types/__init__.py", line 15, in <genexpr>
    return b"".join(t(v).serialize() for t, v in zip(schema, data))
  File "/usr/local/lib/python3.7/site-packages/zigpy/types/basic.py", line 233, in serialize
    return b"".join([self._itemtype(i).serialize() for i in self])
  File "/usr/local/lib/python3.7/site-packages/zigpy/types/basic.py", line 233, in <listcomp>
    return b"".join([self._itemtype(i).serialize() for i in self])
  File "/usr/local/lib/python3.7/site-packages/zigpy/types/struct.py", line 17, in serialize
    r += getattr(self, field[0]).serialize()
  File "/usr/local/lib/python3.7/site-packages/zigpy/zcl/foundation.py", line 76, in serialize
    return self.type.to_bytes(1, "little") + self.value.serialize()
  File "/usr/local/lib/python3.7/site-packages/zigpy/types/basic.py", line 232, in serialize
    assert self._length is None or len(self) == self._length
AssertionError

Here's the debug when I try to read the value for the dimmer in the LegrandCluster

2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.zigbee.application] request (0x5a41, 260, 64513, 1, 1, 27, b'\x04!\x10\x1b\x00\x00\x00', True, False)
2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.uart] Send: 0x530 b'025a410101fc0101040000070421101b000000'
2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.uart] Frame to send: b'\x050\x00\x13\xee\x02ZA\x01\x01\xfc\x01\x01\x04\x00\x00\x07\x04!\x10\x1b\x00\x00\x00'
2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.uart] Frame escaped: b'\x02\x150\x02\x10\x13\xee\x02\x12ZA\x02\x11\x02\x11\xfc\x02\x11\x02\x11\x02\x14\x02\x10\x02\x10\x02\x17\x02\x14!\x10\x1b\x02\x10\x02\x10\x02\x10'
2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 80000005c00070053000
2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8000 b'00700530' LQI:0
2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.zigbee.application] zigate_callback_handler [0, 112, 1328, b'']
2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 8011000771005a4101fc0100
2020-06-02 18:05:08 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8011 b'005a4101fc01' LQI:0
2020-06-02 18:05:08 ERROR (MainThread) [zigpy_zigate.api] Received unhandled response 0x8011
2

Finally here's when I try to set the dimmer's brightness from 254 to 80

2020-06-02 18:08:41 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.legrand_dimmer_switch_w_o_neutral_505a8b00_level_on_off, brightness=80>
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.zigbee.application] request (0x5a41, 260, 8, 1, 1, 31, b'\x01\x1f\x04P\x00\x00', True, False)
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Send: 0x530 b'025a41010100080104000006011f04500000'
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Frame to send: b'\x050\x00\x12\x7f\x02ZA\x01\x01\x00\x08\x01\x04\x00\x00\x06\x01\x1f\x04P\x00\x00'
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Frame escaped: b'\x02\x150\x02\x10\x12\x7f\x02\x12ZA\x02\x11\x02\x11\x02\x10\x02\x18\x02\x11\x02\x14\x02\x10\x02\x10\x02\x16\x02\x11\x1f\x02\x14P\x02\x10\x02\x10'
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 80000005c40074053000
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8000 b'00740530' LQI:0
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.zigbee.application] zigate_callback_handler [0, 116, 1328, b'']
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 800200130800010400080101025a41020000181f0b040087
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8002 b'00010400080101025a41020000181f0b0400' LQI:135
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.zigbee.application] zigate_callback_handler [0, 260, 8, 1, 1, <Address address_mode=ADDRESS_MODE.NWK address=0x5a41>, <Address address_mode=ADDRESS_MODE.NWK address=0x0000>, b'\x18\x1f\x0b\x04\x00']
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy.zcl] [0x5a41:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=31 command_id=Command.Default_Response>
2020-06-02 18:08:41 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x5a41:1:0x0008]: executed 'move_to_level_with_on_off' command with args: '(80, 0)' kwargs: '{}' result: [4, <Status.SUCCESS: 0>]
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.zigbee.application] request (0x5a41, 260, 6, 1, 1, 33, b'\x01!\x01', True, False)
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Send: 0x530 b'025a41010100060104000003012101'
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Frame to send: b'\x050\x00\x0f\x02\x02ZA\x01\x01\x00\x06\x01\x04\x00\x00\x03\x01!\x01'
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Frame escaped: b'\x02\x150\x02\x10\x02\x1f\x02\x12\x02\x12ZA\x02\x11\x02\x11\x02\x10\x02\x16\x02\x11\x02\x14\x02\x10\x02\x10\x02\x13\x02\x11!\x02\x11'
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 80000005c50075053000
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8000 b'00750530' LQI:0
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.zigbee.application] zigate_callback_handler [0, 117, 1328, b'']
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.uart] Frame received: 800200133d00010400060101025a4102000018210b010087
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.api] data received 0x8002 b'00010400060101025a4102000018210b0100' LQI:135
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy_zigate.zigbee.application] zigate_callback_handler [0, 260, 6, 1, 1, <Address address_mode=ADDRESS_MODE.NWK address=0x5a41>, <Address address_mode=ADDRESS_MODE.NWK address=0x0000>, b'\x18!\x0b\x01\x00']
2020-06-02 18:08:41 DEBUG (MainThread) [zigpy.zcl] [0x5a41:1:0x0006] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=33 command_id=Command.Default_Response>
2020-06-02 18:08:41 DEBUG (MainThread) [homeassistant.components.zha.core.channels.base] [0x5a41:1:0x0006]: executed 'on' command with args: '()' kwargs: '{}' result: [1, <Status.SUCCESS: 0>]
2020-06-02 18:08:41 DEBUG (MainThread) [homeassistant.components.zha.entity] light.legrand_dimmer_switch_w_o_neutral_505a8b00_level_on_off: turned on: {'move_to_level_with_on_off': [4, <Status.SUCCESS: 0>], 'on_off': [1, <Status.SUCCESS: 0>]}
2020-06-02 18:08:41 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.legrand_dimmer_switch_w_o_neutral_505a8b00_level_on_off, old_state=<state light.legrand_dimmer_switch_w_o_neutral_505a8b00_level_on_off=on; brightness=254, off_brightness=None, friendly_name= Legrand  Dimmer switch w/o neutral 505a8b00 level, on_off, supported_features=41 @ 2020-06-02T17:55:23.305904+02:00>, new_state=<state light.legrand_dimmer_switch_w_o_neutral_505a8b00_level_on_off=on; brightness=80, off_brightness=None, friendly_name= Legrand  Dimmer switch w/o neutral 505a8b00 level, on_off, supported_features=41 @ 2020-06-02T17:55:23.305904+02:00>>

I would rather stick with ZHA integration going forward if possible, but that would imply that I figure out why the dimmer doesn't work as expected, and also currently that I never power down my rpi - because as explained if I do it looks like I have to reinstall the custom integration for production mode be properly set on the board.

Crocmagnon commented 4 years ago

I have one of these devices too. I can discover it with Home Assistant but I can’t control it afterwards. Should I open another issue?

Cyrille63 commented 3 years ago

I have one of these devices too. I can discover it with Home Assistant but I can’t control it afterwards. Should I open another issue?

Hi, me too I have the same problem, I can not control it, is there a procedure ?