#Notifications after entity value has not reached a certain interval after some time

1 messages · Page 1 of 1 (latest)

edgy pivot
#

Hello there,
I am trying to get a automation running that sends a notification to my phone if Power.L1 has not reached < -800 for 30 seconds for the last 36 h.

Any ideads on how to achive this with basic automations?

Thanks in Advance.

elfin salmon
#

I would make an automation that would turn on an input_boolean when value is below -800W for 30s. And turn it off when it goes above -800W.

After which you can use that helper in a statistics sensor where you do a average_step and have max_age set to 36h and keep_last_sample: true.

Now that sensor will tell you the ratio of on vs 36h. So if that value becomes 0% it means it has not be on for 36h aka the power did not go below -800W.

Do note, this will take time to start working as it will start looking at the moment you create it. Aka, it will take 36h after a transition of the power.

edgy pivot
elfin salmon
#

I indeed see a input_boolean isn´t shown. Pretty weird as it has the same properties as a normal binary_sensor.

With your approach you do drop the 30 sec requirement though. Not an issue?

Instead of an input_boolean and an automation you could also do it with a trigger template binary sensor. Usually present the helper way as it's a bit more UI friendly. But I think the following should also work:

template:
  - triggers:
    - trigger: numeric_state
        entity_id:
        - sensor.power_l1
        for:
        hours: 0
        minutes: 0
        seconds: 30
        below: -800
        id: "on"
    - trigger: numeric_state
        entity_id:
        - sensor.power_l1
        id: "off"
        above: -800
    binary_sensor:
      - name: "Power under threshold"
        unique_id: "power_under_threshold"
        state: "{{ trigger.id }}"