P2P networking node monitoring?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
StuT
New user
Posts: 1
Joined: 26 Jun 2019, 17:02

P2P networking node monitoring?

#1 Post by StuT » 26 Jun 2019, 17:52

Hello,

I’m hoping some can help.

I currently have 5 ESPs set up as 4 temperature sensors (MEE280s) and one main host unit with a Nextion display, 4 NeoPixels and some other bits connected. The 4 sensors send temperature data to the host to display on the screen and control the colour of the NeoPixels. They communicate using ESPEasy P2P networking and are all running build mega-20190626. It all works great.

My Question:
Is there a way for the host to know it the nodes have disappeared for some reason? (i.e. they lost network connection or lost power.)
Can I create a rule to some how check the system message being sent from the node over UDP or even just check the age of each of the four nodes by unit number?
I just need to display on the main unit if each node is on and or connected to the network.

Open to suggestions and any help very much appreciated.

Thank you.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: P2P networking node monitoring?

#2 Post by ThomasB » 26 Jun 2019, 20:39

The typical way is to use timer rules on the host. One timer for each temperature sensor. The sensor data would be configured to report periodically, for example once every 30 secs.

When the temperature data is received from a sensor its assigned timer is re-initialized to a period that is 2X longer than the sensor's reporting period. A missed temperature reading will allow the timer rule to expire. And if a timer rule has expired then the sensor is offline.The timer rule can report the offline status on the display.

- Thomas

borre
Normal user
Posts: 15
Joined: 27 Feb 2020, 14:53

Re: P2P networking node monitoring?

#3 Post by borre » 27 Feb 2020, 15:22

ThomasB wrote: 26 Jun 2019, 20:39 The typical way is to use timer rules on the host. One timer for each temperature sensor. The sensor data would be configured to report periodically, for example once every 30 secs.

When the temperature data is received from a sensor its assigned timer is re-initialized to a period that is 2X longer than the sensor's reporting period. A missed temperature reading will allow the timer rule to expire. And if a timer rule has expired then the sensor is offline.The timer rule can report the offline status on the display.

- Thomas
But what is the remote/client sensors dont report on frequent time?

I have 4 machine's that give a signal to a esp client when the machine busy or idle.
that signal is passed through to the host.

The host stay's always on.
the clients turns off sometimes.
when that happens, the status of that client on the host stay's the same.

Is there a way to check if a client is online?
Or is there a way on the host to send a request to the client for a update about the signal status?


I use 5 times ESP12E
Git Build: mega-20191103
controller: ESPEasy P2P Networking
UDP port: all the same
SSID: all the same

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: P2P networking node monitoring?

#4 Post by ThomasB » 27 Feb 2020, 18:11

But what is the remote/client sensors dont report on frequent time?
If they are battery powered then I can understand why they don't report very often. But if they are mains powered then simply create a timer rule to periodically report to the host.
... the clients turns off sometimes.
I suppose you mean they go to sleep to conserve battery power. Or perhaps the ESPEasy devices are mains powered and sometimes they are turned off when the machine is not being used.
Or is there a way on the host to send a request to the client for a update about the signal status?
Using ESPEasy's Event rules the device could send its RSSI; This action can be triggered by http request from the host. But like the timer idea, the device must be awake to reply.

So in your case, if your host triggered Event rule does not reply back with the RSSI then the host could determine the device is offline. But this sort of solution can also be handled by the timer idea that was originally proposed.

- Thomas

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

Re: P2P networking node monitoring?

#5 Post by TD-er » 28 Feb 2020, 16:12

The ESP nodes also "announce" themselves via P2P as can be seen in the table on the main page.
The last column shows the most recent activity (max. 10 minutes), so I guess it could be useful to add the feature to fire an event when a node is first seen (will be forgotten after 10 minutes, so after that it is again "first seen) and when it will be forgotten.

If you like that idea, please add it as a feature request on GitHub.
Maybe we can also make this "time to forget" configurable.

borre
Normal user
Posts: 15
Joined: 27 Feb 2020, 14:53

Re: P2P networking node monitoring?

#6 Post by borre » 04 Jun 2020, 15:53

ThomasB wrote: 27 Feb 2020, 18:11
But what is the remote/client sensors dont report on frequent time?
If they are battery powered then I can understand why they don't report very often. But if they are mains powered then simply create a timer rule to periodically report to the host.
How can a client report the state to a host?
Do you have a example code?

[update]

ah found it, its realy simple
on the CLIENT under devices add a amount of seconds under "interval"
I used 5 seconds, now the CLIENT updates the state of that device every 5 clients to the HOST (through "ESPEasy P2P Networking")

Now by the HOST under rules, I have this:

Code: Select all

//5
on MONA#state do
	if [MONA#state]=1
		gpio,14,1
		timerSet,5,10
	else
		gpio,14,0
	endif
endon
On Rules#Timer=5 do  
		gpio,14,0
endon
client 5 (MONA) shares here state, when she does that, and state =1
then I set gpio14 to 1, and set timer5 to 10 seconds.
if timer5 is finish after 10 seconds, then it puts gpio14 to 0
BUT if within those 10 seconds client MONA shares here state again and the state = 1 then gpio14 is set to 1 again and timer5 is reset to 10 seconds again.
ect, ect, ect

still 2 more question.

1. Is the a option in rules to detect when a unit is connected to the "ESPEasy P2P Networking" controller.
something like:

Code: Select all

on MQTT#Connected do
OR

Code: Select all

WiFi#Connected
2. And is there a way in rules to manual push the state of device to the "ESPEasy P2P Networking" controller?

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: P2P networking node monitoring?

#7 Post by ThomasB » 08 Jun 2020, 23:20

still 2 more question.
Q1: AFAIK, this is not implemented and appears to be a variation of the OP's question.
Q2: Perhaps the sendto command will help do what you have in mind.

The P2P networking "controller" is really just a global syncing feature (and was called that in earlier releases). For a more sophisticated approach, that can do the things you mentioned, I'd suggest adding a MQTT broker.

- Thomas

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

Re: P2P networking node monitoring?

#8 Post by TD-er » 09 Jun 2020, 09:12

Just a thought, not sure if it will work.
If you use a remote task (one configured on node 1 and shared via p2p to node 2), the task on node 2 should send out an event if it is changing values.
So in the rules you should be able to trigger on such event.

You should also be able to send an event via p2p, as you can send a command to another node via SendToUDP
So you can send the command "event" with your own event.
Such an event you can use in a rule to trigger something. For example to start a timer.
If that timer does not get reset by the remote node, you can take action via the rules.

See: https://espeasy.readthedocs.io/en/lates ... mmand.html

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests