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
686 stars 637 forks source link

[Device Support Request] Add IKEA Fyrtur roller blind remaining battery status #3161

Open Eriond opened 1 month ago

Eriond commented 1 month ago

Problem description

The IKEA Fyrtur roller blind uses a rechargable battery for which you may ask remaining charge percentage in the DoublingPowerConfigClusterIKEA (Endpoint id: 1, Id: 0x0001, Type: in), using the attribute battery_percentage_remaining (id: 0x0021) The current implementation seems to omit this information, because the reported battery level is always 0% in HA frontend/UI.

Solution description

The current value that is read back, seem to be the percentage expressed in 0.5 percent steps, ie. doubled. The attached screenshot shows a recently charged battery. It may also be so that the percentage is expressed in a 0-255 / byte-wide manner, but this has not been verified.

Screenshots/Video

Fyrtur zigbee details

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=4476, 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=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": "0x0202", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0004", "0x0005", "0x0020", "0x0102", "0x1000", "0xfc7c" ], "output_clusters": [ "0x0019", "0x1000" ] } }, "manufacturer": "IKEA of Sweden", "model": "FYRTUR block-out roller blind", "class": "zhaquirks.ikea.blinds.IkeaTradfriRollerBlinds2" } ```

Diagnostic information

Diagnostic information ```json [Paste the diagnostic information here] ```

Logs

Logs ```python { "home_assistant": { "installation_type": "Home Assistant OS", "version": "2024.5.4", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.12.2", "docker": true, "arch": "aarch64", "timezone": "Europe/Stockholm", "os_name": "Linux", "os_version": "6.6.28-haos-raspi", "supervisor": "2024.05.1", "host_os": "Home Assistant OS 12.3", "docker_version": "25.0.5", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "documentation": "https://hacs.xyz/docs/configuration/start", "version": "1.34.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "pijuice": { "documentation": "https://github.com/Racailloux/home-assistant-pijuice/", "version": "1.2.5", "requirements": [ "smbus2==0.4.1" ] }, "ebeco": { "documentation": "https://github.com/joggs/home_assistant_ebeco", "version": "0.4.0", "requirements": [] }, "zha_toolkit": { "documentation": "https://github.com/mdeweerd/zha-toolkit", "version": "v1.1.10", "requirements": [ "pytz" ] } }, "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.38.4", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.115", "zigpy-deconz==0.23.1", "zigpy==0.64.0", "zigpy-xbee==0.20.1", "zigpy-zigate==0.12.0", "zigpy-znp==0.12.1", "universal-silabs-flasher==0.0.18", "pyserial-asyncio-fast==0.11" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "*2652*", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "10C4", "pid": "EA60", "description": "*slzb-07*", "known_devices": [ "smlight slzb-07" ] }, { "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": 64546, "manufacturer": "IKEA of Sweden", "model": "FYRTUR block-out roller blind", "name": "IKEA of Sweden FYRTUR block-out roller blind", "quirk_applied": true, "quirk_class": "zhaquirks.ikea.blinds.IkeaTradfriRollerBlinds2", "quirk_id": null, "manufacturer_code": 4476, "power_source": "Battery or Unknown", "lqi": 200, "rssi": -50, "last_seen": "2024-05-21T00:01:00", "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=4476, 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=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": "0x0202", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0004", "0x0005", "0x0020", "0x0102", "0x1000", "0xfc7c" ], "output_clusters": [ "0x0019", "0x1000" ] } }, "manufacturer": "IKEA of Sweden", "model": "FYRTUR block-out roller blind" }, "active_coordinator": false, "entities": [ { "entity_id": "button.fyrtur_roller_blind_sovrum_identify", "name": "IKEA of Sweden FYRTUR block-out roller blind" }, { "entity_id": "cover.fyrtur_roller_blind_sovrum_cover", "name": "IKEA of Sweden FYRTUR block-out roller blind" }, { "entity_id": "sensor.fyrtur_roller_blind_sovrum_battery", "name": "IKEA of Sweden FYRTUR block-out roller blind" }, { "entity_id": "sensor.fyrtur_roller_blind_sovrum_window_covering_type", "name": "IKEA of Sweden FYRTUR block-out roller blind" }, { "entity_id": "switch.fyrtur_roller_blind_sovrum_inverted", "name": "IKEA of Sweden FYRTUR block-out roller blind" }, { "entity_id": "update.fyrtur_roller_blind_sovrum_firmware", "name": "IKEA of Sweden FYRTUR block-out roller blind" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "WINDOW_COVERING_DEVICE" } ], "user_given_name": "FYRTUR roller blind sovrum", "device_reg_id": "a1aeb63e801ef7ac6fde8d4b0aca13db", "area_id": "sovrum", "cluster_details": { "1": { "device_type": { "name": "WINDOW_COVERING_DEVICE", "id": 514 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "IKEA of Sweden" }, "0x0005": { "attribute_name": "model", "value": "FYRTUR block-out roller blind" }, "0x0007": { "attribute_name": "power_source", "value": 3 }, "0x4000": { "attribute_name": "sw_build_id", "value": "2.2.009" } }, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 388 }, "0x0020": { "attribute_name": "battery_voltage", "value": 82 } }, "unsupported_attributes": { "0x0031": { "attribute_name": "battery_size" }, "0x0061": { "attribute_name": "battery_3_percentage_remaining" }, "0x0033": { "attribute_name": "battery_quantity" } } }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0004": { "endpoint_attribute": "groups", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0020": { "endpoint_attribute": "poll_control", "attributes": { "0x0000": { "attribute_name": "checkin_interval", "value": 13200 } }, "unsupported_attributes": {} }, "0x0102": { "endpoint_attribute": "window_covering", "attributes": { "0x0007": { "attribute_name": "config_status", "value": 3 }, "0x0008": { "attribute_name": "current_position_lift_percentage", "value": 0 }, "0x0011": { "attribute_name": "installed_closed_limit_lift", "value": 65535 }, "0x0013": { "attribute_name": "installed_closed_limit_tilt", "value": 65535 }, "0x0010": { "attribute_name": "installed_open_limit_lift", "value": 0 }, "0x0012": { "attribute_name": "installed_open_limit_tilt", "value": 0 }, "0x0017": { "attribute_name": "window_covering_mode", "value": 0 }, "0x0000": { "attribute_name": "window_covering_type", "value": 0 } }, "unsupported_attributes": { "0x0009": { "attribute_name": "current_position_tilt_percentage" } } }, "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} }, "0xfc7c": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0019": { "endpoint_attribute": "ota", "attributes": { "0x0002": { "attribute_name": "current_file_version", "value": 604241939 } }, "unsupported_attributes": {} }, "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} } } } } } } ```

Custom quirk

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

Additional information

No response

Eriond commented 1 month ago

So, here's an interesting fact: After finding the relevant attribute, playing around a bit in the "Manage zigbee device" settings, and finally writing this issue, somehow I got a new sensor in the "Diagnostic" list: Battery 194% Previously, there were only the "Identify" and "Window covering type" items, and now I have miraculously gotten a third, much sought after, battery sensor! For those that may think I have bad vision, I have attached a screenshot of the history diagram.

Fyrtur battery history

Perhaps the issue can be renamed as "Correct the reported battery value" ? For now, I have made a helper using a template sensor to circumvent the issue: {{ (states('sensor.fyrtur_roller_blind_sovrum_battery') | int)/2 }}

MattWestb commented 1 month ago

What is the firmware version the blinds running (diag is showing 2.2.009) ? The factory is 2.3.X but the last production is 24.4.13 and after doing update you need deleting the device and waiting one minute and adding it agen so its not using the old cashed settings (then its not using any quirk) and shall working OK then IKEA have fixing the old battery problem issue. Was doing all yesterday with 3 new ones and its working great.

MattWestb commented 1 month ago

IKRA-Blind01

Eriond commented 1 month ago

Thank you for your comment. I don't know how to see the firmware update history/logs, but these are the current values:

Fyrtur firmware

In my configuration, I have

zha:
  zigpy_config:
    ota:
      ikea_provider: true

so it is possible that while I was fiddling with the various Zigbee clusters and attributes yesterday, it triggered an automated firmware update in the background, and voila... Still odd that I have the doubled battery percentage though? Or will that be resolved if I remove and then re-add the device after a couple of minutes?

MattWestb commented 1 month ago

The device have updating OK but its using the old cashed endpoints / cluster setting so loading the quirk for the old firmware (last line in the device info is showing the quirk in use).

You need deleting the device wait one minute (or restarting HA) and then pairing it and it shall being done as new (its loosing the name it was having) and shall working OK.

Edit: My blinds is second gen ones but all is running the same firmware only different hardware settings so is working the same way.