Page 1 of 1

lastUpdate on switch selector

Posted: Sunday 30 April 2023 18:36
by roblom
Is it possible to check how long a switch selector was on a certain level?
I have a switch selector 10, 20, 30, 40 and want to use the .lastUpdate.minutesAgo but not on the swicht but on the level of this switch, so count how long level 40 was actif for example.

Re: lastUpdate on switch selector

Posted: Sunday 30 April 2023 22:53
by waltervl
There are scripts available that can count how long a switch is in On status, eg for calculating run time of an engine. Those should be able to rewrite to selector switch. Example: viewtopic.php?t=23713

Re: lastUpdate on switch selector

Posted: Tuesday 02 May 2023 21:35
by roblom
Thank you for your reply, I used another trigger which was easier than write some code to count. The link you supplied is still useful so I saved it.