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
743 stars 679 forks source link

[BUG] Power delivery summation sensor not updated on Ubisys S1 switch #2192

Closed freakyjoe8 closed 1 year ago

freakyjoe8 commented 1 year ago

Describe the bug The power summation in kWh is not update for the Ubisys S1 switch (https://www.ubisys.de/en/products/light-and-consumers/power-switch-s1/). It is only updated on reboot. Firmware is the newest one available (ubisys S1 Firmware Version 2.1.2, ubisys Zigbee Stack 4.0.4 (Hardware Revision >= 2).

To Reproduce Steps to reproduce the behavior:

  1. read current summation sensor value in Home Assistant / ZHA
  2. Open device
  3. Open sensor and read summation value

Expected behavior The summation should constantly increase based on the current summation of kWh used.

Screenshots

Selection_020

```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=4338, maximum_buffer_size=127, 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": 260, "device_type": "0x010a", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006" ], "out_clusters": [] }, "2": { "profile_id": 260, "device_type": "0x0001", "in_clusters": [ "0x0000", "0x0003" ], "out_clusters": [ "0x0005", "0x0006", "0x0008" ] }, "3": { "profile_id": 260, "device_type": "0x0501", "in_clusters": [ "0x0000", "0x0702", "0x0b04" ], "out_clusters": [] }, "232": { "profile_id": 260, "device_type": "0x0507", "in_clusters": [ "0x0000", "0x0015", "0xfc00" ], "out_clusters": [ "0x0003", "0x0019" ] }, "242": { "profile_id": 41440, "device_type": "0x0066", "in_clusters": [ "0x0021" ], "out_clusters": [ "0x0021" ] } }, "manufacturer": "ubisys", "model": "S1 (5501)", "class": "zigpy.device.Device" } ```
```json { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.2.2", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.10.7", "docker": true, "arch": "aarch64", "timezone": "Europe/Berlin", "os_name": "Linux", "os_version": "5.15.84-v8", "supervisor": "2023.01.1", "host_os": "Home Assistant OS 9.5", "docker_version": "20.10.22", "chassis": "embedded", "run_as_root": true }, "custom_components": { "auto_backup": { "version": "1.3.0", "requirements": [] }, "xiaomi_cloud_map_extractor": { "version": "v2.2.0", "requirements": [ "pillow", "pybase64", "python-miio", "requests", "pycryptodome" ] }, "ui_lovelace_minimalist": { "version": "v1.1.6-hotfix", "requirements": [ "aiofiles==0.8.0", "aiogithubapi>=22.2.4" ] }, "frigate": { "version": "3.0.0", "requirements": [] }, "hacs": { "version": "1.28.3", "requirements": [ "aiogithubapi>=22.2.4" ] }, "thermal_comfort": { "version": "1.5.3", "requirements": [] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/zha", "requirements": [ "bellows==0.34.7", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.92", "zigpy-deconz==0.19.2", "zigpy==0.53.0", "zigpy-xbee==0.16.2", "zigpy-zigate==0.10.3", "zigpy-znp==0.9.2" ], "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" ] } ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly" ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube*" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "*zigate*" }, { "type": "_zigstar_gw._tcp.local.", "name": "*zigstar*" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "dependencies": [ "file_upload" ], "after_dependencies": [ "onboarding", "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": 25969, "manufacturer": "ubisys", "model": "S1 (5501)", "name": "ubisys S1 (5501)", "quirk_applied": false, "quirk_class": "zigpy.device.Device", "manufacturer_code": 4338, "power_source": "Mains", "lqi": 40, "rssi": null, "last_seen": "2023-02-13T20:20:03", "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=4338, maximum_buffer_size=127, 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": 260, "device_type": "0x010a", "in_clusters": [ "0x0000", "0x0003", "0x0004", "0x0005", "0x0006" ], "out_clusters": [] }, "2": { "profile_id": 260, "device_type": "0x0001", "in_clusters": [ "0x0000", "0x0003" ], "out_clusters": [ "0x0005", "0x0006", "0x0008" ] }, "3": { "profile_id": 260, "device_type": "0x0501", "in_clusters": [ "0x0000", "0x0702", "0x0b04" ], "out_clusters": [] }, "232": { "profile_id": 260, "device_type": "0x0507", "in_clusters": [ "0x0000", "0x0015", "0xfc00" ], "out_clusters": [ "0x0003", "0x0019" ] }, "242": { "profile_id": 41440, "device_type": "0x0066", "in_clusters": [ "0x0021" ], "out_clusters": [ "0x0021" ] } } }, "active_coordinator": false, "entities": [ { "entity_id": "button.ubisys_s1_5501_identify", "name": "ubisys S1 (5501)" }, { "entity_id": "sensor.steckdose_quooker_active_power", "name": "ubisys S1 (5501)" }, { "entity_id": "sensor.steckdose_quooker_apparent_power", "name": "ubisys S1 (5501)" }, { "entity_id": "sensor.steckdose_quooker_rms_current", "name": "ubisys S1 (5501)" }, { "entity_id": "sensor.steckdose_quooker_rms_voltage", "name": "ubisys S1 (5501)" }, { "entity_id": "sensor.steckdose_quooker_ac_frequency", "name": "ubisys S1 (5501)" }, { "entity_id": "sensor.steckdose_quooker_power_factor", "name": "ubisys S1 (5501)" }, { "entity_id": "sensor.steckdose_quooker_instantaneous_demand", "name": "ubisys S1 (5501)" }, { "entity_id": "sensor.steckdose_quooker_summation_delivered", "name": "ubisys S1 (5501)" }, { "entity_id": "switch.steckdose_quooker_switch", "name": "ubisys S1 (5501)" }, { "entity_id": "select.steckdose_quooker_start_up_behavior", "name": "ubisys S1 (5501)" } ], "neighbors": [ { "device_type": "Coordinator", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x0000", "permit_joining": "Unknown", "depth": "255", "lqi": "164" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x09DF", "permit_joining": "Unknown", "depth": "255", "lqi": "193" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x30B6", "permit_joining": "Unknown", "depth": "255", "lqi": "125" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x466A", "permit_joining": "Unknown", "depth": "255", "lqi": "132" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x5123", "permit_joining": "Unknown", "depth": "255", "lqi": "139" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x6F92", "permit_joining": "Unknown", "depth": "255", "lqi": "134" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0x7389", "permit_joining": "Unknown", "depth": "255", "lqi": "190" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xB2FF", "permit_joining": "Unknown", "depth": "255", "lqi": "180" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xCAC3", "permit_joining": "Unknown", "depth": "255", "lqi": "173" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xCFA5", "permit_joining": "Unknown", "depth": "255", "lqi": "234" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xD556", "permit_joining": "Unknown", "depth": "255", "lqi": "197" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xE56D", "permit_joining": "Unknown", "depth": "255", "lqi": "164" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xF4CF", "permit_joining": "Unknown", "depth": "255", "lqi": "140" }, { "device_type": "Router", "rx_on_when_idle": "On", "relationship": "Sibling", "extended_pan_id": "**REDACTED**", "ieee": "**REDACTED**", "nwk": "0xF4D6", "permit_joining": "Unknown", "depth": "255", "lqi": "139" } ], "routes": [], "endpoint_names": [ { "name": "ON_OFF_PLUG_IN_UNIT" }, { "name": "LEVEL_CONTROL_SWITCH" }, { "name": "undefined_0x0501" }, { "name": "undefined_0x0507" }, { "name": "unknown 102 device_type of 0xa1e0 profile id" } ], "user_given_name": "Steckdose Quooker ", "device_reg_id": "745663e5b4809cdb2f3d5e8170bc54a7", "area_id": "kuche", "cluster_details": { "1": { "device_type": { "name": "ON_OFF_PLUG_IN_UNIT", "id": 266 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0001": { "attribute_name": "app_version", "value": 1 }, "0x0003": { "attribute_name": "hw_version", "value": 6 }, "0x0004": { "attribute_name": "manufacturer", "value": "ubisys" }, "0x0005": { "attribute_name": "model", "value": "S1 (5501)" }, "0x000a": { "attribute_name": "product_code", "value": { "__type": "", "repr": "b'\\x010665960921248'" } }, "0x4000": { "attribute_name": "sw_build_id", "value": "1.9.2" }, "0xfffd": { "attribute_name": "cluster_revision", "value": 3 } }, "unsupported_attributes": { "0x0012": { "attribute_name": "device_enabled" } } }, "0x0003": { "endpoint_attribute": "identify", "attributes": { "0xfffd": { "attribute_name": "cluster_revision", "value": 2 } }, "unsupported_attributes": { "0xfffe": { "attribute_name": "attr_reporting_status" } } }, "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": { "0x0000": { "attribute_name": "on_off", "value": 1 }, "0x4003": { "attribute_name": "start_up_on_off", "value": 255 } }, "unsupported_attributes": {} } }, "out_clusters": {} }, "2": { "device_type": { "name": "LEVEL_CONTROL_SWITCH", "id": 1 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": {}, "unsupported_attributes": {} }, "0x0008": { "endpoint_attribute": "level", "attributes": {}, "unsupported_attributes": {} } } }, "3": { "device_type": { "name": "undefined_0x0501", "id": 1281 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0x0702": { "endpoint_attribute": "smartenergy_metering", "attributes": { "0x0000": { "attribute_name": "current_summ_delivered", "value": 26 }, "0x0200": { "attribute_name": "status", "value": 0 }, "0x0300": { "attribute_name": "unit_of_measure", "value": 0 }, "0x0301": { "attribute_name": "multiplier", "value": 1 }, "0x0302": { "attribute_name": "divisor", "value": 1000 }, "0x0400": { "attribute_name": "instantaneous_demand", "value": 1 } }, "unsupported_attributes": { "0x0100": { "attribute_name": "current_tier1_summ_delivered" }, "0x0102": { "attribute_name": "current_tier2_summ_delivered" }, "0x0104": { "attribute_name": "current_tier3_summ_delivered" }, "0x0304": { "attribute_name": "demand_formatting" }, "0x0106": { "attribute_name": "current_tier4_summ_delivered" }, "0x0306": { "attribute_name": "metering_device_type" }, "0x0108": { "attribute_name": "current_tier5_summ_delivered" }, "0x010a": { "attribute_name": "current_tier6_summ_delivered" }, "0x0303": { "attribute_name": "summation_formatting" } } }, "0x0b04": { "endpoint_attribute": "electrical_measurement", "attributes": { "0x0000": { "attribute_name": "measurement_type", "value": 15 }, "0x0300": { "attribute_name": "ac_frequency", "value": 49644 }, "0x0505": { "attribute_name": "rms_voltage", "value": 235 }, "0x0508": { "attribute_name": "rms_current", "value": 10 }, "0x050b": { "attribute_name": "active_power", "value": 1 }, "0x050f": { "attribute_name": "apparent_power", "value": 2 } }, "unsupported_attributes": { "0x0600": { "attribute_name": "ac_voltage_multiplier" }, "0x0601": { "attribute_name": "ac_voltage_divisor" }, "0x0302": { "attribute_name": "ac_frequency_max" }, "0x0603": { "attribute_name": "ac_current_divisor" }, "0x0602": { "attribute_name": "ac_current_multiplier" }, "0x0605": { "attribute_name": "ac_power_divisor" }, "0x0604": { "attribute_name": "ac_power_multiplier" }, "0x0507": { "attribute_name": "rms_voltage_max" }, "0x0401": { "attribute_name": "ac_frequency_divisor" }, "0x0400": { "attribute_name": "ac_frequency_multiplier" }, "0x050a": { "attribute_name": "rms_current_max" }, "0x0403": { "attribute_name": "power_divisor" }, "0x050d": { "attribute_name": "active_power_max" }, "0x0402": { "attribute_name": "power_multiplier" } } } }, "out_clusters": {} }, "232": { "device_type": { "name": "undefined_0x0507", "id": 1287 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": {}, "unsupported_attributes": {} }, "0x0015": { "endpoint_attribute": "commissioning", "attributes": {}, "unsupported_attributes": {} }, "0xfc00": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} } } }, "242": { "device_type": { "name": "unknown", "id": 102 }, "profile_id": 41440, "in_clusters": { "0x0021": { "endpoint_attribute": "green_power", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0021": { "endpoint_attribute": "green_power", "attributes": {}, "unsupported_attributes": {} } } } } } } ```
Additional logs ``` Paste any additional debug logs here. Don't remove the extra line breaks outside the ``` marks. ```

Additional context Add any other context about the problem here.

TheJulianJES commented 1 year ago

Can you send a screenshot of the reconfiguration dialog? It looks like the device doesn't send attribute reports properly and ZHA would need to poll it.

freakyjoe8 commented 1 year ago

I've also written to Ubisys support and asked them if this is maybe a firmware bug. They replied no and they stated that they are following Zigbee standards here and sent me this screenshot:

Ubisys reply

Not sure what this means as I'm no Zigbee expert. But I'd also suspect this error to occur on their whole switch product line (S1, S1-R, S2, S2-R).

Screenshot of the reconfigure dialog

Selection_022

freakyjoe8 commented 1 year ago

I've worked around this now by polling the attribute manually every 5 minutes via ZHA toolkit and creating an automation. This is the service call if someone else also has this problem.

service: zha_toolkit.attr_read
data:
  ieee: 00:1f:ee:00:00:00:xx:xx
  endpoint: 3
  cluster: 1794
  attribute: 0
  use_cache: false
  state_attr: sensor.steckdose_quooker_summation_delivered
github-actions[bot] commented 1 year 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.