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
752 stars 693 forks source link

[Device Support Request] smarthjemmet.dk QUAD-ZIG-SW #2846

Open MTrab opened 10 months ago

MTrab commented 10 months ago

Problem description

Tried generating a quirk using https://github.com/zigpy/quirk-generator but the device is still matched to zigpy.device.Device after being added again.

Solution description

Correct matching of the device

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=64447, maximum_buffer_size=80, maximum_incoming_transfer_size=160, server_mask=0, maximum_outgoing_transfer_size=160, descriptor_capability_field=, *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": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0000", "0x0001", "0x0007" ], "output_clusters": [ "0x0000", "0x0001", "0x0012" ] }, "2": { "profile_id": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0007" ], "output_clusters": [ "0x0012" ] }, "3": { "profile_id": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0007" ], "output_clusters": [ "0x0012" ] }, "4": { "profile_id": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0007" ], "output_clusters": [ "0x0012" ] }, "5": { "profile_id": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0007" ], "output_clusters": [ "0x0012" ] } }, "manufacturer": "smarthjemmet.dk", "model": "QUAD-ZIG-SW", "class": "zigpy.device.Device" } ```

Diagnostic information

Diagnostic information ```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.12.3", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.6", "docker": true, "arch": "aarch64", "timezone": "Europe/Copenhagen", "os_name": "Linux", "os_version": "6.1.63-haos", "supervisor": "2023.11.6", "host_os": "Home Assistant OS 11.2", "docker_version": "24.0.7", "chassis": "embedded", "run_as_root": true }, "custom_components": { "adaptive_lighting": { "version": "1.20.0", "requirements": [ "ulid-transform" ] }, "landroid_cloud": { "version": "4.0.0", "requirements": [ "pyworxcloud==4.1.7" ] }, "sonos_cloud": { "version": "0.3.5", "requirements": [] }, "fuelprices_dk": { "version": "1.6", "requirements": [ "beautifulsoup4", "html.parser" ] }, "moonraker": { "version": "1.1.0", "requirements": [ "moonraker-api==2.0.5" ] }, "magicmirror": { "version": "1.3.0", "requirements": [] }, "ical": { "version": "1.6.7", "requirements": [ "icalendar==5.0.7" ] }, "ics_calendar": { "version": "4.1.0", "requirements": [ "ics>=0.7.2", "recurring_ical_events>=2.0.2", "icalendar>=5.0.4" ] }, "proxmoxve": { "version": "3.2.2", "requirements": [ "proxmoxer==2.0.1" ] }, "androidtv": { "version": "14.01", "requirements": [ "adb-shell[async]==0.4.0", "androidtv[async]==0.0.60", "pure-python-adb[async]==0.3.0.dev0" ] }, "npm_switches": { "version": "1.0.2", "requirements": [] }, "unifigateway": { "version": "0.3.3", "requirements": [ "pyunifi==2.21" ] }, "scheduler": { "version": "v0.0.0", "requirements": [] }, "twitch_helix": { "version": "1.0.0", "requirements": [ "twitchAPI==3.10.0" ] }, "webastoconnect": { "version": "0.1.1", "requirements": [ "pywebasto==0.1.0" ] }, "dash_cast": { "version": "1.0.0", "requirements": [] }, "my_unifi": { "version": "0.1.5", "requirements": [] }, "greentel": { "version": "0.1", "requirements": [ "beautifulsoup4", "html.parser" ] }, "localtuya": { "version": "5.2.1", "requirements": [] }, "generic_hygrostat": { "version": "0.8.0", "requirements": [] }, "energidataservice": { "version": "1.4.3", "requirements": [ "async-retrying-ng==0.1.3", "CurrencyConverter==0.17.13" ] }, "tuya_local": { "version": "2023.12.1", "requirements": [ "tinytuya==1.13.1" ] }, "powercalc": { "version": "v1.9.10", "requirements": [ "numpy>=1.21.1" ] }, "places": { "version": "v2.6.0", "requirements": [] }, "browser_mod": { "version": "2.3.0", "requirements": [] }, "hacs": { "version": "1.33.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "frigate": { "version": "4.0.0", "requirements": [ "pytz==2022.7" ] }, "google_home": { "version": "1.10.2", "requirements": [ "glocaltokens==0.7.0" ] }, "watchman": { "version": "0.5.1", "requirements": [ "prettytable==3.0.0" ] }, "var": { "version": "0.15.0", "requirements": [] }, "pyscript": { "version": "1.5.0", "requirements": [ "croniter==1.3.8", "watchdog==2.3.1" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly", "@TheJulianJES" ], "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.37.3", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.107", "zigpy-deconz==0.22.2", "zigpy==0.60.1", "zigpy-xbee==0.20.1", "zigpy-zigate==0.12.0", "zigpy-znp==0.12.0", "universal-silabs-flasher==0.0.15", "pyserial-asyncio-fast==0.11" ], "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": "0403", "pid": "6015", "description": "*conbee*", "known_devices": [ "Conbee III" ] }, { "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": 8813, "manufacturer": "smarthjemmet.dk", "model": "QUAD-ZIG-SW", "name": "smarthjemmet.dk QUAD-ZIG-SW", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "quirk_id": null, "manufacturer_code": 64447, "power_source": "Battery or Unknown", "lqi": 255, "rssi": -36, "last_seen": "2023-12-18T16:28:30", "available": true, "device_type": "EndDevice", "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=64447, maximum_buffer_size=80, maximum_incoming_transfer_size=160, server_mask=0, maximum_outgoing_transfer_size=160, descriptor_capability_field=, *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": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0000", "0x0001", "0x0007" ], "output_clusters": [ "0x0000", "0x0001", "0x0012" ] }, "2": { "profile_id": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0007" ], "output_clusters": [ "0x0012" ] }, "3": { "profile_id": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0007" ], "output_clusters": [ "0x0012" ] }, "4": { "profile_id": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0007" ], "output_clusters": [ "0x0012" ] }, "5": { "profile_id": "0x0104", "device_type": "0xfffe", "input_clusters": [ "0x0007" ], "output_clusters": [ "0x0012" ] } }, "manufacturer": "smarthjemmet.dk", "model": "QUAD-ZIG-SW" }, "active_coordinator": false, "entities": [ { "entity_id": "sensor.smarthjemmet_dk_quad_zig_sw_batteri", "name": "smarthjemmet.dk QUAD-ZIG-SW" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "undefined_0xfffe" }, { "name": "undefined_0xfffe" }, { "name": "undefined_0xfffe" }, { "name": "undefined_0xfffe" }, { "name": "undefined_0xfffe" } ], "user_given_name": null, "device_reg_id": "063cf0fafbe61d612e4ddff1a5dacb32", "area_id": null, "cluster_details": { "1": { "device_type": { "name": "undefined_0xfffe", "id": 65534 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "smarthjemmet.dk" }, "0x0005": { "attribute_name": "model", "value": "QUAD-ZIG-SW" } }, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 56 }, "0x0020": { "attribute_name": "battery_voltage", "value": 28 } }, "unsupported_attributes": { "0x0031": { "attribute_name": "battery_size" }, "0x0033": { "attribute_name": "battery_quantity" } } }, "0x0007": { "endpoint_attribute": "on_off_config", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": {}, "unsupported_attributes": {} }, "0x0012": { "endpoint_attribute": "multistate_input", "attributes": {}, "unsupported_attributes": {} } } }, "2": { "device_type": { "name": "undefined_0xfffe", "id": 65534 }, "profile_id": 260, "in_clusters": { "0x0007": { "endpoint_attribute": "on_off_config", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0012": { "endpoint_attribute": "multistate_input", "attributes": {}, "unsupported_attributes": {} } } }, "3": { "device_type": { "name": "undefined_0xfffe", "id": 65534 }, "profile_id": 260, "in_clusters": { "0x0007": { "endpoint_attribute": "on_off_config", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0012": { "endpoint_attribute": "multistate_input", "attributes": {}, "unsupported_attributes": {} } } }, "4": { "device_type": { "name": "undefined_0xfffe", "id": 65534 }, "profile_id": 260, "in_clusters": { "0x0007": { "endpoint_attribute": "on_off_config", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0012": { "endpoint_attribute": "multistate_input", "attributes": { "0x0055": { "attribute_name": "present_value", "value": 1.0 } }, "unsupported_attributes": {} } } }, "5": { "device_type": { "name": "undefined_0xfffe", "id": 65534 }, "profile_id": 260, "in_clusters": { "0x0007": { "endpoint_attribute": "on_off_config", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0012": { "endpoint_attribute": "multistate_input", "attributes": {}, "unsupported_attributes": {} } } } } } } ```

Logs

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

Custom quirk

Custom quirk ```python """Quirk for smarthjemmet.dk QUAD-ZIG-SW.""" from zigpy.profiles import zha from zigpy.quirks import CustomDevice from zigpy.zcl.clusters.general import ( Basic, MultistateInput, OnOffConfiguration, PowerConfiguration, ) from zhaquirks.const import ( DEVICE_TYPE, ENDPOINTS, INPUT_CLUSTERS, MODELS_INFO, OUTPUT_CLUSTERS, PROFILE_ID, ) class SmarthjemmetDkQuadZigSw(CustomDevice): """Smarthjemmet.Dk QUAD-ZIG-SW custom device implementation.""" signature = { MODELS_INFO: [("smarthjemmet.dk", "QUAD-ZIG-SW")], ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, MultistateInput.cluster_id, ], }, 2: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ MultistateInput.cluster_id, ], }, 3: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ MultistateInput.cluster_id, ], }, 4: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ MultistateInput.cluster_id, ], }, 5: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ MultistateInput.cluster_id, ], }, }, } replacement = { ENDPOINTS: { 1: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ Basic.cluster_id, PowerConfiguration.cluster_id, MultistateInput.cluster_id, ], }, 2: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ MultistateInput.cluster_id, ], }, 3: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ MultistateInput.cluster_id, ], }, 4: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ MultistateInput.cluster_id, ], }, 5: { PROFILE_ID: zha.PROFILE_ID, DEVICE_TYPE: zha.DeviceType.ON_OFF_SWITCH, INPUT_CLUSTERS: [ OnOffConfiguration.cluster_id, ], OUTPUT_CLUSTERS: [ MultistateInput.cluster_id, ], }, }, } ```

Additional information

@TheJulianJES as requested :)

TheJulianJES commented 10 months ago

How did you "install" the custom quirk?

MTrab commented 10 months ago

Same as the other few quirks I have installed - put the file in /config/custom_zha_quirks/ and have the following in my configuration file

zha:
  custom_quirks_path: /config/custom_zha_quirks/

Works like a charm for the other custom_quirks, just not this one.

TheJulianJES commented 10 months ago

Hmm, try enabling ZHA debug logs, then restart HA. The logs should contain more information on why zigpy doesn't match that quirk. Also, check that Loaded custom quirks. Please contribute them to [...] is present in the logs.

MTrab commented 10 months ago

I have a pretty huge setup, so enabling logs as stated in the docs is just absolutely FLOODING my logs, making it impossible to differentiate this single device.

Anything in particular I can use as search phrase?

TheJulianJES commented 10 months ago

Try just searching for QUAD-ZIG-SW

github-actions[bot] commented 4 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.

bangert commented 2 weeks ago

i am new to zha but would like to see support for this device. @MTrab did you get it to work at some point?

could you share the quirks file that didnt work?

Thanks

TheJulianJES commented 2 weeks ago

Check: