home-assistant-glow icon indicating copy to clipboard operation
home-assistant-glow copied to clipboard

Add Uptime Sensor

Open pschneider87 opened this issue 2 years ago • 9 comments

I find it useful to have an Uptime Sensor in HA Glow. I've copied right away from the ESPHome-Page from the "Human readable sensor" Section

I'm not so familiar with GitHub, so I'm afraid I can't make a PR :-/ But maybe somebody can quickly copy/paste it into the project, is quite nice to know about it:

image

pschneider87 avatar Mar 03 '22 16:03 pschneider87

added https://github.com/klaasnicolaas/home-assistant-glow/pull/142 don't know if @klaasnicolaas needs to do something to make the tests verify the code :-/

pschneider87 avatar Mar 07 '22 13:03 pschneider87

What about this uptime sensor: https://github.com/klaasnicolaas/smarty-homeassistant-config/blob/master/esphome/sensors/uptime_timestamp.yaml

klaasnicolaas avatar Mar 07 '22 15:03 klaasnicolaas

I'll give that a try. The idea sounds good to only send it once.

pschneider87 avatar Mar 07 '22 15:03 pschneider87

And?

klaasnicolaas avatar Mar 10 '22 21:03 klaasnicolaas

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

github-actions[bot] avatar Apr 10 '22 08:04 github-actions[bot]

Still something that is on my list to add 🤔

klaasnicolaas avatar Apr 18 '22 16:04 klaasnicolaas

Doesn't this uptime sensor solve this issue?

mcchots avatar Feb 07 '23 19:02 mcchots

Yep, I've been using the uptime sensor @mcchots mentions with success. Added the following to the esphome build definition yaml file:

  - platform: uptime
    name: Uptime
    id: sensor_uptime
    update_interval: 60s

jessereynolds avatar May 22 '23 02:05 jessereynolds

Uptime is great, but rather than have to calculate backwards in time to work out when it last booted, I prefer to add one that updates once on each boot when the time syncs:

text_sensor:
  - platform: template
    name: "Last Boot"
    id: device_last_boot
    icon: mdi:clock
    entity_category: diagnostic

time:
  - platform: homeassistant
    timezone: "Australia/Hobart"
    id: homeassistant_time
    on_time_sync:
      then:
        - if:
            condition:
              lambda: 'return id(device_last_boot).state == "";'
            then:
              - text_sensor.template.publish:
                  id: device_last_boot
                  state: !lambda 'return id(homeassistant_time).now().strftime("%a %d %b %Y - %I:%M:%S %p");'

Which gives you:

image

spanznet avatar Jan 30 '24 10:01 spanznet