Update 'Uptime' sensor lambda to be compatible with ESPHome 2026.1.0#143
Update 'Uptime' sensor lambda to be compatible with ESPHome 2026.1.0#143Roving-Ronin wants to merge 22 commits intoathom-tech:mainfrom
Conversation
Refactor uptime calculation to use std::string and modern C++ features.
|
Couldn't the "uptime" sensor become a package if it is in every product? |
|
@MaJerle if you want to write it ;-) Hell I'd change a heap of stuff and add useful sensors (as per below), let alone use packages pulled from a single common file set, so instead of wasting time having to update lots of individual yaml, we'd only need to update a single core location for a change to affect all other configs (like I also do with my own configs)... but its Tarontop / Athoms repository and he prefers them all to operate seperately.
|
|
I don't. You've just said owner doesn't like this, so why bother. |
|
Is the calculation of hours minutes and seconds really needed? If the uptime is assigned the correct category home assistant will do it automatically, see a similar issue with another project which got solved by a simple "device class" |
|
Isn't it just better to use the platform uptime?? From: to: which I took from https://github.com/athom-tech/esp32-configs/blob/main/athom-smart-plug.yaml |
it's already part of the core ESPhome! we are reinventing the wheel here, which is even worse than putting code in each config instead of a separate package |
|
This isn't the uptime sensor in ESPHome. This is a template sensor that reformats the output of the raw ESPHome uptime sensors and gives a more usable days/hours/minutes etc type formatted output. Re packages it would be logical, however Athom prefers to not use any packages, but instead keep the full config in every single device/product config file, so newbies can see/read it in one place. IMHO I think most people who dive into the yaml end up doing their own config and use packages, whilst the bulk of users pulling from the default setup don't ever change or get into the yaml anyhow. |

Corrects issues with STRINGS that occurs with update to ESP-IDF with ESPHome 2026.1.0