Solving my second problem, I think the below should work:
- Trigger above high threshold
- Use
repeat untilto keep looping until sensor is below low threshold - Send high notification
- Use
wait_for_triggerwithtimeout(e.g. 60min) to detect if value drops below low threshold, then send low notification - If value has not dropped,
repeatloop keeps firing
This only fails if the value drops below the low threshold between wait_for_trigger timing out and repeat until, which depends on the speed of my computer but is likely <1s, so with an hourly loop almost 0 chance.
alias: High CO2 test3
description: ''
mode: single
trigger:
- platform: numeric_state
entity_id: sensor.mh_z19_co2
above: '1250'
condition: []
action:
- repeat:
until:
- condition: numeric_state
entity_id: sensor.mh_z19_co2
below: '800'
sequence:
- service: notify.notify
data:
message: High CO2 in office
- wait_for_trigger:
- platform: numeric_state
entity_id: sensor.mh_z19_co2
below: '800'
timeout:
minutes: 60
continue_on_timeout: false
- service: notify.notify
data:
message: Low CO2 in office