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
719 stars 664 forks source link

[Device Support Request] ClickSmart+ CMA30035 #2621

Closed Blackduke77 closed 4 months ago

Blackduke77 commented 11 months ago

Problem description

This is a single UK in wall socket, https://click-smart.com/products/definity-smart-sockets after in there is basic switch operation, but there is more available on this switch. I believe this is working under a generic driver. Under device info it is reporting as TS011F by TYZB01_mtunwanm I am fairly certain this should be similar to TS011F

Solution description

Please can we have device support for: on/off, lock, start as (on/off), light control

Screenshots/Video

Screenshots/Video [Paste/upload your media here]

Device signature

Device signature ```json { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *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)", "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0009", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0x0006", "0x000a" ], "output_clusters": [ "0x0019" ] } }, "manufacturer": "_TYZB01_mtunwanm", "model": "TS011F", "class": "zigpy.device.Device" } ```

Diagnostic information

Diagnostic information ```json [{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.9.3", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.5", "docker": true, "arch": "aarch64", "timezone": "Europe/London", "os_name": "Linux", "os_version": "6.1.21-v8", "supervisor": "2023.09.2", "host_os": "Home Assistant OS 10.5", "docker_version": "23.0.6", "chassis": "embedded", "run_as_root": true }, "custom_components": { "octopus_energy": { "version": "8.3.0", "requirements": [] }, "hacs": { "version": "1.33.0", "requirements": [ "aiogithubapi>=22.10.1" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "config_flow": true, "dependencies": [ "file_upload" ], "documentation": "https://www.home-assistant.io/integrations/zha", "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp", "universal_silabs_flasher" ], "requirements": [ "bellows==0.36.4", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.103", "zigpy-deconz==0.21.1", "zigpy==0.57.1", "zigpy-xbee==0.18.2", "zigpy-zigate==0.11.0", "zigpy-znp==0.11.4", "universal-silabs-flasher==0.0.14" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "1A86", "pid": "55D4", "description": "*sonoff*plus*", "known_devices": [ "sonoff zigbee dongle plus v2" ] }, { "vid": "10C4", "pid": "EA60", "description": "*sonoff*plus*", "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" ] } ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" }, { "type": "_uzg-01._tcp.local.", "name": "uzg-01*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "is_built_in": true }, "data": { "ieee": "**REDACTED**", "nwk": 64368, "manufacturer": "_TYZB01_mtunwanm", "model": "TS011F", "name": "_TYZB01_mtunwanm TS011F", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4098, "power_source": "Mains", "lqi": 124, "rssi": -69, "last_seen": "2023-10-04T13:34:15", "available": true, "device_type": "Router", "signature": { "node_descriptor": "NodeDescriptor(logical_type=, complex_descriptor_available=0, user_descriptor_available=0, reserved=0, aps_flags=0, frequency_band=, mac_capability_flags=, manufacturer_code=4098, maximum_buffer_size=82, maximum_incoming_transfer_size=82, server_mask=11264, maximum_outgoing_transfer_size=82, descriptor_capability_field=, *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)", "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0009", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0x0006", "0x000a" ], "output_clusters": [ "0x0019" ] } }, "manufacturer": "_TYZB01_mtunwanm", "model": "TS011F" }, "active_coordinator": false, "entities": [ { "entity_id": "switch.tyzb01_mtunwanm_ts011f_switch", "name": "_TYZB01_mtunwanm TS011F" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "MAIN_POWER_OUTLET" } ], "user_given_name": null, "device_reg_id": "3fa1affbd813cda45994272b1d9b0253", "area_id": "dominic_bedroom", "cluster_details": { "1": { "device_type": { "name": "MAIN_POWER_OUTLET", "id": 9 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0001": { "attribute_name": "app_version", "value": 64 }, "0x0004": { "attribute_name": "manufacturer", "value": "_TYZB01_mtunwanm" }, "0x0005": { "attribute_name": "model", "value": "TS011F" } }, "unsupported_attributes": { "0x0014": { "attribute_name": "disable_local_config" } } }, "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} }, "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x4002": { "attribute_name": "off_wait_time", "value": 0 }, "0x0000": { "attribute_name": "on_off", "value": 0 }, "0x4001": { "attribute_name": "on_time", "value": 0 } }, "unsupported_attributes": { "0xfffe": { "attribute_name": "reporting_status" }, "0x4003": { "attribute_name": "start_up_on_off" } } } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} } } } } } }] ```

Logs

Logs ```python [Paste the logs here] ```

Custom quirk

Custom quirk ```python [Paste your custom quirk here] ```

Additional information

No response

TheJulianJES commented 11 months ago

Can you try to see if it works HA Core 2023.10.0?

Blackduke77 commented 11 months ago

Just trying to work out how I can install a beta build

Blackduke77 commented 11 months ago

Just upgraded and no different,

javicalle commented 11 months ago

Maybe that quirk could do the job:

Tuya_1G_Switch_var02 ```python """Tuya TS011F Switches.""" from zigpy.profiles import zgp, zha from zigpy.zcl.clusters.general import ( Basic, GreenPowerProxy, Groups, Identify, OnOff, Ota, Scenes, Time, ) from zhaquirks.const import ( DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODEL, OUTPUT_CLUSTERS, PROFILE_ID, ) from zhaquirks.tuya import ( TuyaSwitch, TuyaZBE000Cluster, TuyaZBExternalSwitchTypeCluster, TuyaZBOnOffAttributeCluster, ) class Tuya_1G_Switch_var02(TuyaSwitch): """Tuya 1 gang light switch (variation 02).""" signature = { MODEL: "TS011F", ENDPOINTS: { # 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.MAIN_POWER_OUTLET, INPUT_CLUSTERS: [ Basic.cluster_id, Groups.cluster_id, Scenes.cluster_id, OnOff.cluster_id, Time.cluster_id, ], OUTPUT_CLUSTERS: [Ota.cluster_id], }, }, } replacement = { ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.MAIN_POWER_OUTLET, INPUT_CLUSTERS: [ Basic.cluster_id, Groups.cluster_id, Scenes.cluster_id, TuyaZBOnOffAttributeCluster, Time.cluster_id, ], OUTPUT_CLUSTERS: [Ota.cluster_id], }, }, } ```
Blackduke77 commented 11 months ago

Thanks, I will give it a test

Blackduke77 commented 11 months ago

Thanks, the option has come up straight away, I will test the functionality tomorrow, but looks like the above adds the child lock. I was trying to look at the quirk and reverse engineer how you surfaced the child lock, so I could work out how to surface some other the other features, like Power on state, but for the life of keep I cant see how, any advice or help in surfacing some of the other settings like light and Power on State. the power on state, might be ok as reading the attribute it is defaulting to Last State.

Maybe a silly question, how do we add this to the default build so we don't have to deploy a quirk?

image

image

Blackduke77 commented 11 months ago

here is the diagnostics, I think it is working now

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.10.1", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.5", "docker": true, "arch": "aarch64", "timezone": "Europe/London", "os_name": "Linux", "os_version": "6.1.21-v8", "supervisor": "2023.10.0", "host_os": "Home Assistant OS 10.5", "docker_version": "23.0.6", "chassis": "embedded", "run_as_root": true }, "custom_components": { "octopus_energy": { "version": "8.3.0", "requirements": [] }, "hacs": { "version": "1.33.0", "requirements": [ "aiogithubapi>=22.10.1" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "config_flow": true, "dependencies": [ "file_upload" ], "documentation": "https://www.home-assistant.io/integrations/zha", "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp", "universal_silabs_flasher" ], "requirements": [ "bellows==0.36.5", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.104", "zigpy-deconz==0.21.1", "zigpy==0.57.2", "zigpy-xbee==0.18.3", "zigpy-zigate==0.11.0", "zigpy-znp==0.11.5", "universal-silabs-flasher==0.0.14", "pyserial-asyncio-fast==0.11" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "2652", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "1A86", "pid": "55D4", "description": "sonoffplus", "known_devices": [ "sonoff zigbee dongle plus v2" ] }, { "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" ] } ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "zigate" }, { "type": "_zigstar_gw._tcp.local.", "name": "zigstar" }, { "type": "_uzg-01._tcp.local.", "name": "uzg-01" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06" } ], "is_built_in": true }, "data": { "ieee": "REDACTED", "nwk": 64368, "manufacturer": "_TYZB01_mtunwanm", "model": "TS011F", "name": "_TYZB01_mtunwanm TS011F", "quirk_applied": true, "quirk_class": "Tuya_1G_Switch_var02.Tuya_1G_Switch_var02", "manufacturer_code": 4098, "power_source": "Mains", "lqi": 172, "rssi": -57, "last_seen": "2023-10-09T23:52:29", "available": true, "device_type": "Router", "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.FullFunctionDevice|MainsPowered|RxOnWhenIdle|AllocateAddress: 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)", "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0009", "input_clusters": [ "0x0000", "0x0004", "0x0005", "0x0006", "0x000a" ], "output_clusters": [ "0x0019" ] } }, "manufacturer": "_TYZB01_mtunwanm", "model": "TS011F" }, "active_coordinator": false, "entities": [ { "entity_id": "switch.tyzb01_mtunwanm_ts011f_switch", "name": "_TYZB01_mtunwanm TS011F" }, { "entity_id": "switch.tyzb01_mtunwanm_ts011f_child_lock", "name": "_TYZB01_mtunwanm TS011F" } ], "neighbors": [ { "device_type": "Coordinator", "rx_on_when_idle": "On", "relationship": "Parent", "extended_pan_id": "REDACTED", "ieee": "REDACTED", "nwk": "0x0000", "permit_joining": "Unknown", "depth": "0", "lqi": "118" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "REDACTED", "ieee": "REDACTED", "nwk": "0xC337", "permit_joining": "Unknown", "depth": "15", "lqi": "47" } ], "routes": [ { "dest_nwk": "0x0000", "route_status": "Active", "memory_constrained": false, "many_to_one": false, "route_record_required": false, "next_hop": "0x0000" } ], "endpoint_names": [ { "name": "MAIN_POWER_OUTLET" } ], "user_given_name": null, "device_reg_id": "3fa1affbd813cda45994272b1d9b0253", "area_id": "dominic_bedroom", "cluster_details": { "1": { "device_type": { "name": "MAIN_POWER_OUTLET", "id": 9 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0001": { "attribute_name": "app_version", "value": 64 }, "0x0004": { "attribute_name": "manufacturer", "value": "_TYZB01_mtunwanm" }, "0x0005": { "attribute_name": "model", "value": "TS011F" } }, "unsupported_attributes": { "0x0014": { "attribute_name": "disable_local_config" } } }, "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x8001": { "attribute_name": "backlight_mode", "value": 1 }, "0x8000": { "attribute_name": "child_lock", "value": 1 }, "0x4002": { "attribute_name": "off_wait_time", "value": 0 }, "0x0000": { "attribute_name": "on_off", "value": 0 }, "0x4001": { "attribute_name": "on_time", "value": 0 }, "0x8002": { "attribute_name": "power_on_state", "value": 2 } }, "unsupported_attributes": { "0x8001": { "attribute_name": "backlight_mode" }, "0x4003": { "attribute_name": "start_up_on_off" }, "0x8004": { "attribute_name": "switch_mode" }, "0xfffe": { "attribute_name": "reporting_status" } } }, "0x000a": { "endpoint_attribute": "time", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} } } } } } }

github-actions[bot] commented 5 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.