Automation with persistent notification

Hello,

I have like this automation that should be triggered by certan condition. like in my case a value of the sensor if it is below 0.5. the sensor value is atm 0, so a notification will show up. But if I change it to above 0.5 unforunately the same notification will show up.
Hope you can help me in may case.

alias: Lampe 1 Batterie notification
trigger:
  - platform: state
    entity_id: sensor.0x00124b0003364a01_l2
condition:
  - condition: numeric_state
    entity_id: sensor.0x00124b0003364a01_l2
    below: 0.5
action:
  - service: persistent_notification.create
    data:
      title: Lampe 1
      message: Batterie Fehlerhaft

Thank you all

This will only trigger when the sensor goes from above to below 0.5:

alias: Lampe 1 Batterie notification
trigger:
  - platform: numeric_state
    entity_id: sensor.0x00124b0003364a01_l2
    below: 0.5
action:
  - service: persistent_notification.create
    data:
      title: Lampe 1
      message: Batterie Fehlerhaft

thank you for the fast anwer. So in my situation the sensor value of the battery is about 0.65 (voltage divider)
In case of dropping too low it should trigger the automation. I’m only testing it in Home Assistant by execute the automation manually.
At first I had like this in mind but it didn’t work as well

alias: notification
description: ""
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: persistent_notification.create
    data_template:
      message: "BATTERIE FEHLERHAFT"
    condition: 
      condition: template
      value_template: >
        {{ states('sensor.0x00124b0003364a01_l2')|float < 0.4 }}
mode: restart

Yes that is what my example does.

Don’t test it by triggering manually that will always skip the trigger and by default the conditions too. All it does is run the actions.

Test it by changing the state of your sensor in Developer Tools → States.

ok perfect.
I tested it and it works.

Thank you!

1 Like