Send notification when battery is low for HM device

Hello all,

Im pretty new to coding and Homeassistant. I found some topics about how to send notifications when the battery is low or complete 0, but as my knowledge about coding is limited i could not find a solution for my case.

As the topic mentioned, i want to get an notification on my devices when the state “battery low” ia triggered for binary_sensor.int0000004_low_bat. But i cant find the variable that i need to write into the “to” section. i tried true,false,low,normal, 0 and 1, but im complete clueless what to write in there to tell homeassistant the low battery status is triggered. Sorry in advance for any errors in the coding and in explaining :slight_smile: and big thanks if anybody can help.

alias: Battery
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.int0000004_low_bat
    id: ' binary_sensor.int0000004_low_bat'
    **to:** 
condition: []
action:
  - service: notify.mobile_app_iphone_von_margarethe
    data:
      message: Batterie leer
  - service: notify.mobile_app_iphone_von_timur
    data:
      message: Batterie leer
mode: single

Binary sensor states are always 'on' or 'off'. Note the quotes, they are important. You can check the state of a device in Developer Tools / States:

Open your Home Assistant instance and show your state developer tools.

FYI you can also edit the entity id of an entity to make it something human readable, e.g. binary_sensor.int0000004_low_batbinary_sensor.front_door_contact_low_bat

It is wise to do this before using the entity in automations, scripts and Lovelace, as editing the entity id will not update it tin these places.

There are a number of places you can do this, the Configuration / Entities list or the device page of the Integration.

1 Like

Hello Tom,

Thanks for the guidance. So ‘on’ would be the low battery state is triggered? I do the coding mostly over the UI of homeassistant, there is also an object field with different selections, it is nessecary to select one to get it working?