Just a quick question:
I have a battery powered sensor, which sends a measurement to home assistant all 3 minutes. Unfortunately this sensor isn’t capable in sensing it’s own battery level, so i don’t get notified when the battery runs low. I usualle notice it when there are no more data points received, which can take some days, since i don’t look constantly on the data.
So i’d like to create an automation like “if the last data point is received more than an hour ago, send an email”. But i am unsure how to achieve this. Basically i would create something like this:
automation:
- alias: "Send email if sensor isn't sending data points"
trigger:
- platform: numeric_state
entity_id: sensor.battery_powered
value_template: 'Now - {{ state.last_changed }}'
above: 1 Hour
action:
// send emails
The problem is, that i have no idea how to get Now
as a value to compare with, and that i have no idea how Home Assistant compares time values. The time trigger isn’t the right trigger, i think. Maybe the offset
feature like the sun trigger could be something, but this isn’t in the numeric state trigger, i suppose.
On a second hand: Say i have successfully implemented an action. The time difference exceeds 1 hour, and an email is sent. However, i do not take actions immediately to replace the batteries. How does Home Assistant check for automation triggers? Say, after 1 hour and 10 minutes, the difference is still above 1 hour, would it send another email, or would the automation be in some kind of “running” or “triggered” state and not fire again until the time difference would fall below 1 hour and then rising up again?