I have the following 2 scripts that work as intended, but as a Newbie I’m not sure if this approach is appropriate or a combined script would be better? Ideally, I’d like
- Alert sent when the threshold is passed
- Additional Alerts sent each hour the threshold stays passed
What I have is as follows:
- This scripts sends the alert once when the threshold is passed
id: '1653113982402'
alias: Cellar Temp Warning
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.cellar_air_temperature_2
above: '18'
condition: []
action:
- data:
filename: /tmp/snapshot.jpeg
service: camera.snapshot
target:
entity_id: camera.cellar_high
- service: notify.iot_mail
data:
title: Cellar too warm
message: Cellar Temp is {{ states('sensor.cellar_air_temperature_2') }}°C, and
Humidity is {{ states('sensor.cellar_air_humidity_2') }}%
data:
images:
- /tmp/snapshot.jpeg
mode: single
- This scripts sends the alert once per hour (at the 30min mark) when exceeding the threshold
- id: '1653114654701'
alias: Cellar Temp Warning - Continuing
description: ''
trigger:
- platform: time_pattern
minutes: '30'
condition:
- type: is_temperature
condition: device
device_id: 150f04c90b1335570567847a36b62065
entity_id: sensor.cellar_air_temperature_2
domain: sensor
above: 18
action:
- data:
filename: /tmp/snapshot.jpeg
service: camera.snapshot
target:
entity_id:
- camera.cellar_high
- service: notify.iot_mail
data:
title: Cellar too warm - continuing
message: Cellar Temp is {{ states('sensor.cellar_air_temperature_2') }}°C, and
Humidity is {{ states('sensor.cellar_air_humidity_2') }}%
data:
images:
- /tmp/snapshot.jpeg
mode: single
Thanks
Nathan