I am new to HA and am finding it to be an amazing platform with a great community. I have some troubles using Template Sensor component. I want to change the way System Monitor component displays “time since last boot” and “last boot” .
Now it looks like that:
When it’s more than 24 hours it is displayed like this:
4 days, 16:53:45.125478
and that dosesnt look too pretty. I would like “time since last boot” and “last boot” to be displayed like that:
4 days 16 h 53 min 43 s
2.12.2016
I was trying my best by using sensor template component but didn’t figure it out so far.
A bit off-topic now. How can I change my “ACTIVATE” text to a button like @brusc has it in his example?
Thank you for your link @silvrr, I got it working for “time since last boot”, have to figure out the date format now. I used code from the link you posted and am now getting the following error in my log:
homeassistant.components.sensor.template: UndefinedError: 'None' has no attribute 'state'
but it’s all displaying correctly…
Yeah, in my case button “activate” calls a script. I was looking through Ben’s files but couldn’t figure out how he has done it…he is using a different method for restarting HA though. I couldn’t replicate it because his shell commands didn’t work for me.
Hello! Yeah, so my understanding is that things that have a defined on off state get a toggle. Scrips typically just have the activate text unless they contain a delay.
The play icon was phased out and replaced with the activate text a while back. I just need to update my config. Sorry about that!
Thank you! Found my error, it’s all working nicely now. I didn’t even know there is template dev tool to diagnose. It’ll be much easier now to find errors in the future.