Let’s say you have a motion sensor that will turn off the light after it stops sensing motion for 10 minutes. Is there a way to expose that 10 minute counter on the dashboard?
I tried creating a sensor to get a snapshot of the timestamp when motion stops being detected and then I have another sensor that basically gets the current timestamp and subtracts the two. However the value doesn’t update on the dashboard. It either shows “unavailable”, when there is motion, or “0” when it stops detecting motion. Here is the yaml code. I don’t like this approach because 1, it doesn’t work and 2, I’d rather expose the actual counter. Any thoughts?
I played around with the idea of a timer but a timer is something that countsdown from a specified duration. What I’m trying to do is display how much time has elapsed since the sensor went into off mode.
Be advised that the template will only update every minute (because of the inclusion of the now() function) and when the binary_sensor’s state changes. It won’t update any faster than that.
Hey thanks for offering a solution! Unfortunately I would like to display the time increments down to the second. Still diving into this forum along with the subreddit to look for solutions but haven’t found any yet.
A template is evaluated only when one of the entities it references changes state. As explained, now() causes the template to be evaluated every minute and no faster.
A brute-force workaround is to create a Trigger-based Template Sensor with a Time Pattern Trigger set for every second. You’ll have to decide if that’s something you want running continuously on your system. Generally speaking, I don’t recommend doing that.