A script to check sensor last update

Something like

Homey.flow.runFlowCardAction({
uri: 'homey:manager:notifications',
id: 'create_notification',
args: {
text: 'Test text sent by Timeline_message.js'
}
});

1 Like

and how this rows can put the script end or how? Advanced flow not showing all information like when script test run?

Why you would need that ? You can process output tags and to whatever you want in flows.

InvalidatedDevices
notReportingCount

because my aqara wireless wall switch battery status report not valid the app, and today is 2. wall switch is not working because the battery is low down and app say 100% status and I want to now if something devices is low battery
But if you have any solution how make a flow I’m listening. Thanks

Zigbee ? If it’s Zigbee I would recommend to use A script to check sensor last update - #39 by Sharkys otherwise use A script to check sensor last update - #25 by Sharkys

The flow is quite trivial :

…add some trigger (time, condition based or any you want).
There is also check included in this example to ensure you will not get repeated notifications about the same devices.

thanks, no have any script that can read zigbee and device correct battery status, that is I like. thanks for your time help me.

Great job, this is exactly what i was looking for.

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.

You can’t.

What’s wrong with the script, it finds anything which hasn’t show any signs of life for the last xx hrs

IKEA Repeaters do not correctly update Last seen value - no idea why but I guess it"s Homey Zigbee issue or some incompatiblity. My advice (and what I did as well), filter it out in the script or stop using IKEA.

That makes no sense :thinking: A “last seen” value is something that Homey determines.

(
Repeater: “Hey Homey, you last saw me yesterday!”
Homey: “No I didn’t, I’m seeing you right now!”
Repeater: “…”
)

1 Like

Yep and still, it doesn’t work with IKEA, I have no idea why. Now I looked on my Ikea Tradfri power socket - last seen two weeks ago :-)) Also there is some problem with storing / restoring this Last seen values upon restart - for some devices it’s reset upon restart, again no idea why. Submitted to Athom 2 / 3 weeks ago.

What command is send from the development page with the “PING” button?
After that the ‘lastseen’ date/time has a new value.

You can try for yourself (replace “AA:BB:CC” with the full IEEE address of a device you want to ping):

Homey.zigbee.runCommand({
  "opts": { "ieeeAddr":"AA:BB:CC" },
  command: 'PING'
});

This works from the Web API Playground, but not from HomeyScript, so it cannot be automated.

Updated both scripts to be compatible with Homeyscript 3.5.1 and later (now default, when new Homeyscript is created)

General version

Zigbee version

Those scripts are not compatible anymore with Homeyscript <3.5.1 and older, which is called “Classic”
classic

2 Likes