#Notifications after entity value has not reached a certain interval after some time
1 messages · Page 1 of 1 (latest)
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.
Your idea sounds great however I was not able to select an input_bolean at the statistics sensor helper.
Nevertheless I think I found another way how it should work. Instead of using a input_boolean I just use the statistics helper with a min value for my power reading of the last 36h. Condition: Is the Min value below -800 over the last 36h? Yes -> Do this if over 800 than -> do this
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 }}"