-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix #434: Implement Uptime #700
Conversation
1d3f36c
to
9591e8d
Compare
reminder ;-) |
src/time_man.cpp
Outdated
@@ -258,6 +258,18 @@ String time_format_time(tm &time) | |||
return String(output); | |||
} | |||
|
|||
|
|||
// inspired from https://www.snad.cz/en/2018/12/21/uptime-and-esp8266/ | |||
// this works if this method is called at least once every 47 days, which is the case (each 8 hours at least based on TIME_POLL_TIME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no direct link to TIME_POLL_TIME
and calling TimeManager::serialise
and although chances are high that it would be called, you may want to add something explicit into the loop
method. Also be aware that the loop
method is only called regularly if SNTP is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I will add a more direct link because here, it works, but I rely on the whole call hierarchy.
@jeremypoulter Regarding the loop which could be disabled...
- should we then move the update stuff in its own cpp file with its own microtask ?
- should we couple the uptime code to another existing loop, which is less time-related ?
- should we keep the uptime code here, and accept the fact that time-related things need NTP ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeremypoulter : I've updated the PR to move the uptime near the main loop, where the version and hardware info are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy with this, thanks for the contribution
Example in HA:
In HA:
MQTT Integration: https://gist.github.com/mathieucarbou/92a3d5e0dc38d6b68aa1bdaf153a80c5
In MQTT:
/status
:/time
: