A script to check sensor last update

additional question:
If a device is not updating this “lastseen” date itself, how do I automaticly PING this device. (with a script)
Just about the same question like this.