I looked at the History Stats. BUt could not work out how to show how long a light has been on or off for.
Could someone help me. Much appreciated.
I looked at the History Stats. BUt could not work out how to show how long a light has been on or off for.
Could someone help me. Much appreciated.
If you wanted to show how long a light has been on for:
Create a history stat helper,
Give it a name,
Choose the light entity,
Set state “on”
Choose time based,
The settings in the next page will depend on how long you want to show:
For example if you want to show how long the light has been on today then set the start time as:
{{ today_at(‘00:00’) }}
Don’t fill in the end time but set the duration to 24 hours.
This will show how long the light has been on for today and will reset back to zero each midnight. History will still be maintained based on your retention.
Other examples can be found here:
History stats will show a “how long a light was ON” within a defined period: if the light was ON for 3 hours, then OF for 4 hours, then ON for 5 hours - then history-stats will give you 3+5=8 hours (if you define a period 12 hours). Do you really need this info?
Assume you show the light entity on an Entities card - then add secondary_info= last-changed, it will show you an approximate duration of the last state. Will not work if you reboot HA frequently since last_changed is updated on HA start. If you need a persistent last_changed - use search, solutions were posted in Community.
I track how long a light has been on during a day. I want to track how long the light has been on/off since the last state changed. I have the odd light or two which just seems to always be on and I am trying to track that.
I have an entity card but cannot see where to add add secondary_info= last-changed
This should give me the time for a list of lights being on or off.
So where do I put secondary_info= last-changed