Struggling with Battery notification

I’ve created an automation to send a notification each time the battery level drops 1%, starting when any of my sensor batteries get to 5% battery level or below, but I’m struggling to find the best trigger.

I started with a trigger based on the battery level, to find that this will regularly vary 1% up or down, hence triggering too many times.
Then I created a statistics sensor with a value_min, thinking this will only trigger when the battery level drops to a new minimum value. Unfortunately this still seems to trigger the automation multiple times, which completely puzzles me. Why would the value_min statistics sensor trigger multiple times per day? (I can’t review the trace, because there are always multiple triggers before I find a chance to review)

I can’t be the only one that wants to be notified of low battery level and I’m also fine to settle for only 1 notification, instead of each 1% below 6%.

Below my statistics sensor as well as the automation:

- platform: statistics
  name: "Philips Hue Indoor Motion Sensor - Battery - 24h Min"
  entity_id: sensor.hue_indoor_motion_sensor_battery
  state_characteristic: value_min
  precision: 0
  max_age:
    hours: 240
alias: Notify - Sensor Battery
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.aqara_battery
    id: aqara
  - platform: state
    entity_id:
      - sensor.aqara_humidity
    for:
      hours: 1
    id: aqara
  - platform: state
    entity_id:
      - sensor.philips_hue_indoor_motion_sensor_battery_24h_min
    id: hue_indoor
  - platform: state
    entity_id: sensor.hue_outdoor_motion_sensor_battery_level
    id: hue_outdoor
  - platform: state
    entity_id:
      - sensor.water_lekkage_battery
    id: water_lek_flips
action:
  - choose:
      - conditions:
          - condition: trigger
            id: aqara
          - condition: numeric_state
            entity_id: sensor.aqara_battery
            below: "6"
        sequence:
          - service: notify.mobile_phones
            data:
              title: >-
                Aqara Multi Sensor Battery Level is {{
                states('sensor.aqara_battery_level') }}%
              message: >-
                - Zorg voor een nieuwe CR2032 batterij - {{
                states('sensor.aqara_battery_level') }}% = {{ (7.3 *
                states('sensor.aqara_battery_level')|float(0))|round(0) }} dagen
                voor vervanging (o.b.v. 2 jaar minimale levensduur)
      - conditions:
          - condition: trigger
            id: hue_indoor
          - condition: numeric_state
            entity_id: sensor.philips_hue_indoor_motion_sensor_battery_24h_min
            below: "6"
        sequence:
          - service: notify.mobile_phones
            data:
              title: >-
                Hue Indoor Motion Sensor Battery Level is {{
                states('sensor.hue_indoor_motion_sensor_battery') }}%
              message: >-
                - Zorg voor 2 nieuwe AAA batterijen - {{
                states('sensor.hue_indoor_motion_sensor_battery') }}% = {{ (7.3
                *
                states('sensor.hue_indoor_motion_sensor_battery')|float(0))|round(0)
                }} dagen voor vervanging (o.b.v. 2 jaar minimale levensduur)
      - conditions:
          - condition: trigger
            id: hue_outdoor
          - condition: numeric_state
            entity_id: sensor.hue_outdoor_motion_sensor_battery_level
            below: "6"
        sequence:
          - service: notify.mobile_phones
            data:
              title: >-
                Hue Outdoor Motion Sensor Battery Level is {{
                states('sensor.hue_outdoor_motion_sensor_battery_level') }}%
              message: >-
                - Zorg voor 2 nieuwe AA batterijen - {{
                states('sensor.hue_outdoor_motion_sensor_battery_level') }}% =
                {{ (7.3 *
                states('sensor.hue_outdoor_motion_sensor_battery_level')|float(0))|round(0)
                }} dagen voor vervanging (o.b.v. 2 jaar minimale levensduur)
      - conditions:
          - condition: trigger
            id: water_lek_flips
          - condition: numeric_state
            entity_id: sensor.water_lekkage_battery
            below: 6
        sequence:
          - service: notify.mobile_phones
            data:
              title: >-
                Water Lekkage sensor (Aqara Door Sensor) Battery Level is {{
                states('sensor.water_lekkage_battery') }}%
              message: >-
                - Zorg voor een nieuwe CR1632 batterij - {{
                states('sensor.water_lekkage_battery') }}% = {{ (7.3 *
                states('sensor.water_lekkage_battery')|float(0))|round(0) }}
                dagen voor vervanging (o.b.v. 2 jaar minimale levensduur)
    default: []
mode: single

There are pretty good blue prints around this topic. Saves you the headache :smile:

Thanks. Never knew there were this many bluepints. Always thought the blueprints were rather limited in HA, so never bothered. Thanks to your pointer found this is actually a whole section in the community pages. I’ll browse those.

1 Like