rene04
1
Hi,
i have found some nice code to add a uptime sensor in this forum . i added it to my configuration.yaml but how can i show it up in the UI now?
sensor:
- platform: uptime
- platform: template
sensors:
homeassistant_uptime:
friendly_name: HomeAssistant Uptime
value_template: >
{# use now() to update every minute #}
{% set t = now() %}
{{ relative_time(strptime(states('sensor.uptime'), '%Y-%m-%dT%H:%M:%S.%f%z')) }}
availability_template: >
{{ strptime(states('sensor.uptime'), '%Y-%m-%dT%H:%M:%S.%f%z') is not string }}
tom_l
2
Assuming you can see sensor.homeassistant_uptime
in the Developer Tools / States page then you just add that sensor to an entities card.
rene04
3
i think thats the problem, i cant see it there.
tom_l
4
Did you restart home assistant after creating the sensors?
Do you see any errors in your system log?
rene04
5
yes i have restarted HA.
in the logs i have only a warning about duplicate entries:
sensor:
sensor:
now i got it i have to put all my sensors under one “sensor:”. now it works, thx
1 Like