using values in rules from a sending node which is connected per P2P network

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
parabacus
Normal user
Posts: 20
Joined: 17 May 2020, 21:16

using values in rules from a sending node which is connected per P2P network

#1 Post by parabacus » 17 May 2020, 22:13

Hello together!

I have some problem to use the values sent by Wemos node #1 named RWZ via P2P-Connection at a second Wemos node #2 mamed "Zisterne".
Both nodes are flashed with build version "ESPEasy_mega-20200410".

The node #1 ist configured like below:
- uniqe Unit Nr. 71
- UDP Port 8266
- Controller "ESPEasy P2P Networking" enabled
- 3 Tasks configured (Task 1 to 3) - every Task sends its values to P2P-Connection

https://www.letscontrolit.com/forum/dow ... ew&id=4740
https://www.letscontrolit.com/forum/dow ... ew&id=4742
https://www.letscontrolit.com/forum/dow ... ew&id=4744
https://www.letscontrolit.com/forum/dow ... ew&id=4746

The node #2 ist configured like below:
- uniqe Unit Nr. 34
- UDP Port 8266
- Controller "ESPEasy P2P Networking" enabled
- 3 Tasks were configured automatically (Task 1 to 3) - Port is the node #1 "RWZ"

https://www.letscontrolit.com/forum/dow ... ew&id=4741
https://www.letscontrolit.com/forum/dow ... ew&id=4743
https://www.letscontrolit.com/forum/dow ... ew&id=4745

In the Main sheet of both nodes I can see both untis. This shows me that the communication is running right.
In the Task list of node #2 every sent value from node #1 ist displayed correctly.

The problem is that it is not possible to use the received values by rules on node #2!

On system boot a debug variable is initialized with value 255.
Depending on the received state value (values 0 .. 10) sent by node #1 the corresponding LEDs should switched on at node #2.
It doesen't matter which value is received, the debug variable remains 255.

This is the rule 1:

Code: Select all

on System#Boot do
 gpio,0,0
 gpio,2,0
 gpio,12,0
 gpio,13,0
 gpio,14,0
 TaskValueSet 4,1,255
endon


On Zisterne#ZisternenStatus do // Status 0 = Leer / 10 = Voll

if [Zisterne#ZisternenStatus]=0.00
 gpio,0,0          // rote   LED    aus
 gpio,2,0          // gelbe  LED    aus
 gpio,12,0         // gelbe  LED    aus
 gpio,13,0         // gruene LED    aus
 gpio,14,0         // gruene LED    aus
 TaskValueSet 4,1,0
endif

if [Zisterne#ZisternenStatus]=1.00 or [Zisterne#ZisternenStatus]=2.00 
 gpio,0,1          // rote   LED    an
 gpio,2,0          // gelbe  LED    aus
 gpio,12,0         // gelbe  LED    aus
 gpio,13,0         // gruene LED    aus
 gpio,14,0         // gruene LED    aus
 TaskValueSet 4,1,1
endif

if [Zisterne#ZisternenStatus]=3.00 or [Zisterne#ZisternenStatus]=4.00
 gpio,0,1          // rote   LED    an
 gpio,2,1          // gelbe  LED    an
 gpio,12,0         // gelbe  LED    aus
 gpio,13,0         // gruene LED    aus
 gpio,14,0         // gruene LED    aus
 TaskValueSet 4,1,2
endif

if [Zisterne#ZisternenStatus]=5.00 or [Zisterne#ZisternenStatus]=6.00
 gpio,0,1          // rote   LED    an
 gpio,2,1          // gelbe  LED    an
 gpio,12,1         // gelbe  LED    an
 gpio,13,0         // gruene LED    aus
 gpio,14,0         // gruene LED    aus
 TaskValueSet 4,1,3
endif

if [Zisterne#ZisternenStatus]=7 or [Zisterne#ZisternenStatus]=8
 gpio,0,1          // rote   LED    an
 gpio,2,1          // gelbe  LED    an
 gpio,12,1         // gelbe  LED    an
 gpio,13,1         // gruene LED    an
 gpio,14,0         // gruene LED    aus
 TaskValueSet 4,1,4
endif

if [Zisterne#ZisternenStatus]=9 or [Zisterne#ZisternenStatus]=10
 gpio,0,1          // rote   LED    an
 gpio,2,1          // gelbe  LED    an
 gpio,12,1         // gelbe  LED    an
 gpio,13,1         // gruene LED    an
 gpio,14,1         // gruene LED    an
TaskValueSet 4,1,5
endif

endon
Here the log from node2 - the value is received right!

Code: Select all

43921181: Dummy: value 1: 255.00
43921246: EVENT: Debug#Info=255.00
43923139: WD   : Uptime 732 ConnectFailures 0 FreeMem 17992 WiFiStatus 3
43927646: EVENT: Zisterne#ZisternenStatus=4.00
43953139: WD   : Uptime 733 ConnectFailures 0 FreeMem 18016 WiFiStatus 3
43957646: EVENT: Zisterne#ZisternenStatus=4.00
43981181: Dummy: value 1: 255.00
43981246: EVENT: Debug#Info=255.00
43983139: WD   : Uptime 733 ConnectFailures 0 FreeMem 16424 WiFiStatus 3
43987646: EVENT: Zisterne#ZisternenStatus=4.00
44008981: Rules : Save rulesSet: 1 currentSet: 2
44009140:  Webserver args: 0: 'set' length: 1 1: 'rules' length: 1399
44013139: WD   : Uptime 734 ConnectFailures 0 FreeMem 18016 WiFiStatus 3
44017605: EVENT: Zisterne#ZisternenStatus=4.00
44041181: Dummy: value 1: 255.00
44041205: EVENT: Debug#Info=255.00
44043139: WD   : Uptime 734 ConnectFailures 0 FreeMem 18016 WiFiStatus 3
What is the secret?
Attachments
04_RWZ_Main.jpg
04_RWZ_Main.jpg (86.31 KiB) Viewed 10318 times
03_Zisterne_Devices.jpg
03_Zisterne_Devices.jpg (74.9 KiB) Viewed 10318 times
03_RWZ_Devices.jpg
03_RWZ_Devices.jpg (84.89 KiB) Viewed 10318 times
02_Zisterne_Controller.jpg
02_Zisterne_Controller.jpg (24.49 KiB) Viewed 10318 times
02_RWZ_Controller.jpg
02_RWZ_Controller.jpg (27.46 KiB) Viewed 10318 times
01_Zisterne_Config.jpg
01_Zisterne_Config.jpg (22.25 KiB) Viewed 10318 times
01_RWZ_Config.jpg
01_RWZ_Config.jpg (17.84 KiB) Viewed 10318 times

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

Re: using values in rules from a sending node which is connected per P2P network

#2 Post by TD-er » 18 May 2020, 00:15

You should probably use taskvaluesetandrun or taskvalueset followed by taskrun.
See the command reference: https://espeasy.readthedocs.io/en/lates ... nds-listed

parabacus
Normal user
Posts: 20
Joined: 17 May 2020, 21:16

Re: using values in rules from a sending node which is connected per P2P network

#3 Post by parabacus » 18 May 2020, 08:32

Sorry, but I think you haven't understood my problem right ..

On system boot I set the debug variable per "TaskValueSet 4,1,255" - this works!

With the debug variable I want to check the IF-Statements and because the check of "On Zisterne#ZisternenStatus do ..." dosen't work in the way I expected the value of the debug variable never changes - an the LEDs won't switched on or off.

Can you tell me, why the evaluation of "On Zisterne#ZisternenStatus do ..." dosen't work?
I'm confused becaus the log shows me the right received values.
On the sending node #1 RWZ I use the same logic and it works.

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

Re: using values in rules from a sending node which is connected per P2P network

#4 Post by TD-er » 18 May 2020, 11:28

Are you sure it enters this part?

Code: Select all

On Zisterne#ZisternenStatus do 
You can add a logentry (is a command) to track whether it does pass this trigger at all.

What I think is happening, is that the value may get updated, but if you don't "run" the task, it will not send an event to signal the value is actually updated.
So that's why I suggested to try calling taskrun.

parabacus
Normal user
Posts: 20
Joined: 17 May 2020, 21:16

Re: using values in rules from a sending node which is connected per P2P network

#5 Post by parabacus » 18 May 2020, 15:30

Now I am littel step further..

I'm sure that the first If-Statemen "On Zisterne#ZisternenStatus do" will be entered. :D
I have added a instruction to write a log info like you suggested - thank you for the hint!

Code: Select all

On System#Boot do
 gpio,0,1
 gpio,2,0
 gpio,12,0
 gpio,13,0
 gpio,14,0
 TaskValueSet 4,1,255
endon

On Zisterne#ZisternenStatus do // Status 0 = Leer / 10 = Voll

LogEntry,EZ

if [Zisterne#ZisternenStatus]=0.00
LogEntry,S_0
 gpio,0,0          // rote   LED aus
 gpio,2,0          // gelbe  LED aus
 gpio,12,0         // gelbe  LED aus
 gpio,13,0         // gruene LED aus
 gpio,14,0         // gruene LED aus
 TaskValueSet 4,1,12
endif

if [Zisterne#ZisternenStatus]=1.00 or [Zisterne#ZisternenStatus]=2.00 
LogEntry,S_1_2
 gpio,0,1          // rote   LED an
 gpio,2,0          // gelbe  LED aus
 gpio,12,0         // gelbe  LED aus
 gpio,13,0         // gruene LED aus
 gpio,14,0         // gruene LED aus
 TaskValueSet 4,1,1
endif

if [Zisterne#ZisternenStatus]=3.00 or [Zisterne#ZisternenStatus]=4.00
LogEntry,S_3_4
 gpio,0,1          // rote   LED an
 gpio,2,1          // gelbe  LED an
 gpio,12,0         // gelbe  LED aus
 gpio,13,0         // gruene LED aus
 gpio,14,0         // gruene LED aus
 TaskValueSet 4,1,2
endif

...
endon
Here is the log for this:

Code: Select all

8817202: EVENT: Fuellstand_Zisterne_Liter#Liter=1566.21
8823670: WD   : Uptime 147 ConnectFailures 0 FreeMem 18456 WiFiStatus 3
8824602: EVENT: Zisterne#ZisternenStatus=3.00
8828225: Upload: START, filename: rules1.txt
8828324: Upload: WRITE, Bytes: 1977
8828325: Upload: END, Size: 1977
8828479:  Webserver args: 0: 'enctype' length: 19
8828543: CRC  : SecuritySettings CRC   ...OK 
8832636: EVENT: Fuellstand_Zisterne#Fuellstand=157.33
8835114: EVENT: Clock#Time=Thu,07:10
8847142: EVENT: Fuellstand_Zisterne_Liter#Liter=1566.21
8853670: WD   : Uptime 148 ConnectFailures 0 FreeMem 18480 WiFiStatus 3
8854536: EVENT: Zisterne#ZisternenStatus=3.00
8854544: ACT  : LogEntry,EZ
8854545: Command: LogEntry
8854546: EZ
8858914: Dummy: value 1: 255.00
8858936: EVENT: Debug#Info=255.00
8862636: EVENT: Fuellstand_Zisterne#Fuellstand=157.37
8877142: EVENT: Fuellstand_Zisterne_Liter#Liter=1566.21
8883670: WD   : Uptime 148 ConnectFailures 0 FreeMem 18480 WiFiStatus 3
8884536: EVENT: Zisterne#ZisternenStatus=3.00
8884544: ACT  : LogEntry,EZ
8884545: Command: LogEntry
8884546: EZ
8892636: EVENT: Fuellstand_Zisterne#Fuellstand=157.32
8895115: EVENT: Clock#Time=Thu,07:11
Now it is clear that the follwoing IF-Statement are not passed.

Code: Select all

if [Zisterne#ZisternenStatus]= ...
A second log entry doesn't occure.

Is it possible that the evaluation of the received values is not feasible?

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

Re: using values in rules from a sending node which is connected per P2P network

#6 Post by ThomasB » 18 May 2020, 18:36

Image

Please ENABLE all the plugins with the Red X in them. The Red X should be changed to the Green Check Mark.

- Thomas

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

Re: using values in rules from a sending node which is connected per P2P network

#7 Post by TD-er » 18 May 2020, 22:32

Ah good to see someone is more clear-headed than I am/was.
Thanks Thomas (as always)

parabacus
Normal user
Posts: 20
Joined: 17 May 2020, 21:16

Re: using values in rules from a sending node which is connected per P2P network

#8 Post by parabacus » 20 May 2020, 20:14

Hm - it sounds like an easy problem solving... - but...

Ich have enabled the thre Tasks and since I have done this, the variable names of Task 2 an Task 3 have changed to Dummy! :shock:
Only the first Task is displayed correctly. At the sending node the names remain unchanged!

https://www.letscontrolit.com/forum/dow ... ew&id=4752

One question about enabling the tasks on the reciving node. I have read the explanation, but in this description I don't find this to do.
https://espeasy.readthedocs.io/en/lates ... /C013.html

I will start from the beginning...
Attachments
03_Zisterne_Devices_02.jpg
03_Zisterne_Devices_02.jpg (84.81 KiB) Viewed 10186 times

parabacus
Normal user
Posts: 20
Joined: 17 May 2020, 21:16

Re: using values in rules from a sending node which is connected per P2P network

#9 Post by parabacus » 20 May 2020, 20:41

I have started new - on both nodes I have confiured P2P connection from the start.
It looks like before since I enabled the Task 2 with the desired variable name which I want to use in the rule. After this the variable name was changed again from ZisternenStatus to Dummy . In the log I saw Zisterne#Dummy=2.00

And now I modified the rule code using "new" variable name Dummy in Task 2:

Code: Select all

On Zisterne#Dummy do // Status 0 = Leer / 10 = Voll

LogEntry,EZ

if [Zisterne#Dummy]=0.00
LogEntry,S_0
 gpio,0,0          // rote   LED aus
 gpio,2,0          // gelbe  LED aus
 gpio,12,0         // gelbe  LED aus
 gpio,13,0         // gruene LED aus
 gpio,14,0         // gruene LED aus
 TaskValueSet 4,1,0
endif

if [Zisterne#Dummy]=1.00 or [Zisterne#Dummy]=2.00
LogEntry,S_1_2
 gpio,0,1          // rote   LED an
 gpio,2,0          // gelbe  LED aus
 gpio,12,0         // gelbe  LED aus
 gpio,13,0         // gruene LED aus
 gpio,14,0         // gruene LED aus
 TaskValueSet 4,1,1
endif
Now it works!!!

Code: Select all

273892: WD   : Uptime 5 ConnectFailures 0 FreeMem 18680 WiFiStatus 3
282778: EVENT: Fuellstand_Zisterne#Fuellstand=183.00
289544: SW   : GPIO 13 Set to 0
289546: ACT  : gpio,14,0
289548: Command: gpio
289549: SW   : GPIO 14 Set to 0
289552: ACT  : TaskValueSet 4,1,1
289553: Command: TaskValueSet
289595: EVENT: Zisterne#=0.00
289677: EVENT: Zisterne#=0.00
289777: EVENT: Zisterne#=0.00
289877: EVENT: Fuellstand_Zisterne_Liter#Liter=767.75
289977: EVENT: Fuellstand_Zisterne_Liter#=0.00
290077: EVENT: Fuellstand_Zisterne_Liter#=0.00
290177: EVENT: Fuellstand_Zisterne_Liter#=0.00
301122: Dummy: value 1: 1.00
301177: EVENT: Debug#Info=1.00
301277: EVENT: Debug#=0.00
301377: EVENT: Debug#=0.00
301477: EVENT: Debug#=0.00
303892: WD   : Uptime 5 ConnectFailures 0 FreeMem 18704 WiFiStatus 3
312777: EVENT: Fuellstand_Zisterne#Fuellstand=183.42
314336: EVENT: Clock#Time=Thu,02:17
319539: SW   : GPIO 12 Set to 0
319541: ACT  : gpio,13,0
319542: Command: gpio
319544: SW   : GPIO 13 Set to 0
319546: ACT  : gpio,14,0
319547: Command: gpio
319549: SW   : GPIO 14 Set to 0
319551: ACT  : TaskValueSet 4,1,1
319553: Command: TaskValueSet
319630: EVENT: Zisterne#=0.00
319739: EVENT: Zisterne#=0.00
319806: EVENT: Zisterne#=0.00
319877: EVENT: Fuellstand_Zisterne_Liter#Liter=767.75
319977: EVENT: Fuellstand_Zisterne_Liter#=0.00
320077: EVENT: Fuellstand_Zisterne_Liter#=0.00
320178: EVENT: Fuellstand_Zisterne_Liter#=0.00
333892: WD   : Uptime 6 ConnectFailures 0 FreeMem 18704 WiFiStatus 3
Very, very strange für me...! :roll:
I think this not the way it schould work?

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

Re: using values in rules from a sending node which is connected per P2P network

#10 Post by ThomasB » 20 May 2020, 21:15

I think this not the way it should work?
Glad you found a workaround. I agree, the slave P2P Dummy device name should not have been reset to "dummy." And since the master Dummy device is single output data type, the slave should also be single output (instead of four data output). I suggest opening a github issue on this.

BTW, it would be more efficient to use one Dummy device for your two variables; A single Dummy device can hold four vars. Fine print: Given the odd P2P behavior you are seeing, I suspect this kind of usage will also be broken.

- Thomas

parabacus
Normal user
Posts: 20
Joined: 17 May 2020, 21:16

Re: using values in rules from a sending node which is connected per P2P network

#11 Post by parabacus » 21 May 2020, 11:32

Hey Thomas,

yes I know that all variabels in one Task wil be more efficient, but for the start I tried it this way and for the final solution I need only one information about the filling status of my rain water reservoir.
Perhaps it is planed later to connect a display to show more detailed information but for now this will be enough.

Thank you for your support also to TD-er!

Who will open the issue for this on github? I have no experience for this till yet.

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

Re: using values in rules from a sending node which is connected per P2P network

#12 Post by ThomasB » 21 May 2020, 22:38

Who will open the issue for this on github? I have no experience for this till yet.
Fixes to ESPEasy are unlikely if they only get discussed on the forum. So that is why you need to officially report the issue on Github. Here is the link:
https://github.com/letscontrolit/ESPEasy/issues

- Thomas

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 31 guests