A script to check sensor last update

dandooze
Fri, 29 Apr 2022 07:44:44 +0000
Questions & Help

Hello everyone,
In my home set-up I have a bunch of Aqara sensors directly connected to a Homey that I use to monitor temperature and humidity (and for some of them, to trigger some automations based on those). Overtime they run out of battery and I only realised it when the automations don’t start or for the “passive” ones, only when I dive a little deeper in the Insights section.

My idea was to use a script to read at a regular interval (say every day) the last updated value of a given sensor and send a notification if this value is greater than one day (meaning that the sensor is battery dead or disconnected). I have a little experience with Javascript but not so much to dive into object and classes, so each of my attempt so far has miserably failed.

Can anyone be so nice to put me on the right path?
Thanks!

139 posts - 34 participants