Add NTP check every hour (ESP8266 RTC is BAD at keeping track of time)
This commit is contained in:
parent
7ab1fd8fbb
commit
83d77277e7
@ -239,3 +239,10 @@ while True:
|
||||
if BRIGHTN_DATA is not None and time.ticks_diff(time.ticks_ms(), MQTT_TIMER) >= 0:
|
||||
MqttMultiPublish(BRIGHTN_DATA)
|
||||
BRIGHTN_DATA = None
|
||||
|
||||
time_to_test = rtc.datetime()
|
||||
|
||||
if time_to_test[5] + time_to_test[6] == 0: # (chaque heure quand min et sec = 0)
|
||||
print("Old Time: {0:04d}/{1:02d}/{2:02d}_{4:02d}:{5:02d}:{6:02d}.{7}".format(*time_to_test))
|
||||
set_rtc()
|
||||
print("Time set: {0:04d}/{1:02d}/{2:02d}_{4:02d}:{5:02d}:{6:02d}.{7}".format(*rtc.datetime()))
|
||||
|
Loading…
Reference in New Issue
Block a user