Automation for battery_level low

Hi

I am trying to make automation when battery_level is low send me notification
but my trigger isn’t working

- alias: battery stat
  trigger:
    platform: numeric_state
    entity_id: binary_sensor.door_window_sensor_158d00023ee2e1
    value_template: "{{ state.attributes.battery_level }}"
    below: 42

can you please tell me what i did wrong

Thanks .

You should test this in the template editor in the developer tools section. And read the templating documentation for some examples.

I think it should state something like

{{ states.binary_sensor.door_window_sensor_158d00023ee2e1.attributes.battery_level }}

You can combine multiple sensors into the same automation, like this:

https://github.com/joch/home-assistant-config/blob/master/automation/internal/batteries.yaml

Hello joch

Could you share your file again?
Or the solution?

Thank you

I would recommend the automatic creation of battery sensors using @NotoriousBDG’s package.

I would also recommend moving to https://github.com/notoriousbdg/Home-AssistantConfig/blob/master/packages/battery_alert.yaml (I did as well, however some work remaining to migrate these things to Lovelace).

Thank you!
I’ll give it a try

1 Like

Here’s the discussion thread as well: Howto create battery alert without creating a template for every device

1 Like