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
773 stars 703 forks source link

[Device Support Request] TS004F Tuya Smart Knob #1322

Closed Tropaion closed 2 years ago

Tropaion commented 2 years ago

I recently got this Tuya Smart Knob: Ali

Pairing works and the Quirks for TS004F is applied, but only the battery cluster works, others don't appear. Here is the pairing log:

Device 0x27a3 (54:0f:57:ff:fe:2e:3c:5f) joined the network
Device 54:0f:57:ff:fe:2e:3c:5f changed id (0x27a3 => 0x27a3)
[0x27a3] Scheduling initialization
Tries remaining: 3
[0x27a3] Requesting 'Node Descriptor'
Tries remaining: 2
[0x27a3] Extending timeout for 0x2e request
Device 0x27a3 (54:0f:57:ff:fe:2e:3c:5f) joined the network
[0x27a3] Scheduling initialization
[0x27a3] Canceling old initialize call
Tries remaining: 3
[0x27a3] Requesting 'Node Descriptor'
Tries remaining: 2
[0x27a3] Extending timeout for 0x2f request
Device 0x27a3 (54:0f:57:ff:fe:2e:3c:5f) joined the network
[0x27a3] Scheduling initialization
[0x27a3] Canceling old initialize call
Received frame on uninitialized device <Device model=None manuf=None nwk=0x27A3 ieee=54:0f:57:ff:fe:2e:3c:5f is_initialized=False> from ep 0 to ep 0, cluster ZDOCmd.Device_annce: b'\xFF\xA3\x27\x5F\x3C\x2E\xFE\xFF\x57\x0F\x54\x80'
[0x27a3:zdo] ZDO request ZDOCmd.Device_annce: [0x27A3, 54:0f:57:ff:fe:2e:3c:5f, 128]
Tries remaining: 3
[0x27a3] Requesting 'Node Descriptor'
Tries remaining: 2
[0x27a3] Extending timeout for 0x30 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x27A3 ieee=54:0f:57:ff:fe:2e:3c:5f is_initialized=False> from ep 0 to ep 0, cluster ZDOCmd.Node_Desc_rsp: b'\x30\x00\xA3\x27\x02\x40\x80\x02\x10\x52\x52\x00\x00\x2C\x52\x00\x00'
[0x27a3] Got Node Descriptor: NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False)
[0x27a3] Discovering endpoints
Tries remaining: 3
[0x27a3] Extending timeout for 0x31 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x27A3 ieee=54:0f:57:ff:fe:2e:3c:5f is_initialized=False> from ep 0 to ep 0, cluster ZDOCmd.Active_EP_rsp: b'\x31\x00\xA3\x27\x01\x01'
[0x27a3] Discovered endpoints: [1]
[0x27a3] Initializing endpoints [<Endpoint id=1 in=[] out=[] status=<Status.NEW: 0>>]
[0x27a3:1] Discovering endpoint information
Tries remaining: 3
[0x27a3] Extending timeout for 0x32 request
Received frame on uninitialized device <Device model=None manuf=None nwk=0x27A3 ieee=54:0f:57:ff:fe:2e:3c:5f is_initialized=False> from ep 0 to ep 0, cluster ZDOCmd.Simple_Desc_rsp: b'\x32\x00\xA3\x27\x24\x01\x04\x01\x04\x01\x01\x06\x00\x00\x01\x00\x03\x00\x04\x00\x06\x00\x00\x10\x08\x19\x00\x0A\x00\x03\x00\x04\x00\x05\x00\x06\x00\x08\x00\x00\x10'
[0x27a3:1] Discovered endpoint information: SizePrefixedSimpleDescriptor(endpoint=1, profile=260, device_type=260, device_version=1, input_clusters=[0, 1, 3, 4, 6, 4096], output_clusters=[25, 10, 3, 4, 5, 6, 8, 4096])
[0x27a3] Extending timeout for 0x33 request
[0x27a3: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=51 command_id=Command.Read_Attributes_rsp>
[0x27a3] Read model 'TS004F' and manufacturer '_TZ3000_4fjiwweb' from <Endpoint id=1 in=[basic:0x0000, power:0x0001, identify:0x0003, groups:0x0004, on_off:0x0006, lightlink:0x1000] out=[ota:0x0019, time:0x000A, identify:0x0003, groups:0x0004, scenes:0x0005, on_off:0x0006, level:0x0008, lightlink:0x1000] status=<Status.ZDO_INIT: 1>>
[0x27a3] Discovered basic device information for <Device model='TS004F' manuf='_TZ3000_4fjiwweb' nwk=0x27A3 ieee=54:0f:57:ff:fe:2e:3c:5f is_initialized=True>
Device is initialized <Device model='TS004F' manuf='_TZ3000_4fjiwweb' nwk=0x27A3 ieee=54:0f:57:ff:fe:2e:3c:5f is_initialized=True>
Checking quirks for _TZ3000_4fjiwweb TS004F (54:0f:57:ff:fe:2e:3c:5f)
Considering <class 'zhaquirks.tuya.ts004f.TuyaSmartRemote004F'>
Found custom device replacement for 54:0f:57:ff:fe:2e:3c:5f: <class 'zhaquirks.tuya.ts004f.TuyaSmartRemote004F'>
device - 0x27A3:54:0f:57:ff:fe:2e:3c:5f entering async_device_initialized - is_new_join: True
device - 0x27A3:54:0f:57:ff:fe:2e:3c:5f has joined the ZHA zigbee network
[0x27A3](TS004F): started configuration
[0x27A3:ZDO](TS004F): 'async_configure' stage succeeded
[0x27a3] Extending timeout for 0x34 request
[0x27a3] Extending timeout for 0x35 request
[0x27A3:1:0x0000]: finished channel configuration
[0x27a3] Extending timeout for 0x36 request
Error handling '_save_attribute' event with (54:0f:57:ff:fe:2e:3c:5f, 1, 0, 4, '_TZ3000_4fjiwweb') params: FOREIGN KEY constraint failed
Error handling '_save_attribute' event with (54:0f:57:ff:fe:2e:3c:5f, 1, 0, 5, 'TS004F') params: FOREIGN KEY constraint failed
[0x27a3:1:0x1000] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=53 command_id=Command.Default_Response>
[0x27a3] Extending timeout for 0x37 request
[0x27A3:1:0x0001]: bound 'power' cluster: Status.SUCCESS
[0x27a3] Extending timeout for 0x38 request
[0x27A3:1:0x0008]: bound 'level' cluster: Status.SUCCESS
[0x27A3:1:0x0008]: finished channel configuration
[0x27A3:1:0x0019]: finished channel configuration
[0x27a3] Extending timeout for 0x39 request
[0x27A3:1:0x0006]: bound 'on_off' cluster: Status.SUCCESS
[0x27A3:1:0x0006]: finished channel configuration
[0x27A3:1:0x0005]: bound 'scenes' cluster: Status.SUCCESS
[0x27A3:1:0x0005]: finished channel configuration
[0x27a3:1:0x0001] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=56 command_id=Command.Configure_Reporting_rsp>
[0x27A3:1:0x0001]: Successfully configured reporting for '{'battery_voltage': (3600, 10800, 1), 'battery_percentage_remaining': (3600, 10800, 1)}' on 'power' cluster: [ConfigureReportingResponseRecord(status=0)]
[0x27A3:1:0x0001]: finished channel configuration
[0x27A3:1:0x0001]: 'async_configure' stage succeeded
[0x27A3:1:0x1000]: 'async_configure' stage failed: not enough values to unpack (expected 3, got 2)
[0x27A3:1:0x0000]: 'async_configure' stage succeeded
[0x27A3:1:0x0008]: 'async_configure' stage succeeded
[0x27A3:1:0x0006]: 'async_configure' stage succeeded
[0x27A3:1:0x0019]: 'async_configure' stage succeeded
[0x27A3:1:0x0005]: 'async_configure' stage succeeded
[0x27A3](TS004F): completed configuration
[0x27A3](TS004F): stored in registry: ZhaDeviceEntry(name='_TZ3000_4fjiwweb TS004F', ieee='54:0f:57:ff:fe:2e:3c:5f', last_seen=1643823108.9565244)
[0x27a3] Extending timeout for 0x3a request
[0x27a3:1:0x0003] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=False> manufacturer=None tsn=58 command_id=Command.Default_Response>
[0x27A3:1:0x0003]: executed 'trigger_effect' command with args: '(2, 0)' kwargs: '{}' result: [64, <Status.UNSUP_CLUSTER_COMMAND: 129>]
[0x27A3](TS004F): started initialization
[0x27A3:ZDO](TS004F): 'async_initialize' stage succeeded
[0x27A3:1:0x0001]: initializing channel: from_cache: False
[0x27a3] Extending timeout for 0x3b request
[0x27A3:1:0x1000]: initializing channel: from_cache: False
[0x27A3:1:0x1000]: finished channel initialization
[0x27A3:1:0x0000]: initializing channel: from_cache: False
[0x27A3:1:0x0000]: finished channel initialization
[0x27A3:1:0x0008]: initializing channel: from_cache: False
[0x27A3:1:0x0008]: finished channel initialization
[0x27A3:1:0x0006]: initializing channel: from_cache: False
[0x27A3:1:0x0006]: finished channel initialization
[0x27A3:1:0x0019]: initializing channel: from_cache: False
[0x27A3:1:0x0019]: finished channel initialization
[0x27A3:1:0x0005]: initializing channel: from_cache: False
[0x27A3:1:0x0005]: finished channel initialization
[0x27a3:1:0x0001] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=59 command_id=Command.Read_Attributes_rsp>
[0x27a3] Extending timeout for 0x3c request
[0x27a3:1:0x0001] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=GLOBAL_COMMAND manufacturer_specific=False is_reply=True disable_default_response=True> manufacturer=None tsn=60 command_id=Command.Read_Attributes_rsp>
[0x27A3:1:0x0001]: finished channel initialization
[0x27A3:1:0x0001]: 'async_initialize' stage succeeded
[0x27A3:1:0x1000]: 'async_initialize' stage succeeded
[0x27A3:1:0x0000]: 'async_initialize' stage succeeded
[0x27A3:1:0x0008]: 'async_initialize' stage succeeded
[0x27A3:1:0x0006]: 'async_initialize' stage succeeded
[0x27A3:1:0x0019]: 'async_initialize' stage succeeded
[0x27A3:1:0x0005]: 'async_initialize' stage succeeded
[0x27A3](TS004F): power source: Battery or Unknown
[0x27A3](TS004F): completed initialization

Probably has something to do with these two warnings:

Logger: zigpy_znp.api
Source: /usr/local/lib/python3.9/site-packages/zigpy_znp/api.py:700
First occurred: 18:20:10 (2 occurrences)
Last logged: 18:31:44

Received an unhandled command: ZDO.NodeDescRsp.Callback(Src=0x2553, Status=<Status.SUCCESS: 0>, NWK=0x2553, NodeDescriptor=NullableNodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False))
Received an unhandled command: ZDO.NodeDescRsp.Callback(Src=0x27A3, Status=<Status.SUCCESS: 0>, NWK=0x27A3, NodeDescriptor=NullableNodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, *allocate_address=True, *is_alternate_pan_coordinator=False, *is_coordinator=False, *is_end_device=True, *is_full_function_device=False, *is_mains_powered=False, *is_receiver_on_when_idle=False, *is_router=False, *is_security_capable=False))
Logger: homeassistant.components.zha.core.channels.base
Source: components/zha/core/channels/base.py:428
Integration: Zigbee Home Automation (documentation, issues)
First occurred: 18:20:14 (3 occurrences)
Last logged: 18:31:48

[0x2553:1:0x1000]: 'async_configure' stage failed: not enough values to unpack (expected 3, got 2)
[0x2553:1:0x1000]: Couldn't get list of groups: Request failed after 5 attempts: <Status.MAC_NO_ACK: 233>
[0x27A3:1:0x1000]: 'async_configure' stage failed: not enough values to unpack (expected 3, got 2)
Tropaion commented 2 years ago

I'm in a different university now, extremely specialised in IT and yeah, the exams currently are hard, but tomorrow is the last and most hated one, signal theorie and mathematics 😢

Tropaion commented 2 years ago

@MattWestb Do you know what this missing cluster command is?

[0xd9d4:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=17 command_id=2>
[0xd9d4:1:0x0008] ZCL request 0x0002: [0, 13, 1]
[0xd9d4:1:0x0008] No handler for cluster command 2

And why I got these two exclamation marks? image

Tropaion commented 2 years ago

And I still don't understand why we have this error:

Logger: homeassistant.components.zha.core.channels.base
Source: components/zha/core/channels/base.py:428
Integration: Zigbee Home Automation (documentation, issues)
First occurred: 00:23:31 (2 occurrences)
Last logged: 00:23:44

[0xD9D4:1:0x1000]: 'async_configure' stage failed: not enough values to unpack (expected 3, got 2)
Tropaion commented 2 years ago

@MattWestb I also found something interesting in the logs. When I rotate the knob right, the automation DimmUp is triggered:

2022-02-07 01:19:47 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=8, SrcAddr=0xD9D4, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=21, SecurityUse=<Bool.false: 0>, TimeStamp=8705888, TSN=0, Data=b'\x01\x45\x02\x00\x0D\x01\x00', MacSrcAddr=0xD9D4, MsgResultRadius=11)
2022-02-07 01:19:47 DEBUG (MainThread) [zigpy.zcl] [0xd9d4:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=69 command_id=2>
2022-02-07 01:19:47 DEBUG (MainThread) [zigpy.zcl] [0xd9d4:1:0x0008] ZCL request 0x0002: [0, 13, 1]
2022-02-07 01:19:47 DEBUG (MainThread) [zigpy.zcl] [0xd9d4:1:0x0008] No handler for cluster command 2
2022-02-07 01:19:47 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event zha_event[L]: device_ieee=54:0f:57:ff:fe:2e:3c:5f, unique_id=54:0f:57:ff:fe:2e:3c:5f:1:0x0008, device_id=3cc97f6cd8c336b5e52a6070f17fd3e8, endpoint_id=1, cluster_id=8, command=step, args=[0, 13, 1]>
2022-02-07 01:19:47 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Fabian_SmartKnob_Deckenlicht_DimmUp, entity_id=automation.fabian_smartknob_deckenlicht_dimmup, source=event 'zha_event'>
2022-02-07 01:19:47 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.fabian_smartknob_deckenlicht_dimmup, old_state=<state automation.fabian_smartknob_deckenlicht_dimmup=on; last_triggered=2022-02-07T01:18:43.108709+01:00, mode=single, current=0, id=1644190324288, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmUp @ 2022-02-07T01:07:58.149267+01:00>, new_state=<state automation.fabian_smartknob_deckenlicht_dimmup=on; last_triggered=2022-02-07T01:19:47.506486+01:00, mode=single, current=1, id=1644190324288, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmUp @ 2022-02-07T01:07:58.149267+01:00>>
2022-02-07 01:19:47 INFO (MainThread) [homeassistant.components.automation.fabian_smartknob_deckenlicht_dimmup] Fabian_SmartKnob_Deckenlicht_DimmUp: Running automation actions
2022-02-07 01:19:47 INFO (MainThread) [homeassistant.components.automation.fabian_smartknob_deckenlicht_dimmup] Fabian_SmartKnob_Deckenlicht_DimmUp: Executing step device automation
2022-02-07 01:19:47 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.fabian_deckenlicht_on_off, brightness_step_pct=10>
2022-02-07 01:19:47 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.fabian_smartknob_deckenlicht_dimmup, old_state=<state automation.fabian_smartknob_deckenlicht_dimmup=on; last_triggered=2022-02-07T01:19:47.506486+01:00, mode=single, current=1, id=1644190324288, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmUp @ 2022-02-07T01:07:58.149267+01:00>, new_state=<state automation.fabian_smartknob_deckenlicht_dimmup=on; last_triggered=2022-02-07T01:19:47.506486+01:00, mode=single, current=0, id=1644190324288, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmUp @ 2022-02-07T01:07:58.149267+01:00>>
2022-02-07 01:19:48 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.fabian_deckenlicht_on_off, old_state=<state light.fabian_deckenlicht_on_off=on; min_mireds=153, max_mireds=370, supported_color_modes=['brightness', 'color_temp'], color_mode=color_temp, brightness=26, color_temp=212, hs_color=(26.792, 23.244), rgb_color=(255, 222, 195), xy_color=(0.384, 0.354), friendly_name=On/Off, supported_features=32 @ 2022-02-07T01:07:51.562526+01:00>, new_state=<state light.fabian_deckenlicht_on_off=on; min_mireds=153, max_mireds=370, supported_color_modes=['brightness', 'color_temp'], color_mode=color_temp, brightness=51, color_temp=212, hs_color=(26.792, 23.244), rgb_color=(255, 222, 195), xy_color=(0.384, 0.354), friendly_name=On/Off, supported_features=32 @ 2022-02-07T01:07:51.562526+01:00>>
2022-02-07 01:19:48 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.fabian_deckenlicht_current_consumption, old_state=<state sensor.fabian_deckenlicht_current_consumption=1.8; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Aktueller Verbrauch @ 2022-02-07T01:18:43.651344+01:00>, new_state=<state sensor.fabian_deckenlicht_current_consumption=2.8; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Aktueller Verbrauch @ 2022-02-07T01:19:48.059870+01:00>>

But when I rotate left, first the automation DimmUp is called and then DimmDown:

22-02-07 01:18:43 DEBUG (MainThread) [zigpy_znp.api] Received command: AF.IncomingMsg.Callback(GroupId=0x0000, ClusterId=8, SrcAddr=0xD9D4, SrcEndpoint=1, DstEndpoint=1, WasBroadcast=<Bool.false: 0>, LQI=14, SecurityUse=<Bool.false: 0>, TimeStamp=4680024, TSN=0, Data=b'\x01\x44\x02\x01\x0D\x01\x00', MacSrcAddr=0xD9D4, MsgResultRadius=11)
2022-02-07 01:18:43 DEBUG (MainThread) [zigpy.zcl] [0xd9d4:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=68 command_id=2>
2022-02-07 01:18:43 DEBUG (MainThread) [zigpy.zcl] [0xd9d4:1:0x0008] ZCL request 0x0002: [1, 13, 1]
2022-02-07 01:18:43 DEBUG (MainThread) [zigpy.zcl] [0xd9d4:1:0x0008] No handler for cluster command 2
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event zha_event[L]: device_ieee=54:0f:57:ff:fe:2e:3c:5f, unique_id=54:0f:57:ff:fe:2e:3c:5f:1:0x0008, device_id=3cc97f6cd8c336b5e52a6070f17fd3e8, endpoint_id=1, cluster_id=8, command=step, args=[1, 13, 1]>
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Fabian_SmartKnob_Deckenlicht_DimmUp, entity_id=automation.fabian_smartknob_deckenlicht_dimmup, source=event 'zha_event'>
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.fabian_smartknob_deckenlicht_dimmup, old_state=<state automation.fabian_smartknob_deckenlicht_dimmup=on; last_triggered=2022-02-07T01:18:27.482595+01:00, mode=single, current=0, id=1644190324288, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmUp @ 2022-02-07T01:07:58.149267+01:00>, new_state=<state automation.fabian_smartknob_deckenlicht_dimmup=on; last_triggered=2022-02-07T01:18:43.108709+01:00, mode=single, current=1, id=1644190324288, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmUp @ 2022-02-07T01:07:58.149267+01:00>>
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event automation_triggered[L]: name=Fabian_SmartKnob_Deckenlicht_DimmDown, entity_id=automation.fabian_smartknob_deckenlicht_dimmdown, source=event 'zha_event'>
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.fabian_smartknob_deckenlicht_dimmdown, old_state=<state automation.fabian_smartknob_deckenlicht_dimmdown=on; last_triggered=2022-02-07T01:18:27.483887+01:00, mode=single, current=0, id=1644190345512, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmDown @ 2022-02-07T01:08:04.202702+01:00>, new_state=<state automation.fabian_smartknob_deckenlicht_dimmdown=on; last_triggered=2022-02-07T01:18:43.110139+01:00, mode=single, current=1, id=1644190345512, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmDown @ 2022-02-07T01:08:04.202702+01:00>>
2022-02-07 01:18:43 INFO (MainThread) [homeassistant.components.automation.fabian_smartknob_deckenlicht_dimmup] Fabian_SmartKnob_Deckenlicht_DimmUp: Running automation actions
2022-02-07 01:18:43 INFO (MainThread) [homeassistant.components.automation.fabian_smartknob_deckenlicht_dimmup] Fabian_SmartKnob_Deckenlicht_DimmUp: Executing step device automation
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.fabian_deckenlicht_on_off, brightness_step_pct=10>
2022-02-07 01:18:43 INFO (MainThread) [homeassistant.components.automation.fabian_smartknob_deckenlicht_dimmdown] Fabian_SmartKnob_Deckenlicht_DimmDown: Running automation actions
2022-02-07 01:18:43 INFO (MainThread) [homeassistant.components.automation.fabian_smartknob_deckenlicht_dimmdown] Fabian_SmartKnob_Deckenlicht_DimmDown: Executing step device automation
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.fabian_deckenlicht_on_off, brightness_step_pct=-10>
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.fabian_smartknob_deckenlicht_dimmup, old_state=<state automation.fabian_smartknob_deckenlicht_dimmup=on; last_triggered=2022-02-07T01:18:43.108709+01:00, mode=single, current=1, id=1644190324288, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmUp @ 2022-02-07T01:07:58.149267+01:00>, new_state=<state automation.fabian_smartknob_deckenlicht_dimmup=on; last_triggered=2022-02-07T01:18:43.108709+01:00, mode=single, current=0, id=1644190324288, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmUp @ 2022-02-07T01:07:58.149267+01:00>>
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.fabian_smartknob_deckenlicht_dimmdown, old_state=<state automation.fabian_smartknob_deckenlicht_dimmdown=on; last_triggered=2022-02-07T01:18:43.110139+01:00, mode=single, current=1, id=1644190345512, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmDown @ 2022-02-07T01:08:04.202702+01:00>, new_state=<state automation.fabian_smartknob_deckenlicht_dimmdown=on; last_triggered=2022-02-07T01:18:43.110139+01:00, mode=single, current=0, id=1644190345512, friendly_name=Fabian_SmartKnob_Deckenlicht_DimmDown @ 2022-02-07T01:08:04.202702+01:00>>
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.fabian_deckenlicht_on_off, old_state=<state light.fabian_deckenlicht_on_off=on; min_mireds=153, max_mireds=370, supported_color_modes=['brightness', 'color_temp'], color_mode=color_temp, brightness=51, color_temp=212, hs_color=(26.792, 23.244), rgb_color=(255, 222, 195), xy_color=(0.384, 0.354), friendly_name=On/Off, supported_features=32 @ 2022-02-07T01:07:51.562526+01:00>, new_state=<state light.fabian_deckenlicht_on_off=on; min_mireds=153, max_mireds=370, supported_color_modes=['brightness', 'color_temp'], color_mode=color_temp, brightness=26, color_temp=212, hs_color=(26.792, 23.244), rgb_color=(255, 222, 195), xy_color=(0.384, 0.354), friendly_name=On/Off, supported_features=32 @ 2022-02-07T01:07:51.562526+01:00>>
2022-02-07 01:18:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.fabian_deckenlicht_current_consumption, old_state=<state sensor.fabian_deckenlicht_current_consumption=2.8; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Aktueller Verbrauch @ 2022-02-07T01:18:27.935860+01:00>, new_state=<state sensor.fabian_deckenlicht_current_consumption=1.8; state_class=measurement, unit_of_measurement=W, device_class=power, friendly_name=Aktueller Verbrauch @ 2022-02-07T01:18:43.651344+01:00>>
MattWestb commented 2 years ago

The 2 first warning signs i thinks the new LIQ and RISS sensors. The cluster 0x1000 is LightLink cluster and we have not "touching" it = not our fault. The dimmer device trigger looks promise and the data i was putting it looks right. If you using the device automation from the device card is it working OK or is it always being triggered ?

I looking more in the afternoon.

MattWestb commented 2 years ago

I was using one IKEA Symphonisk that also is one rotater and is sending nearly the same commands and was doing one automation from the device card with rotating right and fire one zha_event right:1 and one left if rotating left.

2022-02-07 14:08:59 DEBUG (MainThread) [zigpy.zcl] [0x7dbc:1:0x0008] ZCL request 0x0001: [0, 195]
2022-02-07 14:08:59 DEBUG (MainThread) [zigpy.zcl] [0x7dbc:1:0x0008] No handler for cluster command 1
2022-02-07 14:08:59 INFO (MainThread) [homeassistant.components.automation.sf_right] SF Right: Running automation actions
2022-02-07 14:08:59 INFO (MainThread) [homeassistant.components.automation.sf_right] SF Right: Executing step zha_event

2022-02-07 14:08:57 DEBUG (MainThread) [zigpy.zcl] [0x7dbc:1:0x0008] ZCL request 0x0001: [1, 195]
2022-02-07 14:08:57 DEBUG (MainThread) [zigpy.zcl] [0x7dbc:1:0x0008] No handler for cluster command 1
2022-02-07 14:08:57 INFO (MainThread) [homeassistant.components.automation.sf_left] SF Left: Running automation actions
2022-02-07 14:08:57 INFO (MainThread) [homeassistant.components.automation.sf_left] SF Left: Executing step zha_event

And i is getting right:1 and left:1 nicely as events and also in the log.

The IKEA DA: https://github.com/zigpy/zha-device-handlers/blob/23a166902e50d5c32019e0d4d32a968715041bb6/zhaquirks/ikea/symfonisk.py#L102-L113

I have not looking but shall but my feeling is that the Device Automation and what the device is sending is OK but perhaps problem with the automation you have done.

My automation made from the device card, add automation for this device rotating Right / left is looking like this in the automations.yaml:

- id: '1644238923083'
  alias: SF Right
  description: ''
  trigger:
  - device_id: 1018f5c2e28bde1044a8ee2449db3bcd
    domain: zha
    platform: device
    type: device_rotated
    subtype: right
  condition: []
  action:
  - event: zha_event
    event_data:
      Right: 1
  mode: single
- id: '1644239212807'
  alias: SF Left
  description: ''
  trigger:
  - device_id: 1018f5c2e28bde1044a8ee2449db3bcd
    domain: zha
    platform: device
    type: device_rotated
    subtype: left
  condition: []
  action:
  - event: zha_event
    event_data:
      Left: 1
  mode: single

Im looking little more in you logs and reporting if i can see some interesting in it.

MattWestb commented 2 years ago

I was looking little in your log with double commands sent and its looks its only one triggering of the code. But i dont understand way its making 2 actions from it.

Can you taking away your action and putting in one single zha_event instead so its cant being something strange with the action part that is linked to other things ?

Tropaion commented 2 years ago

@MattWestb What do you mean with one single zha_event. You mean I should remove the other automations?

MattWestb commented 2 years ago

Put in like this and the automation is only doing one zha_event.

  action:
  - event: zha_event
    event_data:
      Left: 1
  mode: single

Its feels very spooky that the automation is triggered one time and is doing 2 actions. Only for eliminating its some problem with the action part.

Tropaion commented 2 years ago

Sorry, but this doesn't make sense to me. The action is to increase the lamp brightness, this has nothing to do with the knob and zha_event. The zha_event is the trigger:

- id: '1643918785173'
  alias: Fabian_Deckenlicht_DimmUp
  description: ''
  trigger:
  - device_id: 3cc97f6cd8c336b5e52a6070f17fd3e8
    domain: zha
    platform: device
    type: device_rotated
    subtype: right
  condition: []
  action:
  - device_id: ded8c256a221c111531ecce08e8ddeb9
    domain: light
    entity_id: light.fabian_deckenlicht_on_off
    type: brightness_increase
  mode: single
MattWestb commented 2 years ago

I agree but in the log its 2 actions that is only one trigger. Therefor eliminating somthing strange happens in the action part (somthing linked that we dont see / knowing).

Its easy testing and eliminating other things that can doing bad things.

If the zha_events is working OK = the quirk and the device automation is OK and somthing is wrong with the with the entity_id: light.fabian_deckenlicht_on_off brightness_increase but we dont knowing that before testing it.

grinono commented 2 years ago

i just tried to connect this device, it's found by ZHE, but the button is not working. Is that a known issue?

Screenshot 2022-02-09 at 17 45 09

Tropaion commented 2 years ago

@grinono If you have the same device as me, you have to use the quirk discussed here.

Tropaion commented 2 years ago

@MattWestb I know tried if this bug appears with different target devices and it does. This bug happens with every target device.

MattWestb commented 2 years ago

OK but do you think its in the quirk or in the ZHA / HA automatons that is making the wrong thing ?

If its out of the quirk its better implanting the missing commands for the "light mode" and then implanting the "scene mode" and its commands (need adding function for one more cluster in tuya INIT).

I have ordering one knob but is still in France and i dont knowing if its DPD that is distributing it (they normally throwing things in the wrong post box or in Graz for PLZ W1110 so dont knowing if / then getting it and can doing tests.

Tropaion commented 2 years ago

@MattWestb Oh, you are from austria too 😃 , I'm from lower austria. I think the problem either lies in the quirk or zha, it shouldn't be HA, since wenn i test trigger the automation it works.

EDIT: It looks like there is already a solution: https://github.com/zigpy/zha-device-handlers/pull/1334

MattWestb commented 2 years ago

In Swedish but is being little more south the last 10 years now and its better then its not so cold and dark as in the north and Italy and Spain is nearer :-))).

If looking for possible commands sent from the device in "remote mode": Single press = On/Off. Long press = set color. Rotate left / right slow, med and fast = dim up and down in 21 steps (1 step ROTATED_SLOW, RIGHT and LEFT looks working). Press rotate left / right = Set color temperature.

Strategy ?

Normally more = better for the user !!! What shall being implanted in DA ? Shall having different names for modes like "rotate medium left" tagged Remote / Scene (its depends what the scene mode is sending if only rotate then its OK with that and remote is having "speed" and scene not). 42 different DA for steps / rotating in remote mode ? Is it possible passing the steps to the automation as variable ? Calculating steps = (X-1) / 12. Perhaps on for each slow, med and fast right left without steps or plus some with steps ? Single and long press the same the same trigger or one for each mode ?

Perhaps missing command in remote mode can being bubble press. Testing ?

And then all remote mode is working doing one tipple press and using "scene mode": Single press Double press Long press Rotate left / right.

Thinking and ideas is more then welcome !!

Tropaion commented 2 years ago

@MattWestb Since we temporarily didn't finde a solution I made an automation script, works but not fast:

- alias: Fabian_SmartKnob_Deckenlicht_Dimming
  description: ''
  mode: parallel
  trigger:
    - platform: event
      event_type: zha_event
      event_data:
        device_ieee: "54:0f:57:ff:fe:2e:3c:5f"
        endpoint_id: 1
        cluster_id: 8
        command: "step"
  condition: []
  action:
    service: light.turn_on
    entity_id: light.fabian_deckenlicht_on_off
    data:
      brightness_step_pct: "{{ ((trigger.event.data.args[1] - 1) / 12) if trigger.event.data.args[0] == 0 else (-((trigger.event.data.args[1] - 1) / 12)) }}"
Tropaion commented 2 years ago

@MattWestb And I recently I get this error from the smart knob, really weird:

2022-02-16 19:59:58 WARNING (MainThread) [zigpy_znp.api] Failed to parse broken GeneralFrame(header=CommandHeader(id=0x9F, subsystem=Subsystem.ZDO, type=CommandType.AREQ), data=b'\xD4\x9B\x84\x01\x8B') as <class 'zigpy_znp.types.commands.ZDO.ParentAnnceRsp.Callback'>
2022-02-16 19:59:58 DEBUG (MainThread) [zigpy_znp.api] Received command: ZDO.MsgCbIncoming.Callback(Src=0x9BD4, IsBroadcast=<Bool.false: 0>, ClusterId=32799, SecurityUse=0, TSN=3, MacDst=0x0000, Data=b'\x84\x01\x8B')
2022-02-16 19:59:58 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/zigpy_znp/zigbee/application.py", line 654, in on_zdo_message
args, data = list_deserialize(data, types)
File "/usr/local/lib/python3.9/site-packages/zigpy/types/__init__.py", line 9, in deserialize
value, data = type_.deserialize(data)
File "/usr/local/lib/python3.9/site-packages/zigpy/types/basic.py", line 622, in deserialize
item, data = cls._item_type.deserialize(data)
File "/usr/local/lib/python3.9/site-packages/zigpy/types/basic.py", line 648, in deserialize
item, data = cls._item_type.deserialize(data)
File "/usr/local/lib/python3.9/site-packages/zigpy/types/basic.py", line 140, in deserialize
raise ValueError(f"Data is too short to contain {byte_size} bytes")
ValueError: Data is too short to contain 1 bytes
MattWestb commented 2 years ago

Your "manual" automation looks nice and is having the step counting implanted !! If your light was one Zigbee light you only have needing adding it in the same group or binding the controller to the group and all have working (also then the coordinator is offline).

The zigpy_znp.types.commands.ZDO.ParentAnnceRsp.Callback is tricky then ParentAnnce is being sent of one device then its re/joining the network if its have being lost, rebooted or jumping to one new parent and the parent is then broadcasting it in the network so all is knowing where the device is. But its strange is that some device is trying sending one response back to the joining device and that is malformed. Perhaps its the coordinator that is trying doing it but i cant see that in the log.

If you is still getting it try sniffing it so we can see wot is being sent in real and from witch device.

MattWestb commented 2 years ago

Is / was the knob Src=0x9BD4 ?

Tropaion commented 2 years ago

@MattWestb Sorry made a mistake, it has neary the same src address so I looked wrongly, it's a new device I bought for my dimming target: Osram CLA60 TW

If your light was one Zigbee light you only have needing adding it in the same group or binding the controller to the group and all have working (also then the coordinator is offline).

But as far as I know, Tuya doesn't work with Zigbee Groups. I tried creating groups with tuya devices before, but they didn't do anything.

MattWestb commented 2 years ago

tuya "MCU / DP" devices (TS0602) is not supporting binding. "Normal" tuya zigbee devices is normally doing it.

My TS004F is not doing it but its one remote and shall doing it and i was finding that it must being added as one light in one Zigbee light group and its working but only the last added group is being used of the remote.

In the quirk i have adding Groups.cluster_id as in cluster so you shall having the knob in ZHA group as one light and adding to one group is sending the light commands to it. Testing if its working but dont forgetting waking the knob then you is sending commands to it.

MattWestb commented 2 years ago

Have getting one and the the "scene mode" is the device automatons working with single, double and long press release and rotating left and right without triggering right then rotating left.

In controller mode i is getting the same right rotating is OK but left is triggering first right and then left rotating automation.

INIT must being coped in the HA container and the quirk is working OK as local quirk. TS004F-Knob.zip

Still very much work in progress but the ground functions is in and need more testing and finding way the controller mode is not working OK with this device but OK with IKEA ones.

Changing mode is 3 fast pressing or using attribute on ONOff cluster.

MattWestb commented 2 years ago

Now "scene mode" is having working device automation triggers for: SHORT_PRESS, LONG_PRESS, DOUBLE_PRESS, ROTATED, RIGHT and ROTATED, LEFT. Its not sending stop rotating and how much and no long press release.

Dimmer mode: SHORT_PRESS, LONG_PRESS, LONG_RELEASE OK Mode dont have double press but release after long press and is sending slow, medium and fast steps right / left.

Now to the bad part: Rotate !! I have only making slow rotate left and right and left is working OK and right is being triggered for both directions (as we knowing). But i have also doing DA for middle speed and ceiling it fast (fast mode is not easy getting correct numbers for doing DA so skipped) and both right and left is working OK !!! Fast right with DA:

2022-03-01 16:31:21 DEBUG (MainThread) [zigpy.zcl] [0xe34a:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=73 command_id=2>
2022-03-01 16:31:21 DEBUG (MainThread) [zigpy.zcl] [0xe34a:1:0x0008] ZCL request 0x0002: [0, 37, 2]
2022-03-01 16:31:21 DEBUG (MainThread) [zigpy.zcl] [0xe34a:1:0x0008] No handler for cluster command 2
2022-03-01 16:31:21 INFO (MainThread) [homeassistant.components.automation.new_automation_frr] New Automation FRR: Running automation actions
2022-03-01 16:31:21 INFO (MainThread) [homeassistant.components.automation.new_automation_frr] New Automation FRR: Executing step zha_event

Fast left with DA:

2022-03-01 16:31:06 DEBUG (MainThread) [zigpy.zcl] [0xe34a:1:0x0008] ZCL deserialize: <ZCLHeader frame_control=<FrameControl frame_type=CLUSTER_COMMAND manufacturer_specific=False is_reply=False disable_default_response=False> manufacturer=None tsn=67 command_id=2>
2022-03-01 16:31:06 DEBUG (MainThread) [zigpy.zcl] [0xe34a:1:0x0008] ZCL request 0x0002: [1, 37, 2]
2022-03-01 16:31:06 DEBUG (MainThread) [zigpy.zcl] [0xe34a:1:0x0008] No handler for cluster command 2
2022-03-01 16:31:06 INFO (MainThread) [homeassistant.components.automation.new_automation_frl] New Automation FRL: Running automation actions
2022-03-01 16:31:06 INFO (MainThread) [homeassistant.components.automation.new_automation_frl] New Automation FRL: Executing step zha_event

And only one and the right event in zhe_event !!!

@Tropaion can you testing if you is getting the same results so i is not doing anything wrong ? ts004f3B.py.txt I have tested putting new defines in INIT and also in the quirk but the latest "stand" is little mixed so can being need little patching.

I shall trying getting little more good logging for putting in the ZHA issue for trying getting the bug fixed so all is working OK.

More thinking of implanting DA ? I think the dimmer mode fast rotate is not working stable in reality. Perhaps making one DA with X steps rotated left / right.

"Scene mode" i think we is having all in place and also the ground for dimmer mode functions the device is sending. Try using more commands from the color cluster is not bringing anything then its have the same function on the device(only tripper sending commands). Only the rotate is interesting looking more on what is working in real life and can being implanted in DAs.

Commands and feedback is more then welcome !!

MattWestb commented 2 years ago

Updated version of quirk and INIT. TS004F4.Zip The INIT need being copied in to HA container so unzip the archive in your config folder and copy the quirk to your local quirk folder and the inside HA container with one CLI with the command cp /config/__init__.py /usr/local/lib/python3.9/site-packages/zhaquirks/tuya/__init__.py and restarting HA.

Some WIP is still inside and shall being deleted / moved to constants after its have being merged.

Still "normal" rotating is being triggered false positive but its one bug in HA and not in the quirk and I think user have getting enough for playing for some time and the core devs can hunting the bug that making the problems.

Testing and reporting back pleas !!

MattWestb commented 2 years ago

31 DAs for our TS004F devices !!!

DA = Device automatons that you can doing from the device card.

TS004F Dimmer switch

Command mode (old ones): SHORT_PRESS, TURN_ON SHORT_PRESS, TURN_OFF SHORT_PRESS, DIM_UP LONG_PRESS, DIM_UP SHORT_PRESS, DIM_DOWN LONG_PRESS, DIM_DOWN LONG_RELEASE, DIM_DOWN (and dim up)

Event mode (now ones): SHORT_PRESS, BUTTON_1 LONG_PRESS, BUTTON_1 DOUBLE_PRESS, BUTTON_1 SHORT_PRESS, BUTTON_2 LONG_PRESS, BUTTON_2 DOUBLE_PRESS, BUTTON_2 SHORT_PRESS, BUTTON_3 LONG_PRESS, BUTTON_3 DOUBLE_PRESS, BUTTON_3 SHORT_PRESS, BUTTON_4 LONG_PRESS, BUTTON_4 DOUBLE_PRESS, BUTTON_4

So 7 + 12 = 19 device automatons :-)) Switch between command and event mode with long pressing the upper and lower right button until the lower right button LED is blinking or user attribute on EP1 OnOff cluster "Switch mode" (0x8004) and waking the device up then setting or reading it. And you need have the dimmer paired ones with one tuya ZBGW for getting all 4 EP sending the commands (its working until taking the battery out) or i can getting help reading and setting attributes from the quirk.

TS004F Rotating Knob

Command mode: SHORT_PRESS, BUTTON LONG_PRESS, BUTTON LONG_RELEASE, BUTTON ROTATED_SLOW, RIGHT (one step) ROTATED_SLOW, LEFT (one step) (HA automation is triggering it false positive but the quirk is making it OK). ROTATED_FAST, RIGHT (3 steps) ROTATED_FAST, LEFT (3 steps)

Event mode: SHORT_PRESS, BUTTON_1 DOUBLE_PRESS, BUTTON_1 LONG_PRESS, BUTTON_1 ROTATED, RIGHT ROTATED, LEFT

So 7 + 5 = 12 device automatons :-)) Switch between command and event mode with triple press the button or user attribute on EP1 OnOff cluster "Switch mode" (0x8004) and waking the device up then setting or reading it.

Event mode have all in that we have found that the device is sending. The command mode is having 3 speed of rotating and also how many steps is doing and only 1 step slow and 1 step medium (called fast in DA) is made but more DA can being made is user have good working cases for it (perhaps getting right X steps and x is stetted in the automation?). Fast rotating i think its no working case for then its not easy getting correct triggered.

Then both devices is light controller they can controlling light by sending commands to light groups. The dimmer switch cant being bonded to one group but can being added as one light in ZHA with only the last added group is working. I shall testing the Knob how its working with LIDL lights and "others" and reporting back.

Pleas testing and reporting back !!

contactcr commented 2 years ago

I managed to get the test code using "Custom deps deployment" addon and copying files (first time doing so)

In any case I tried both "Remote" and "Scene" mode. I don't have automations tied to the new events but I did monitor the zha_event while trying all the functions.

All functions in both modes result in one or more events so that's good. Long press in "remote" mode results in 3 events: move_saturation, stop_move_step, move_hue - is that correct?

Now that the device is showing events for everything I notice:

Looking forward to building out my remote automations with the new functionality

edit: when this is released do I need to do anything or will it overwrite the test code?

Tropaion commented 2 years ago

edit: when this is released do I need to do anything or will it overwrite the test code?

Just delete your quirks and reboot, then it should apply.

Long press in "remote" mode results in 3 events: move_saturation, stop_move_step, move_hue - is that correct?

Thats correct.

MattWestb commented 2 years ago

Thanks for testing @contactcr !!

The device is one light controller = is being made for controlling lights and is sending commands like dim up and down and so on plus one event mode for rotate and clicking around. Then the device made like this we cant doing anything only tuya can changing it in the future (and braking our device automatons).

I have trying "extracting" the commands that can being good used but as long pressing is sending many commands that we is only interested of one and the rest is for the system not interested. You is having device automatons on the device card only clicking on the + on the side of Automations and you is getting all function automated in some clicks.

The double press must being very fast and ripple is very nasty and the long press is always around 5 seconds and its the same we cant changing the device.

Then you is updating HA you need deleting your "Custom deps deployment" or you is getting problem with broken dependencies so look on this for doing that https://github.com/zigpy/zha-device-handlers/discussions/693#discussioncomment-457020.

exki92 commented 2 years ago

@MattWestb thanks for all your update, my 4 switch device didn't work previously despite many tests and now some improvement has been done by using your quirck but only the 1st button is working as excepted. I'm trying to duplicate same automation on another buttons but nothing is working......... I'm not using tuya GW but zigate+.....

MattWestb commented 2 years ago

We have getting the tuya magic spell working but i have not getting time getting the last parts in place for production but you can trying this quirk and deleting the "old" one in your custom_quirk folder. Then deleting the device and restarting AH and letting HA starting and settle (if not need restarting HA waiting one min before joining the device a gen or the deleting is not finished and you is getting problems). Adding the device and is its doing it OK it shall have casing the spell and have getting the 3 new endpoints working ts004f5.zip. The device is reseeding all "scenes" from EP 2-4 2 tomes but you is only getting one in zha_event and in the automatons. I have getting it working around 10 times but can being little tricky so the device is getting the casting early for doing its new setup. Changing working mode with with the 2 right button long press until lower left is blinking.

Its looks resetting the device and taking out battery is deleting the tuya magic but only resetting is OK and also taking out the battery if it was in the network (have trying 2 times with 20 min). .

exki92 commented 2 years ago

Thanks a lot for the new quirk file !!!! i tested it this morning by following your procedure and now all 4 buttons are working as excepted.

MattWestb commented 2 years ago

Thanks for testing and reporting back @exki92 !!

I shall trying getting time in the weekend for getting the quirk clean and fix the last bug we can fixing.

MattWestb commented 2 years ago

PR is made and waiting to being merged if the maintainer like it https://github.com/zigpy/zha-device-handlers/pull/1437.

The "dimmer bug" i cant fixing its out of my knowledge.

sebaschn commented 2 years ago

Thanks for testing and reporting back @exki92 !!

I shall trying getting time in the weekend for getting the quirk clean and fix the last bug we can fixing.

Hello Matt, whats the current status of the issue with this knob? I bought me one and i cant wait to get it started. sadly i have no skills to support you. best thing i can offer is being a beta-tester...

MattWestb commented 2 years ago

The original and 2 more device IDs is is being added and is working as expected in (light) command and event (scene) mode with device automatons for most things we have finding. If you is running HA 2022.05 you shall having the quirk in your system and working if not having one more with new device ID.

Tropaion commented 2 years ago

@MattWestb My smartknob is already in production use for a while 😄 . BTW should I close the issue? It's basically resolved isn't it?

MattWestb commented 2 years ago

Sounds great that is working after little hacking and coding !! Our Puddly was fixing the DA with his ZCL R7.5 and one more update is coming for HA 2022.06 but its working the same only different parms being used.

I was missing linking this issue with the PR so i think better closing it and user can opening new issue if having problems.

I have "found" 2 more device IDs for it and its added in the quirk so more user shall getting it working OK and also if coming new ones with the same endpoint and cluster setting it shall have the light DA working by default.

sebaschn commented 2 years ago

@MattWestb , @Tropaion

hello there, today i updated to v2022-06 and re-paired my smart-knob in hopes that it'll work finally (new name). sadly it doesnt...

but there is -at least- a little improvement, as in the "re-configure" window, there are almost only green icons but one - but only if i keep rotating the knob during the process (see below). if i just let it pass and do not touch the device, all checkboxes stay orange (exept for "binding / reporting"). in both cases (green/orange) the log (below) is exact the same (only lqi + rssi + last seen differ).

is there anything else i can try? is any blueprint needed? and yes, i did turn it off and on again ^^

THANK YOU in advance

entitys & Zigbee info

entitys found: button.switch_smartknob01_identify sensor.switch_smartknob01_power [not available] sensor.tz3000_ixla93vd_ts004f_532e3cfe_basic_lqi [not available] sensor.tz3000_ixla93vd_ts004f_532e3cfe_basic_rssi

Zigbee info IEEE: 38:5b:44:ff:fe:3c:2e:53 Nwk: 0x38a3 Device Type: EndDevice LQI: 255 RSSI: -52 Zuletzt gesehen: 2022-06-01T22:40:50 Energiequelle: Battery or Unknown Eigenart: zhaquirks.tuya.ts004f.TuyaSmartRemote004FROK

re-configure window text (instead of a screenshot)

[green checkbox] Die Neukonfiguration des Geräts ist fehlgeschlagen. Weitere Informationen sind möglicherweise in den Protokollen verfügbar. --> Device reconfiguration failed. More information may be available in the logs.

[green checkbox] binding [green checkbox] reporting Cluster Bindung Reporting Basic [green checkbox] PowerConfiguration Attribut min/max/change [green checkbox] battery_voltage: 3600/10800/1 [green checkbox] battery_percentage_remaining: 3600/10800/1 Identify Groups LightLink Ota Time [green checkbox] Scenes [green checkbox] TuyaSmartRemoteOnOffCluster [green checkbox] LevelControl [green checkbox] Color

Diagnose Information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2022.6.0", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.9.12", "docker": true, "arch": "x86_64", "timezone": "Europe/Berlin", "os_name": "Linux", "os_version": "5.15.41", "supervisor": "2022.05.3", "host_os": "Home Assistant OS 8.1", "docker_version": "20.10.14", "chassis": "vm", "run_as_root": true }, "custom_components": { "reolink_dev": { "version": "0.51", "requirements": [ "reolink==0.0.61" ] }, "bosch_shc": { "version": "0.4.27", "requirements": [ "boschshcpy==0.2.30" ] }, "nodered": { "version": "1.0.6", "requirements": [] }, "localtuya": { "version": "3.2.1", "requirements": [] }, "ai_thermostat": { "version": "0.9.3", "requirements": [] }, "pyscript": { "version": "1.3.3", "requirements": [ "croniter==1.3.4", "watchdog==2.1.6" ] }, "bosch": { "version": "0.17.3", "requirements": [ "bosch-thermostat-client==0.17.3" ] }, "hacs": { "version": "1.21.0", "requirements": [ "aiogithubapi>=21.11.0" ] }, "climate_group": { "version": "0.4.2", "requirements": [] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.30.0", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.75", "zigpy-deconz==0.16.0", "zigpy==0.45.1", "zigpy-xbee==0.14.0", "zigpy-zigate==0.7.4", "zigpy-znp==0.7.0" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "2652", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "10C4", "pid": "EA60", "description": "sonoffplus", "known_devices": [ "sonoff zigbee dongle plus" ] }, { "vid": "10C4", "pid": "EA60", "description": "tubeszb", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "tubeszb", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "zigstar", "known_devices": [ "ZigStar Coordinators" ] }, { "vid": "1CF1", "pid": "0030", "description": "conbee", "known_devices": [ "Conbee II" ] }, { "vid": "10C4", "pid": "8A2A", "description": "zigbee", "known_devices": [ "Nortek HUSBZB-1" ] }, { "vid": "0403", "pid": "6015", "description": "zigate", "known_devices": [ "ZiGate+" ] }, { "vid": "10C4", "pid": "EA60", "description": "zigate", "known_devices": [ "ZiGate" ] }, { "vid": "10C4", "pid": "8B34", "description": "bv 2010/10", "known_devices": [ "Bitron Video AV2010/10" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "zigate" } ], "after_dependencies": [ "usb", "zeroconf" ], "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp" ], "is_built_in": true }, "data": { "ieee": "REDACTED", "nwk": 14499, "manufacturer": "_TZ3000_ixla93vd", "model": "TS004F", "name": "_TZ3000_ixla93vd TS004F", "quirk_applied": true, "quirk_class": "zhaquirks.tuya.ts004f.TuyaSmartRemote004FROK", "manufacturer_code": 4098, "power_source": "Battery or Unknown", "lqi": 255, "rssi": -58, "last_seen": "2022-06-01T22:34:21", "available": true, "device_type": "EndDevice", "signature": { "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, allocate_address=True, is_alternate_pan_coordinator=False, is_coordinator=False, is_end_device=True, is_full_function_device=False, is_mains_powered=False, is_receiver_on_when_idle=False, is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0820", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x0004", "0x1000" ], "out_clusters": [ "0x0003", "0x0004", "0x0005", "0x0006", "0x0008", "0x000a", "0x0019", "0x0300", "0x1000" ] } } }, "entities": [ { "entity_id": "button.switch_smartknob01_identify", "name": "_TZ3000_ixla93vd TS004F" }, { "entity_id": "sensor.switch_smartknob01_power", "name": "_TZ3000_ixla93vd TS004F" } ], "neighbors": [], "endpoint_names": [ { "name": "NON_COLOR_CONTROLLER" } ], "user_given_name": "Switch_SmartKnob01", "device_reg_id": "e1e6f4af429d85673ecc40e940c9ce32", "area_id": "unzugewiesen" } }

ZigBee device signature

{ "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.EndDevice: 2>, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress: 128>, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=<DescriptorCapability.NONE: 0>, allocate_address=True, is_alternate_pan_coordinator=False, is_coordinator=False, is_end_device=True, is_full_function_device=False, is_mains_powered=False, is_receiver_on_when_idle=False, is_router=False, *is_security_capable=False)", "endpoints": { "1": { "profile_id": 260, "device_type": "0x0820", "in_clusters": [ "0x0000", "0x0001", "0x0003", "0x0004", "0x1000" ], "out_clusters": [ "0x0003", "0x0004", "0x0005", "0x0006", "0x0008", "0x000a", "0x0019", "0x0300", "0x1000" ] } }, "manufacturer": "_TZ3000_ixla93vd", "model": "TS004F", "class": "zhaquirks.tuya.ts004f.TuyaSmartRemote004FROK" }

MattWestb commented 2 years ago

Its looks being paired OK and the quirk is also loaded OK. The tuya smart rotating knob shall working OK then being normally pared and dont need being reconfigured like all IKEA remotes need for reporting OK.

If you going development tools -> events and putting in zha_event inListen to events box and clicking start listening and doing things with the ROK is you getting something ? If not getting events from it deleting it in ZHA and waiting one minute and then resetting it with the reset button and paring it and looking if you is getting events. If you is getting events from it you can using the device automatons from the device card for using all commands we have found for making your automaton .

sebaschn commented 2 years ago

@MattWestb i want to thank you so much! your advice works!!

i do get many different responses from the knob: today i was able to successfully create my first light dimmer swich in NodeRed:

sadly there are a few feature missing, that are advertised, or they work only in one of the two modes:

rotation while pressed down: zha_event DOES give me feedback in ONE of the two modes, but there is no available automation trigger to select from. are there plans to add this? because espacially the last one i miss this feature a lot!!

PS: is there a way to buy you a coffee?

Tropaion commented 2 years ago

@sebaschn I just made yaml automations that are reacting to the zha_events and everything works without problems. For example dimming:

- id: '1650491726841'
  alias: Fabian_SmartKnob_Deckenlicht_Dimming
  description: ''
  trigger:
  - platform: event
    event_type: zha_event
    event_data:
      device_ieee: 54:0f:57:ff:fe:2e:3c:5f
      endpoint_id: 1
      cluster_id: 8
      command: step
  condition: []
  action:
  - service: light.turn_on
    entity_id: light.fabian_deckenlicht_on_off
    data:
      brightness_step_pct: '{{ (4*((trigger.event.data.args[1] - 1) / 12)) if trigger.event.data.args[0]
        == 0 else (-4*((trigger.event.data.args[1] - 1) / 12)) }}'
  mode: single
zanna-37 commented 2 years ago

~The only events that I'm able to receive are toggle and step.~ ~What am I doing wrong?~ _I tried to change scenamode (pressing 3 times the main button), but then the device doesn't send events anymore and some errors are logged.


Edit: I just noticed that the commit (eeaea57f83349945dc1785a5a582ce738ca07969) that adds the device model _TZ3000_qja6nq5z is only a month old, so maybe it hasn't been added to the last release yet.

MattWestb commented 2 years ago

If all is going well it shall being in next HA release in some day (HA2022.9). Try updating your system then its released and doing one more test.

zanna-37 commented 2 years ago

Everything works as expected in 2022.9.0. Thank you!