# A script to check sensor last update

**URL:** <https://community.homey.app/t/a-script-to-check-sensor-last-update/63142>\
**Category:** Questions & Help\
**Tags:** homeyscript\
**Created:** [April 29, 2022, 7:44am UTC](https://community.homey.app/t/a-script-to-check-sensor-last-update/63142 "2022-04-29T07:44:44Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![dandooze](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dandooze/32/43134_2.png) [@dandooze](https://community.homey.app/u/dandooze)\
**Post date:** [April 29, 2022, 7:44am UTC](https://community.homey.app/t/a-script-to-check-sensor-last-update/63142/1 "2022-04-29T07:44:44Z")

</div>

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!

---

_[View the full topic](https://community.homey.app/t/a-script-to-check-sensor-last-update/63142)._
