I have a beeper to remind me to open or close windows depending on outside temperature. Now whenever the temperature oszillates around the threshold, that beeper is triggered several times. If I use the “for minutes” in the trigger, the signal is delayed. Is there any way to formulate a “trigger if temperature falls below level, but only if it was above that level for an hour”?
In other cases it’s easy. I have “turn off heating if it was on for at least an hour”. But how do I formulate such a condition if I only have the trigger value itself, no output, to write it?
Window sensors would be ideal, but are far too expensive.
I think you need something else - either a text helper or an additional binary sensor. A sensor would probably be the more elegant: a trigger-based binary sensor that switches to ‘on’ when the high temperature persists for an hour, and to ‘off’ when it drops.
Then, in your automation, you set the trigger to fire when that sensor changes state from ‘on’ to ‘off’. You can assign an identifier to each trigger and then use it to distinguish which one actually fired.
Share you automation yaml. It should be a simple matter to introduce some hysteresis and a hold off time without the need for any further helpers.
There are a few options to get to what you want…
One method is to throttle the automation so that it won’t run more often than a defined time span. This can be done with a template condition or by using the Cooldown condition from the Spook custom integration.
Another option is to set up a template binary sensor with a delay_off, which will cause it’s state to turn “on” immediately when the temperature passes your threshold. But, it will only turn “off” when the temperature is no longer passed the threshold for the defined time span. You use that binary sensor as your trigger instead of using the temperature sensor directly.
Thanks Tom,
as of now it’s quite simple. And Slimak, I know how to work something out with an extra entity and and an extra automation, but such stuff will grow out of proportion.
alias: Beep Fenster warm
description: ""
trigger:
- platform: numeric_state
entity_id:
- sensor.aussen
for:
hours: 0
minutes: 5
seconds: 0
above: sensor.r1_temperature
value_template: "{{ float(state.state) - 1.0 }}"
- platform: numeric_state
entity_id:
- sensor.aussen
for:
hours: 0
minutes: 5
seconds: 0
above: sensor.r6_temperature
value_template: "{{ float(state.state) - 1.0 }}"
condition:
- condition: time
after: "11:00:00"
- condition: state
entity_id: person.axel_berger
state: home
action:
- action: esphome.a03_beeper_double
data: {}
- delay:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- action: esphome.a03_beeper_off
data: {}
mode: single
Danke
Axel
Have you considered buying just 1 sensor (for the window you are most likely to open).
I have a Zigbee setup so contact sensors are less than $10 USD for me (under $5 if I order from China).
Anyway my point is that you don’t need to sense every window, you are simply just looking for something to tell HA that “windows” are open or closed once you get the reminder you will go round and close them.
TL;DR - You have to check all windows now - if you had 1 sensor your logic / false positives may be much simpler.
I think you’re right. I should go for the best solution and not mess with extra helper sensors.