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] STYRBAR REMOTE not showing battery percentage #2988

Closed RSZEE closed 1 month ago

RSZEE commented 8 months ago

Bug description

My STYRBAR remote has had issues recently with showing its battery percentage. When I first paired it it was showing, then it disconnected. When I repaired it it showed the battery percentage as 'Unknown'. It has been a few weeks and it still hasen't showed up. I have:

Steps to reproduce

Go to Devices -> ZHA -> STYRBAR REMOTE -> Battery

Expected behavior

To show the battery percentage.

Screenshots/Video

Screenshots/Video ![image](https://github.com/zigpy/zha-device-handlers/assets/152068050/de4b19f4-1586-45f6-8aa6-e70d38b2fcfa) ![image](https://github.com/zigpy/zha-device-handlers/assets/152068050/931c35f8-9bad-4b30-a7e2-8f2443c99846) ![image](https://github.com/zigpy/zha-device-handlers/assets/152068050/c622233d-8761-4781-9d90-233c4e2717e1)

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": "0x0820", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0020", "0x1000", "0xfc57", "0xfc7c" ], "output_clusters": [ "0x0003", "0x0005", "0x0006", "0x0008", "0x0019", "0x1000" ] } }, "manufacturer": "IKEA of Sweden", "model": "Remote Control N2", "class": "zhaquirks.ikea.fourbtnremote.IkeaTradfriRemoteV2" } ```

Diagnostic information

Diagnostic information ```json "data": { "ieee": "**REDACTED**", "nwk": 865, "manufacturer": "IKEA of Sweden", "model": "Remote Control N2", "name": "IKEA of Sweden Remote Control N2", "quirk_applied": true, "quirk_class": "zhaquirks.ikea.fourbtnremote.IkeaTradfriRemoteV2", "quirk_id": null, "manufacturer_code": 4476, "power_source": "Battery or Unknown", "lqi": 108, "rssi": null, "last_seen": "2024-02-17T14:08:37", "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": "0x0820", "input_clusters": [ "0x0000", "0x0001", "0x0003", "0x0020", "0x1000", "0xfc57", "0xfc7c" ], "output_clusters": [ "0x0003", "0x0005", "0x0006", "0x0008", "0x0019", "0x1000" ] } }, "manufacturer": "IKEA of Sweden", "model": "Remote Control N2" }, "active_coordinator": false, "entities": [ { "entity_id": "button.STYRBAR REMOTE_identify", "name": "IKEA of Sweden Remote Control N2" }, { "entity_id": "sensor.STYRBAR REMOTE_battery", "name": "IKEA of Sweden Remote Control N2" }, { "entity_id": "update.STYRBAR REMOTE_firmware", "name": "IKEA of Sweden Remote Control N2" } ], "neighbors": [], "routes": [], "endpoint_names": [ { "name": "NON_COLOR_CONTROLLER" } ], "user_given_name": "STYRBAR REMOTE", "device_reg_id": "93b12a1909e0b7bb16b910fe981acea5", "area_id": "bedroom", "cluster_details": { "1": { "device_type": { "name": "NON_COLOR_CONTROLLER", "id": 2080 }, "profile_id": 260, "in_clusters": { "0x0000": { "endpoint_attribute": "basic", "attributes": { "0x0004": { "attribute_name": "manufacturer", "value": "IKEA of Sweden" }, "0x0005": { "attribute_name": "model", "value": "Remote Control N2" }, "0x4000": { "attribute_name": "sw_build_id", "value": "2.4.5" } }, "unsupported_attributes": {} }, "0x0001": { "endpoint_attribute": "power", "attributes": { "0x0021": { "attribute_name": "battery_percentage_remaining", "value": 255 }, "0x0020": { "attribute_name": "battery_voltage", "value": 255 } }, "unsupported_attributes": { "0x0034": { "attribute_name": "battery_rated_voltage" }, "0xfffe": { "attribute_name": "reporting_status" }, "0x0031": { "attribute_name": "battery_size" }, "0x0033": { "attribute_name": "battery_quantity" } } }, "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0020": { "endpoint_attribute": "poll_control", "attributes": { "0x0000": { "attribute_name": "checkin_interval", "value": 13200 } }, "unsupported_attributes": {} }, "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} }, "0xfc57": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} }, "0xfc7c": { "endpoint_attribute": "manufacturer_specific", "attributes": {}, "unsupported_attributes": {} } }, "out_clusters": { "0x0003": { "endpoint_attribute": "identify", "attributes": {}, "unsupported_attributes": {} }, "0x0005": { "endpoint_attribute": "scenes", "attributes": {}, "unsupported_attributes": {} }, "0x0006": { "endpoint_attribute": "on_off", "attributes": {}, "unsupported_attributes": {} }, "0x0008": { "endpoint_attribute": "level", "attributes": {}, "unsupported_attributes": {} }, "0x0019": { "endpoint_attribute": "ota", "attributes": {}, "unsupported_attributes": {} }, "0x1000": { "endpoint_attribute": "lightlink", "attributes": {}, "unsupported_attributes": {} } } } } } ```

Logs

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

Additional information

Started after repairing.

cjcfreitas commented 8 months ago

I have two of these devices. None shows the battery level (and, I think, they never did). Reports "unknown". However, the Rodret device (simpler two button Ikea remote) displays the battery level. Don't know if it's a bug or by design.

RSZEE commented 8 months ago

FIX FOUND

(May Work For You, Worked For Me)

  1. Press and Hold the device pairing button for 10s
  2. Remove 1 battery and do step 1
  3. Remove the second battery and do step 1
  4. Restart Home Assistant
  5. Temporarily Disable Debug Logging (If you have it on)
  6. Re Add The Device (4 Presses On The Pairing Button)
  7. Wait 5 minutes
  8. Go To Manage Device -> Attributes -> PowerConfiguration -> battery_remaining_percentage
  9. Wake the device via spam pressing one of the buttons
  10. Read the attribute
  11. Make sure the attribute is 200 or under
  12. Fixed
RSZEE commented 8 months ago

Remove From ZHA In Step 2 Used IKEA LADDA Rechargeable Batteries

RSZEE commented 8 months ago

Make sure you are Far away from a IKEA Light Bulb as it might connect to it instead.

RSZEE commented 8 months ago

image

RSZEE commented 8 months ago

On a different bug report the creator of the ZHA Quirks has said that there is an issue with the quirk.

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

miquelblanch commented 1 month ago

Hello,

I have the same bug on showing the battery percentage on the Styrbar Remote Control. I've tried the solution below:

https://github.com/zigpy/zha-device-handlers/issues/2988#issuecomment-1957458093

but I couldn't resolve it.

What do you mean by "Go To Manage Device -> Attributes -> PowerConfiguration -> battery_remaining_percentage"? am I able to modify the Attributes of the device? Are LADDA rechargeable batteries necessary? May you please explain the whole process?

Thanks in advance!!

MattWestb commented 1 month ago

If using alkaline battier they is 1.5 V and rechargeable is 1.2 V the remote is sending 255 = not valid / cutoff range reading and ZHA is showing not avable reading unit the battery is going down after some mounts.

miquelblanch commented 1 month ago

ok thanks for the response,... my problem is that doesn't work neither with normal batteries nor with LADDA rechargeables...

KipiKland commented 2 weeks ago

If using alkaline battier they is 1.5 V and rechargeable is 1.2 V the remote is sending 255 = not valid / cutoff range reading and ZHA is showing not avable reading unit the battery is going down after some mounts.

Correct, a full charged LADA battery will provide 1.35 volt max, that is around 100% charge, evrything over will trigger a NULL value on percentage on "battery" value

miquelblanch commented 2 weeks ago

Ok perfecte, thanks for the answer,... I'll use LADA battery.