hajo62
(Hajo)
January 1, 2019, 10:46pm
1
I would like to format the last_boot sensor to display just date, without time.
How could I do this?
Here is my corresponding part of my sensor.yaml:
####################################################
# Raspberry PI system Monitoring #
####################################################
- platform: systemmonitor
resources:
- type: processor_use
- type: memory_use_percent
- type: memory_free
- type: disk_use_percent
arg: /home
- type: disk_free
arg: /home
- platform: systemmonitor
resources:
- type: last_boot
# - platform: cpuspeed # Does not show anything?!
- platform: command_line
name: CPU Temperature
command: "cat /sys/class/thermal/thermal_zone0/temp"
# If errors occur, remove degree symbol below
unit_of_measurement: "Ā°C"
value_template: '{{ value | multiply(0.001) | round(1) }}'
1 Like
- platform: template
sensors:
date_last_boot:
friendly_name: "Last Boot"
value_template: '{{ states.sensor.last_boot.state.split("T")[0] }}'
1 Like
In customize.yaml:
sensor.last_boot:
friendly_name: Last Boot
device_class: timestamp
icon: mdi:clock
Then in lovelace:
- entity: sensor.last_boot
format: datetime
The supported formats are : relative, total, date, time, datetime so in your case use date
2 Likes
hajo62
(Hajo)
January 2, 2019, 2:43pm
6
DavidFW1960:
Then in lovelace:
Iām not with lovelace yet
forsquirel:
platform: template sensors: date_last_boot: friendly_name: āLast Bootā value_template: ā{{ states.sensor.last_boot.state.split(āTā)[0] }}ā
I need to have the normal last_boot sensor, too. Otherwise the nice one shows unknown?
- platform: systemmonitor
resources:
- type: last_boot
#hidden: true
- platform: template
sensors:
date_last_boot:
friendly_name: "Nice last boot"
value_template: '{{ states.sensor.last_boot.state.split("T")[0] }}'
And even just setting hidden to true, I get an unknown in the nice one
Not sure, it works on my system
Template sensor:
front end display:
systemmonitor:
hajo62
(Hajo)
January 3, 2019, 11:19am
9
forsquirel:
front end display:
Looks niceā¦ Is there a trick to have the sensors in a row and not in single lines?
Works for me, too. BUT: Additionally I have the Last Boot Sensor (circle in the row with all sensors not grouped).
Iām using lovelace as my frontend. Iām not doing all the crazy things that you see people doing. Mine still looks like stock with the exception of a few groups that are grouped horizontally like above.
I have to ask, how did you find the supported formats ārelative, total, date, time, datetimeā? I looked into the component on github and didnt find anything.
DavidFW1960:
device_class: timestamp
I found it documented in a PR at some point. Its to do with the device_class
1 Like
Thank you. I appreciate you sharing your knowledge here. Read your name in the forums so often and you helped me with many of my problems.
1 Like
I have just tried to do the same, but it still shows like this:
from customize.yaml:
sensor.last_boot:
friendly_name: Last Boot
device_class: timestamp
icon: mdi:clock
and my card:
- type: glance
title: Pi system
columns: 5
entities:
- entity: sensor.cpu_temp
name:
- entity: sensor.disk_use_percent
name:
- entity: sensor.memory_use_pimb
name:
- entity: sensor.memory_use_percent
name:
- entity: sensor.processor_use
name:
- entity: sensor.last_boot
format: datetime
name:
surely if it knows last boot was 12 mins ago it shouldnt show 6/3/2020?
akszyn_pl
(Lord Adrian)
August 23, 2021, 10:31am
15
for me it does not work with this configuration
- platform: systemmonitor
resources:
- type: last_boot
hidden: true
is giving me such an error: Invalid config for [sensor.systemmonitor]: [hidden] is an invalid option for [sensor.systemmonitor]. Check: sensor.systemmonitor->resources->7->hidden. (See ?, line ?).
nickrout
(Nick Rout)
August 23, 2021, 7:50pm
16
akszyn_pl:
hidden: true
Delete this, hidden is not a valid option.