Skip to content

zigbee-window-treatment: IKEA blinds report BatteryPercentageRemaining as 0–100, but driver halves it (battery shows ~50%) #2679

@ldeora

Description

@ldeora

Summary

When using the stock SmartThings zigbee-window-treatment Edge driver, IKEA blinds show a battery percentage that is exactly cut in half (e.g., a freshly charged battery shows ~50% instead of ~100%). Switching to Mariano’s community driver shows the correct battery percentage.

This makes the built-in driver feel “partially supported” for IKEA blinds, even though they are now matched by the stock driver.

Affected devices

  • Manufacturer: IKEA of Sweden
  • Device: IKEA smart blinds / window treatments (e.g., FYRTUR/KADRILJ/TREDANSEN)

Steps to reproduce

  1. Pair an IKEA blind to a SmartThings hub.
  2. Assign it to the stock driver: SmartThings / zigbee-window-treatment (default/official driver).
  3. Fully charge the IKEA battery pack and reinsert it (or otherwise ensure the blind reports a “full” battery).
  4. Check the battery percentage in the SmartThings app.

Actual behavior

Battery is displayed at ~50% when it should be ~100% (i.e., it appears halved).

Expected behavior

Battery is displayed correctly (e.g., ~100% after a full charge).

Analysis / likely root cause

Zigbee PowerConfiguration -> BatteryPercentageRemaining (0x0001 / 0x0021) is commonly interpreted as 0.5% units (0–200), so many handlers divide by 2 to convert to 0–100%.

However, IKEA blinds appear to report BatteryPercentageRemaining already in 1% units (0–100). If the handler divides by 2 anyway, the displayed value becomes half of the real percentage.

The stock driver currently registers default handlers (including Battery) without an IKEA-specific exception:

Mariano’s driver fixes this by skipping the divide-by-2 for IKEA:

local function battery_perc_attr_handler(driver, device, value, zb_rx)
  if device:get_manufacturer() ~= "IKEA of Sweden" then
    value.value = math.floor(value.value / 2.0 + 0.5)
  end
  device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value,
    capabilities.battery.battery(value.value))
end

Source

Mariano’s IKEA subdriver (reference implementation):

https://github.com/Mariano-Github/Edge-Drivers-Beta/blob/7e27b19016354ecb640e73cc69dc70ea6f71117f/zigbee-window-treatment/src/IKEA/init.lua#L82-L87

Proposed fix

Add IKEA-specific battery handling in the stock zigbee-window-treatment driver, for example:

  • Add a small IKEA subdriver that overrides the attribute handler for:
    • PowerConfiguration.attributes.BatteryPercentageRemaining
  • For device:get_manufacturer() == "IKEA of Sweden", treat value.value as already 0–100 and do not halve it (still clamp to 0–100).
  • Keep the existing/default behavior for other manufacturers/devices.
  • Alternative approach: implement a manufacturer/model exception directly in the driver’s battery handling, but a subdriver keeps the logic isolated and consistent with other vendor quirks.

Related discussion

SmartThings Community thread:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions