How to sync time without internet

38 views
Skip to first unread message

praba karan

unread,
Mar 27, 2024, 10:14:28 AM3/27/24
to TasmotaUsers
ESP8266 is set to ping Router every 5mins. If failed to ping  after 15 mins, relay will get trigger. Once internet came, then it will sync with current timestamp. If no internet after triggering, it is getting sync with false epoch time.
 How can l use rule1 for sync with current epoch time.

Rule1 ON System#Init DO time 1701369334;var1 5  ON MQTT#Connected DO backlog Time 0 ; publish router/%topic%/cmnd/var %value% ENDON

Rule2  ON Time#Minute|%Var1% DO Ping4 8.8.8.8 ENDON ON Ping#8.8.8.8#Success==0 DO Var2=Var2+1 ENDON ON Var2#State==3 DO backlog Mult1 3; Power1 1;var4 %timestamp% ENDON  ON Ping#8.8.8.8#Success>0 DO backlog Var1 5 ENDON

Philip Knowles

unread,
Mar 28, 2024, 8:04:00 AM3/28/24
to praba karan, TasmotaUsers
There are issues with the rules

Rule1 ON System#Init DO backlog time 1701369334;var1 5  ON MQTT#Connected DO backlog Time 0 ; publish router/%topic%/cmnd/var %value% ENDON

Rule2  ON Time#Minute|%Var1% DO Ping4 8.8.8.8 ENDON ON Ping#8.8.8.8#Success==0 DO add2 1 ENDON ON Var2#State==3 DO backlog Mult1 3; Power1 1;var4 %timestamp% ENDON  ON Ping#8.8.8.8#Success>0 DO backlog Var1 5 ENDON

Time 0 re-enables NTP BUT it only updates every hour so make Rule 1

Rule1 ON System#Init DO backlog time 1701369334;var1 5  ON MQTT#Connected DO backlog Time 1701370790; Time 0 ; publish router/%topic%/cmnd/var %value% ENDON

10 seconds later NTP will update to give you the correct time

From: sonof...@googlegroups.com <sonof...@googlegroups.com> on behalf of praba karan <prabaka...@gmail.com>
Sent: 27 March 2024 14:14
To: TasmotaUsers <sonof...@googlegroups.com>
Subject: How to sync time without internet
--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/fe115385-b433-4d9c-9fd5-b0b8b2e5da33n%40googlegroups.com.

Philip Knowles

unread,
Mar 28, 2024, 8:27:00 AM3/28/24
to Justin Adie, praba karan, SonoffUsers
Damn missed that one!


From: Justin Adie <justi...@adieandco.com>
Sent: 28 March 2024 12:25
To: Philip Knowles <knowles...@gmail.com>
Cc: praba karan <prabaka...@gmail.com>; SonoffUsers <sonof...@googlegroups.com>
Subject: Re: How to sync time without internet
 
Should there not be an “endon” at the end of the first backlog in rule1 and the first trigger of rule2 ? 



Justin Adie

unread,
Mar 29, 2024, 8:00:52 AM3/29/24
to Philip Knowles, praba karan, SonoffUsers
Should there not be an “endon” at the end of the first backlog in rule1 and the first trigger of rule2 ? 

On 28 Mar 2024, at 12:03, Philip Knowles <knowles...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages