home-assistant: fix zigbee battery value_template override key #25

Merged
torjus merged 1 commits from fix-zigbee-battery-template into master 2026-02-05 23:56:45 +00:00
Owner

Summary

Fixes the zigbee battery value_template override for WSDCGQ12LM sensors that report battery: 0 due to a firmware quirk.

The original fix in c515a6b used homeassistant.sensor_battery.value_template but the correct key is homeassistant.battery.value_template - the override key must match the entity type in the MQTT discovery topic path (homeassistant/sensor/<device>/battery/config).

Changes

  • Changed sensor_batterybattery in the homeassistant override config for all three affected sensors

Test plan

  • Verified MQTT discovery message contains the new value_template:
    mosquitto_sub -h localhost -t 'homeassistant/sensor/0x54ef441000a547bd/battery/config' -C 1 | jq .value_template
    "{{ (((value_json.voltage | float) - 2100) / 9) | round(0) | int | min(100) | max(0) }}"
    
  • Wait for sensors to report (~30 min intervals) and verify battery shows calculated values (~62-74%)
## Summary Fixes the zigbee battery value_template override for WSDCGQ12LM sensors that report `battery: 0` due to a firmware quirk. The original fix in c515a6b used `homeassistant.sensor_battery.value_template` but the correct key is `homeassistant.battery.value_template` - the override key must match the entity type in the MQTT discovery topic path (`homeassistant/sensor/<device>/battery/config`). ## Changes - Changed `sensor_battery` → `battery` in the homeassistant override config for all three affected sensors ## Test plan - [x] Verified MQTT discovery message contains the new value_template: ``` mosquitto_sub -h localhost -t 'homeassistant/sensor/0x54ef441000a547bd/battery/config' -C 1 | jq .value_template "{{ (((value_json.voltage | float) - 2100) / 9) | round(0) | int | min(100) | max(0) }}" ``` - [ ] Wait for sensors to report (~30 min intervals) and verify battery shows calculated values (~62-74%)
torjus added 1 commit 2026-02-05 23:56:40 +00:00
home-assistant: fix zigbee battery value_template override key
Some checks failed
Run nix flake check / flake-check (push) Failing after 5m39s
Run nix flake check / flake-check (pull_request) Failing after 12m37s
506e93a5e2
The homeassistant override key should match the entity type in the
MQTT discovery topic path. For battery sensors, the topic is
homeassistant/sensor/<device>/battery/config, so the key should be
"battery" not "sensor_battery".

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
torjus merged commit 70661ac3d9 into master 2026-02-05 23:56:45 +00:00
torjus deleted branch fix-zigbee-battery-template 2026-02-05 23:56:46 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: torjus/nixos-servers#25