this post was submitted on 02 Mar 2024
7 points (100.0% liked)

homeassistant

11890 readers
53 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS
 

I have some sensors like this one:


  - name: "Sala"
    unique_id: "temp_sala"
    state_topic: "zigbee2mqtt/temp_sala"
    value_template: "{{ value_json.temperature }}"
    unit_of_measurement: "°C"

Those sensors publish the battery status too, how can I add it? Thanks!

you are viewing a single comment's thread
view the rest of the comments
[–] klangcola@reddthat.com 1 points 7 months ago

One way is to make a new "entity", that's not actually linked to your previous temperature sensor. I'm not familiar with how to tie them together in a "device" like how ZigBee2mqtt auto discovery does.

So just add a new "sensor"/"entity"

  - name: "Sala_battery"
    unique_id: "temp_sala_battery"
    state_topic: "zigbee2mqtt/temp_sala"
    value_template: "{{ value_json.battery }}"
    unit_of_measurement: "%"

Use MQTT Explorer to listen to your ZigBee2mqtt broker topic "zigbee2mqtt/temp_sala" to get the exact field name (battery, battery_state or some such)