Need advice for sync nodes


  • Hardware Contributor

    Hi.
    I have some questions about syncing node. I would like to have sync nodes especially for button/switch node so it could be low power with sleeping and not miss msg.
    So to have a very basic proof of concept, and keep mysensors lib and GW like it is, I started to do things like this :

    • if controller (in my case jeedom) sent to my serial GW a V_LIGHT or V_DIMMER msg, the GW reroute it to the NodeSync.

    • NodeSync is a node which receives GW msg (only V_LIGHT, V_DIMMER) and stores them in a buffer. Every x seconds NodeSync sends sort of heartbeat in order to create a sync network. Furthermore, it sends the buffer every x ms to the switch nodes. Of course, it needs to care about timings (in NodeSync and others sync switch nodes) so it is always the same. Sleep/Wake up cycle are set in .h

    • Switch Node works like this : when powered up, it waits for example 2seconds to get the heartbeat. It sends ack so NodeSync calculates offset RX-TX in order to adjust timings if needed.
      Then the Switch Node wakes up every x ms (synchronized with NodeSync) so it can receives buffer sent by NodeSync if command available. Each x seconds it receives the heartbeat again and resync.
      So this node is in desynchronized (if I click button, it sends directly to GW) and synchronized (if controller send command, node receives it from nodesync).

    For now it is basic, I don't care of repeater case (moreover I will use rfm69 in near future so maybe I won't need repeater I hope). it works but I have just 3 nodes testing this actually.

    Questions :

    • in my case, I have two networks : one normal desynchronized and one synchronized by the NodeSync. I did this because I didn't want to overload the GW with syncing work and miss msg.
      But, if GW debug logs is enabled, I can see that if NodeSync sends to a sync Switch (node to node comm), GW does not do anything (it's ok) but it reads it. So I am thinking if I cound not have a problem here.
      What if my NodeSync is sending its buffer (with for examples 20 commands stored), and my GW at same time receives a doorlock messages or anything else from the desynchronized network? Should I have data collisions in my GW? should my GW be flooded and should I lost some comms?

    • If yes, I think I am not doing things in good way. So it would be better to sync all the network and the GW should be the synchronizer. Another idea is the controller takes care of the sync. Or maybe an intermediate controller like node-red for example.
      I am trying to keep Mysensors topology and add syncing options..Don't know if I am doing right. And you, what do you think about this? Is someone already syncing his Mysensors network?


Log in to reply
 

Suggested Topics

  • 1
  • 10
  • 1
  • 5
  • 3
  • 6

42
Online

11.4k
Users

11.1k
Topics

112.7k
Posts