P2P Node status event ?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
eijo
New user
Posts: 4
Joined: 16 Feb 2024, 09:10

P2P Node status event ?

#1 Post by eijo » 16 Feb 2024, 09:35

Hi,

Background:
I have built a quite large setup with 15 ESPEasy powered nodes, mix of ESP8266 and ESP32, to control a quite large analog H0 model railway from 1970th.

In General, it all works as a charm 8-)

Issue:
However sometimes I have issues to get all nodes up and everything initiated in correct order. Since it's mechatronics involved it's critical.

Question:
Is it possible to get an event for the node status for another node that is seen in the main tab in the GUI?

Haven't found anything in the documentation about it. Am I missing something?

User avatar
chromo23
Normal user
Posts: 827
Joined: 10 Sep 2020, 16:02
Location: germany

Re: P2P Node status event ?

#2 Post by chromo23 » 16 Feb 2024, 11:35

Hi,

there are several types of events you could use in rules.
Like when the node boots or connects to the WiFi:

Code: Select all

On System#Boot Do
  //code that will run when the unit boots
Endon

On WiFi#Connected Do
  //code that will run when the the node connects to the WiFi
Endon
eijo wrote: 16 Feb 2024, 09:35 Issue:
However sometimes I have issues to get all nodes up and everything initiated in correct order. Since it's mechatronics involved it's critical.
To help you better it would be good to understand what you mean by "get all nodes up" and "initiated in correct order"
eijo wrote: 16 Feb 2024, 09:35 Question:
Is it possible to get an event for the node status for another node that is seen in the main tab in the GUI?
You could use the rules example above and send an event to the "main" node:

Code: Select all

On WiFi#Connected Do
 SendTo,1,'Event,Connected=%unit%'. //send the event "connected" to the unit number 1 and also send the units own unit number
Endon
And the Rules example for the receiving node would be:

Code: Select all

On Connected Do
  LogEntry,'Unit %eventvalue1% just connected to the WiFi'. //example output would be "HTTP: LogEntry,'Unit 5 just connected to the WiFi'
Endon

Edit:

Links to the documentation:
https://espeasy.readthedocs.io/en/lates ... nd-publish
https://espeasy.readthedocs.io/en/lates ... tem-events

eijo
New user
Posts: 4
Joined: 16 Feb 2024, 09:10

Re: P2P Node status event ?

#3 Post by eijo » 16 Feb 2024, 17:26

Thank you for your prompt reply!

Yes I think that you have proposed exactly what I need. I will try that during this weekend if I find some time to spend on this hobby-project :)

I have added a mechanism to make sure that all nodes are initiated and that all rail-switches are in a known positions - it works 60-70% of each power up - but not always. I guess that there is a time race between the nodes to get their Wifi - connections from my router, and that some nodes get their connection before the main node sometimes - even if I added quite long time after WiFi#Connected event in the "not main nodes". The router is quite old and dedicated just for the railway.

User avatar
chromo23
Normal user
Posts: 827
Joined: 10 Sep 2020, 16:02
Location: germany

Re: P2P Node status event ?

#4 Post by chromo23 » 16 Feb 2024, 18:21

Interesting approach doing all the controlling with ESPEasy nodes :)
That reminds me that under my model railway the where huge amounts of tangled cable and so i had to spend quite some time unter the table when something was wrong...o well... i was young and my body didn´t bother :)

eijo wrote: 16 Feb 2024, 17:26 Yes I think that you have proposed exactly what I need.
I think so too. And there is so much more you can do with rules which makes it easy to come up with a solution to "synchronize" your nodes.
I would be happy to see your installation. :)

eijo
New user
Posts: 4
Joined: 16 Feb 2024, 09:10

Re: P2P Node status event ?

#5 Post by eijo » 16 Feb 2024, 19:46

A bit of topic, but very fun :D , i have also this experience with all wiring harness under the model railway when I was young - and spending hours under it to make it working. :roll:

At the time, maybe 14 years old I had a vague idea about controlling the Fleischmann railway with my Sinclair computer, but I didn't have the skills, money and maybe thechnology wasen't there either to realize it. Now more then 40 years later I suddenly realized that I probably cold make reality of my old idea, and ESPEasy is defitely one of the building block in this. 8-)

From my "man cave"... still some harness though...
20240216_202040.jpg
20240216_202040.jpg (1000.51 KiB) Viewed 343 times

eijo
New user
Posts: 4
Joined: 16 Feb 2024, 09:10

Re: P2P Node status event ?

#6 Post by eijo » 18 Feb 2024, 10:30

chromo23 by using your examples I could verify my time race issue fort the nodes to get WiFi connection from my old router. I ended up with adding a relay controlled by the main node that enables power to all other nodes after WiFi has status connected. Has worked 10 of 10 times now.

Thank you for your support! :)

User avatar
chromo23
Normal user
Posts: 827
Joined: 10 Sep 2020, 16:02
Location: germany

Re: P2P Node status event ?

#7 Post by chromo23 » 21 Feb 2024, 16:40

eijo wrote: 18 Feb 2024, 10:30 Thank you for your support! :)
You are welcome. :)

What are the green things with what it seems red and black buttons on your control board?

TD-er
Core team member
Posts: 8739
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: P2P Node status event ?

#8 Post by TD-er » 21 Feb 2024, 17:10

chromo23 wrote: 21 Feb 2024, 16:40 [...]
What are the green things with what it seems red and black buttons on your control board?
Looks like buttons to control rail switches to direct a train to a different section of the track.
Marklin has them in blue with red and green buttons (at least those old ones I had)

User avatar
chromo23
Normal user
Posts: 827
Joined: 10 Sep 2020, 16:02
Location: germany

Re: P2P Node status event ?

#9 Post by chromo23 » 21 Feb 2024, 17:19

Ahhh.. i only had these:
IMG_4990.jpeg
IMG_4990.jpeg (147.88 KiB) Viewed 251 times
I really loved how they could be used as a push button and a switch..

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests