Looking to find out how to create a "Live Run Time" Tile


#1

1) Give a description of the problem
Just can’t figure out how.

2) What is the expected behaviour?
When device switch changes to On, Log time, set Variable (I have that)
When device switch changes to Off, Log time, set Variable (I have that)
Create Tile (I have that)

What I do need help on is this:
Have tile “live” count up in Hours and Minutes on tile. (every minute) when switch changes to 'On" and stop when switch changes to “Off”.
When time reaches a set time say 8 hours, turn switch off.

3) What is happening/not happening?
Nothing yet.


#2

This sort of works although it is as wrong as concrete rain. It just doesn’t do a “live” count up in the tile, but it will give me an updated total when the switch is turned off. ( i Know the timers are supposed to be top level, I just haven’t figured out how to get it up there without writing the whole piston over again)

ideas?


#3

You can add a ‘while statement’…

while switchdevice is on...
   wait 1 minute
   update your tile with formatDuration data
end while

#4

@eibyer

OK I managed to get the piston fixed using a ‘while statement’ here is how it looks now.

but the tile doesn’t update every minute. It only updates when the switch is turned off…any ideas?


#5

See if you can make the while statement’s subscription Always instead of Automatic.


#6

Here is a good article on dragging & dropping code.


Edit:
I updated the wiki, and fixed the link here.