zha-device-handlers icon indicating copy to clipboard operation
zha-device-handlers copied to clipboard

[BUG] Mercator Zigbee ZHA Single Dimmer Switch (TS0601)

Open aussiebish opened this issue 4 weeks ago • 0 comments

Bug description

Hi, this Mercator model: SSWD01G Single Light Dimmer Switch was not detecting correctly, even though it appeared to have been added to the Quirks. My model: "_TZE200_swaamsoy", "TS0601" was not properly detected until I found someone had customised the quirk for this model. This version provided here under Expected Behaviour works and should be integrated into the standard set of quirks (please).

Steps to reproduce

Load switch, using standard library. Light is added to zigbee hub as switch, but does not have dimmer control and does not function at all (through zigbee, although still works manually). Details on the issue can be found here: https://community.home-assistant.io/t/zigbee-dimmer-in-zha-but-not-working/740072/4

Expected behavior

“”“Tuya based touch switch.”“” from typing import Optional, Union

from zigpy.profiles import zha from zigpy.quirks import CustomCluster import zigpy.types as t from zigpy.zcl import foundation from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Groups, Identify, LevelControl, OnOff, Ota, Scenes, Time from zigpy.zcl.clusters.lighting import Color

from zhaquirks.const import ( DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODELS_INFO, OUTPUT_CLUSTERS, PROFILE_ID, ) from zhaquirks.tuya import ( TuyaDimmerSwitch, TuyaLevelControl, TuyaManufacturerClusterOnOff, TuyaManufacturerLevelControl, TuyaManufCluster, TuyaOnOff, ) from zhaquirks.tuya.mcu import ( TuyaInWallLevelControl, TuyaLevelControlManufCluster, TuyaOnOff as TuyaOnOffMCU, )

class TuyaSingleSwitchDimmerPlus(TuyaDimmerSwitch): “”“Tuya touch switch device.”“”

signature = { # "node_descriptor": "NodeDescriptor(logical_type=<LogicalType.Router: 1>, complex_descriptor_available=0, user_descriptor_available=0, # reserved=0, aps_flags=0, frequency_band=<FrequencyBand.Freq2400MHz: 8>, mac_capability_flags=<MACCapabilityFlags.AllocateAddress|RxOnWhenIdle|MainsPowered|FullFunctionDevice: 142>, # 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=False, *is_full_function_device=True, *is_mains_powered=True, *is_receiver_on_when_idle=True, *is_router=True, *is_security_capable=False)", MODELS_INFO: [ ("_TZE200_swaamsoy", "TS0601"), ], ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.DIMMER_SWITCH, INPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, Scenes.cluster_id, OnOff.cluster_id, LevelControl.cluster_id, Color.cluster_id, TuyaManufCluster.cluster_id, ], OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id], } }, }

replacement = { ENDPOINTS: { 1: { DEVICE_TYPE: zha.DeviceType.ON_OFF_LIGHT, INPUT_CLUSTERS: [ Basic.cluster_id, Identify.cluster_id, Groups.cluster_id, Scenes.cluster_id, TuyaOnOffMCU, TuyaInWallLevelControl, TuyaLevelControlManufCluster, ], OUTPUT_CLUSTERS: [Time.cluster_id, Ota.cluster_id], } } }

Screenshots/Video

image

Device signature

TS0601 by _TZE200_swaamsoy Firmware: 0x00000040 IEEE: Nwk: 0x5490 Device Type: Router LQI: 255 RSSI: -51 Last seen: 2024-06-19T18:51:22 Power source: Mains Quirk: ts0601_dimmer.TuyaSingleSwitchDimmerPlus

Diagnostic information

No response

Logs

2024-06-19 08:36:15.688 WARNING (ImportExecutor_0) [zhaquirks] Loaded custom quirks. Please contribute them to GitHub - 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. 2024-06-19 08:36:34.236 WARNING (ImportExecutor_0) [zhaquirks] Loaded custom quirks. Please contribute them to GitHub - 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. File “/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.py”, line 268, in read_attributes_raw File “/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.py”, line 334, in _read_attributes 2024-06-19 08:36:51.476 DEBUG (MainThread) [zigpy.quirks.registry] Checking quirks for _TZE200_swaamsoy TS0601 (bc:33:ac:ff:fe:f5:ae:35) 2024-06-19 08:36:51.476 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘ts0601_dimmer.TuyaSingleSwitchDimmer’> 2024-06-19 08:36:51.477 DEBUG (MainThread) [zigpy.quirks] Fail because device_type mismatch on at least one endpoint 2024-06-19 08:36:51.477 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘ts0601_dimmer.TuyaSingleSwitchDimmer’> 2024-06-19 08:36:51.477 DEBUG (MainThread) [zigpy.quirks] Fail because device_type mismatch on at least one endpoint 2024-06-19 08:36:51.478 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘zhaquirks.tuya.ts0601_dimmer.TuyaSingleSwitchDimmer’> 2024-06-19 08:36:51.478 DEBUG (MainThread) [zigpy.quirks] Fail because device_type mismatch on at least one endpoint 2024-06-19 08:36:51.478 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘zhaquirks.xbee.xbee_io.XBeeSensor’> 2024-06-19 08:36:51.479 DEBUG (MainThread) [zigpy.quirks] Fail because endpoint list mismatch: {232, 230} {1} 2024-06-19 08:36:51.479 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘zhaquirks.xbee.xbee3_io.XBee3Sensor’> 2024-06-19 08:36:51.479 DEBUG (MainThread) [zigpy.quirks] Fail because endpoint list mismatch: {232, 230} {1} 2024-06-19 08:36:51.480 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘zhaquirks.tuya.ts0201.MoesTemperatureHumidtySensorWithScreen’> 2024-06-19 08:36:51.481 DEBUG (MainThread) [zigpy.quirks] Fail because device_type mismatch on at least one endpoint 2024-06-19 08:36:51.482 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘zhaquirks.smartthings.tag_v4.SmartThingsTagV4’> 2024-06-19 08:36:51.482 DEBUG (MainThread) [zigpy.quirks] Fail because device_type mismatch on at least one endpoint 2024-06-19 08:36:51.482 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘zhaquirks.smartthings.multi.SmartthingsMultiPurposeSensor’> 2024-06-19 08:36:51.483 DEBUG (MainThread) [zigpy.quirks] Fail because device_type mismatch on at least one endpoint 2024-06-19 08:36:51.483 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘zhaquirks.netvox.z308e3ed.Z308E3ED’> 2024-06-19 08:36:51.483 DEBUG (MainThread) [zigpy.quirks] Fail because device_type mismatch on at least one endpoint 2024-06-19 08:36:51.483 DEBUG (MainThread) [zigpy.quirks.registry] Considering <class ‘zhaquirks.gledopto.soposhgu10.SoposhGU10’> 2024-06-19 08:36:51.484 DEBUG (MainThread) [zigpy.quirks] Fail because endpoint list mismatch: {11, 13} {1} 2024-06-19 08:36:51.511 DEBUG (MainThread) [homeassistant.components.zha.core.discovery] Attempting to discover quirks v2 entities for device: bc:33:ac:ff:fe:f5:ae:35-_TZE200_swaamsoy TS0601 2024-06-19 08:36:51.511 DEBUG (MainThread) [homeassistant.components.zha.core.discovery] Device: bc:33:ac:ff:fe:f5:ae:35-_TZE200_swaamsoy TS0601 is not a quirks v2 device - skipping discover_quirks_v2_entities

Additional information

https://community.home-assistant.io/t/zigbee-dimmer-in-zha-but-not-working/740072

aussiebish avatar Jun 19 '24 08:06 aussiebish