p2p automatic time synchronization
Moderators: grovkillen, Stuntteam, TD-er
p2p automatic time synchronization
There are several esp 1-3 modules on the network. p2p mode enabled. Number 1 has an RTC DS3231. The modules have been reloaded. Internet is missing. The time on the modules will be set to 00:00 hours. How to automatically synchronize modules 2 and 3 from RTC module number 1 in the absence of the Internet?
Re: p2p automatic time synchronization
I think that is covered in the ESPEasy-now feature that is still in PR (#3301). You could download the latest build from there (you will need to be logged in to Github to be able to download), and test that. Not sure how complete the documentation on that feature is, so it might be a bit experimental.
I know, from a reliable source (TD-er ), it is actually working, though there still are a few technical issues to be solved, but for time-sync it should be usable, as that seems to be one of the requirements of Espressif's ESP-now, where this feature is building on.
I know, from a reliable source (TD-er ), it is actually working, though there still are a few technical issues to be solved, but for time-sync it should be usable, as that seems to be one of the requirements of Espressif's ESP-now, where this feature is building on.
/Ton (PayPal.me)
Re: p2p automatic time synchronization
Using that PR, you need to define this:
Also on the Tools->Advanced page you have to enable using ESPEasy-NOW
This will give you the option to indeed sync time via all node within range.
Also if you have a MQTT controller configured, you should enable to forward ESPEasy-NOW messages in that controller.
Conceptually, you have one (or more) gateway node and mesh nodes.
A gateway node is a node connected to a network (either ethernet or WiFi) and has a connection to the MQTT broker (and forwarding enabled)
Nodes will try to find each other automatically and you can also have a "chain" of nodes in the mesh.
However automatic finding may not work very well if the Channel is not fixed (see force mesh channel option on tools->advanced page) and also mixing ESP8266 and ESP32 may not always work that well. But when using channel 1 it does seem to work OK. (given the gateway node also uses channel 1 to connect to WiFi)
This mesh layer allows you to forward MQTT messages from anywhere in the mesh to the broker and will sync time on all nodes. (quite accurately)
It has been tested upto 6 "hops" in the mesh and since the ESP-NOW layer uses a lower data rate than WiFi, the range is also a lot longer. Upto 200m per hop in the field with line-of-sight.
However, sometimes some nodes (at least 3) seem to think their "neighbor" has the shortest distance to the gateway and thus a packet may hop infinetely between these nodes.
For debugging you may send a message from a mesh node via rules to the broker where the topic ends with "/traceroute".
If you include the node name in the topic too, you can see via which nodes the messages are being forwarded.
Just like in the ESPEasy p2p via UDP, you need to set a unique unit nr on each node and this cannot be 0 or 255.
Code: Select all
#define USES_ESPEASY_NOW
This will give you the option to indeed sync time via all node within range.
Also if you have a MQTT controller configured, you should enable to forward ESPEasy-NOW messages in that controller.
Conceptually, you have one (or more) gateway node and mesh nodes.
A gateway node is a node connected to a network (either ethernet or WiFi) and has a connection to the MQTT broker (and forwarding enabled)
Nodes will try to find each other automatically and you can also have a "chain" of nodes in the mesh.
However automatic finding may not work very well if the Channel is not fixed (see force mesh channel option on tools->advanced page) and also mixing ESP8266 and ESP32 may not always work that well. But when using channel 1 it does seem to work OK. (given the gateway node also uses channel 1 to connect to WiFi)
This mesh layer allows you to forward MQTT messages from anywhere in the mesh to the broker and will sync time on all nodes. (quite accurately)
It has been tested upto 6 "hops" in the mesh and since the ESP-NOW layer uses a lower data rate than WiFi, the range is also a lot longer. Upto 200m per hop in the field with line-of-sight.
However, sometimes some nodes (at least 3) seem to think their "neighbor" has the shortest distance to the gateway and thus a packet may hop infinetely between these nodes.
For debugging you may send a message from a mesh node via rules to the broker where the topic ends with "/traceroute".
If you include the node name in the topic too, you can see via which nodes the messages are being forwarded.
Just like in the ESPEasy p2p via UDP, you need to set a unique unit nr on each node and this cannot be 0 or 255.
Re: p2p automatic time synchronization
oh, this is a bit tricky for me so far... I'm using the premade Mega builds.
I need time to figure it out
I thought to send the time setting function to dependent molules - Datetime, 2022-09-05, 10:00:00, but everything turned out to be more complicated)
I need time to figure it out
I thought to send the time setting function to dependent molules - Datetime, 2022-09-05, 10:00:00, but everything turned out to be more complicated)
Re: p2p automatic time synchronization
Problem is that you need to have WiFi connection to the p2p nodes for the current ESPEasy p2p to work as it needs UDP.
Re: p2p automatic time synchronization
there is no problem in this. The Wi-fi network is stable and constant. The question was in moments of lack of Internet, when modules cannot receive data from NTP. But the modules have a wi-fi network.
Re: p2p automatic time synchronization
OK, I can add some command/feature to allow any node to act as a local NTP source via p2p.
Re: p2p automatic time synchronization
I think this would be a useful feature in systems related to RTC dependent cycles
Who is online
Users browsing this forum: Bing [Bot] and 100 guests