Lights Usage Table

A user wanted an easy way to see how long a light was on cumulatively. To meet this need, and to illustrate some basics of table UI, check out this app:


It works as advertised. Any advice on how to get this On time into a tile or virtual tile?

From what I can see (and I could be wrong), I think the values are currently recorded within the App's data, so I don't believe these could be referenced in a dashboard tile. One option may be to record the time as a state value in the light device and use something like @thebearmay's app to produce a tile with the results displayed. My only concern if you did go down that route would be the potential "chattyness" of writing values so often to multiple devices, perhaps a 1 minute poll would be acceptable.

Personally if I wanted it on a tile Iā€™d look at taking the easy way out and writing the value to a hub variable.

1 Like

Yep. For sure. Easy to make the app do that for one. A bit harder to add a table column where one could add a Hub Variable to track the total -- but doable. I will poke at it...


You would need a Hub Variable per device though, wouldn't you?

Optional Hub Variable per device.

1 Like

First of all, this is super cool. I look forward to using the table feature in future apps following this as an example. Thanks @bravenel for sharing this. To make this useful for my smart home the duration per light would have to be baked into the device driver as a new attribute. I can't think of an elegant way to do this. Most of my lights are Z-Wave switches and dimmers so I suppose one could write a variant of those drivers that does this. My HousePanel app currently keeps track of how many times lights are turned on and reports that on the panel. I'm thinking to update that to include elapsed time. As always the community has inspired spinoff innovations in other areas. Thanks again.


I added variables to this, and pushed that to GitHub.

You can select a String Hub Variable for each device as you see fit. If you click on a selected variable, that removes the selection. The Total On Time is updated to the variable whenever the light turns off, or whenever the table in the app is refreshed.


I could also see this being useful for people to track the time a wash / dryer cycle has been running, all you need is a virtual switch.

1 Like

Updated GitHub again to add tool-tip for variables column.

In case you didn't notice, the total time is red if the light is off, and green if it's on.


Its working, Variable Connector device is now visible as string in device list. I can add to dashboard and link to Sharptools. thanks much!


I modified the App to be generic not just lights. Made parent/child set-up to so can have different child app for different device types tables; Lights, Water pump, other switch devices...


Sharing is caring...,:wink::slightly_smiling_face:

Can you clarify what you mean by this?

The variable thats linked in the app is now showing up on device list so now it can be accessed by dashboard or other and displayed.

1 Like

You don't need a connector for it to be displayed in a Dashboard. SharpTools, maybe, but not Dashboard -- it knows about Hub Variables.

Really nice job Bruce... this is such a cool feature. I updated my HousePanel to also keep track of times things are on, much like what you've done here. Choice is good. Here's a screen shot of my updated panel showing the duration - see Bedroom Ceiling


Thank you or this, Bruce! May I request an addition? It would be nice to see a colomn next to the reset column with a timestamp of the last reset. That way one could see the total time on since...

This little table diddy that Bruce has cooked up makes it clear he's the Walter White for we smart home junkies.


This has been added to the Github source.