I’ve got a bunch of battery based sensors (xiaomi temperature) that I don’t trust their battery monitoring. So was to implement some sort if check that if no temp posted in greater than 12 hours, to alert me it probable needs a new battery.
Now I know for each item I can create a date time item with it and a rule that on every change update date time item…I do this already on a couple of dht12 sensors…but this strikes me as inelegant.
With persistence I know that can be set up on a group…they already go off to influxdb, so it would make sense to try and pull it from there. If I have to and can use mapdb I will for these items as well.
Does this mean I could grab the group of temperature sensors, and iterate over it and get the <item>.lastUpdate and check it against a predetermined time and alert off that?
Do you use Grafana? I found using their alerting mechanism much easier, just make sure your persistence is set to everyUpdate else if there is no temp change then it doesn’t get stored into influx and the grafana email alert will fire incorrectly.
Make a one-ruleto-to-timestamp-them-all, using Group. Add any Item to a Group, create a DateTime Item for each with an associated name, like someSensor_timestamp.
You probably want to persist the timestamps, and restore on startup. But this method does not otherwise persistence.
I think I like the grafana method…So I’ve added an alert for that…and I’ve just shut down one of my temperature sensors to see what happens…hopefully it picks it up.
I’ve also asked grafana for a feature request to add mqtt as a notification option.
Not sure if you got this working but I found this while researching tidying up my persistence, examples at the bottom and seems simple enough and can send to mqtt.
Yeah I did get it working, but I might look at the rule option as well. Only because grafana does pushover and slack.
Also its not very flexible on that you have to query each thing individually. And while it works, something that just iterates over a group would be preferred