Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Uptime Sensor #139

Open
pschneider87 opened this issue Mar 3, 2022 · 9 comments
Open

Add Uptime Sensor #139

pschneider87 opened this issue Mar 3, 2022 · 9 comments
Labels
new-feature New features or request. no-stale This issue or PR is exempted from the stable bot.

Comments

@pschneider87
Copy link
Contributor

pschneider87 commented Mar 3, 2022

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
Copy link
Contributor Author

added #142
don't know if @klaasnicolaas needs to do something to make the tests verify the code :-/

@klaasnicolaas
Copy link
Owner

@pschneider87
Copy link
Contributor Author

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

@klaasnicolaas
Copy link
Owner

And?

@github-actions
Copy link

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 github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Apr 10, 2022
@klaasnicolaas klaasnicolaas reopened this Apr 18, 2022
@klaasnicolaas
Copy link
Owner

Still something that is on my list to add 🤔

@klaasnicolaas klaasnicolaas added new-feature New features or request. no-stale This issue or PR is exempted from the stable bot. and removed stale There has not been activity on this issue or PR for quite some time. labels Apr 18, 2022
@mcchots
Copy link

mcchots commented Feb 7, 2023

Doesn't this uptime sensor solve this issue?

@jessereynolds
Copy link

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

@spanznet
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature New features or request. no-stale This issue or PR is exempted from the stable bot.
Projects
None yet
Development

No branches or pull requests

5 participants