Hey everyone, I came across an interesting challenge recently and thought I’d share my experience. Since the latest update, the since_last_boot feature in the system monitor has been deprecated, and I wanted to find a way to replicate this functionality in a non-Lovelace setup.
After some research, I discovered that setting a sensor’s device_class to timestamp might be the solution. However, figuring out how to set the type relative, total, date, time, and datetime was a bit tricky. I started by experimenting with a template sensor, which worked well for displaying the time since the last boot. Here’s what I did:
yaml
since_last_boot_template:
friendly_name: ‘Time Since Last Boot’
value_template: ‘{{ states(“sensor.since_last_boot”).split(“.”)[0] }}’
This setup gave me the time elapsed since the last boot, but I was still curious about how to achieve the other timestamp options available in Lovelace. I tried using relative_time(states.sensor.last_boot.last_changed) but realized it wasn’t the same as the new Lovelace options.
After some trial and error, I found that using a combination of templates and custom sensors allowed me to display the timestamp in various formats. It was a bit of a learning curve, but I’m happy with the results. If anyone has further insights or alternative methods, I’d love to hear about them! ![]()