Uptime sensor not showing in UI

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 }}

Assuming you can see sensor.homeassistant_uptime in the Developer Tools / States page then you just add that sensor to an entities card.

i think thats the problem, i cant see it there.

Did you restart home assistant after creating the sensors?

Do you see any errors in your system log?

yes i have restarted HA.

in the logs i have only a warning about duplicate entries:

sensor:

  • platform: uptime

sensor:

  • platform: systemmonitor

now i got it :slight_smile: i have to put all my sensors under one “sensor:”. now it works, thx :slight_smile:

1 Like