Page 1 of 1

[solved]rules that take into account status of other easpeasy device.

Posted: 04 Nov 2019, 11:44
by analogworld
Hello,

I''m using 4 electrodragon dual switch which is esp8266 based : https://www.electrodragon.com/product/w ... d-esp8266/
(of course I've flashed espeasy on it)

For each of them, I'm monitoring gpio 5 in the from of value in the variable th_low#state

I'have the following rule for each:

Code: Select all

on th_low#state do
If [th_low#state]=1 and [relay1#state]=0 
     gpio,13,1
else
     gpio,13,0
endif 
endon
I would like to add a rule that takes into account the status of all 3 gpio status of the other electrodragon like th_low#state_1, th_low#state_2,th_low#state_3, th_low#state_4

it could look like this at the end:

Code: Select all

on th_low#state do
totalstate=th_low#state_1 + th_low#state_2 +th_low#state_3 + th_low#state_4

If [th_low#state]=1 and [relay1#state]=0 and totalstate>3
     gpio,13,1
else
     gpio,13,0
endif 
endon
it is for home made hvac regulation, I will show you my setup for those who are interested, it is quite interesting.

Re: rules that take into account status of other easpeasy device.

Posted: 04 Nov 2019, 20:17
by analogworld
What do you think of a creating another rule that will publishevery 30s the gpio5 status of each espeasy?

Is it possible then to create a variable then that will sum all status?

Re: rules that take into account status of other easpeasy device.

Posted: 04 Nov 2019, 21:06
by TD-er
You can share plugins via the p2p controller to another node. See https://espeasy.readthedocs.io/en/lates ... #c013-page
Note that the task index should be the same on sending and receiving end and that you must have a unit number set.
So you could have the switch plugin (with that GPIO) on tasknr 1 for unit 1, tasknr2 on unit2 etc...
Then share these to unit 13 via the p2p protocol.
On unit13, you could then run rules (even triggered on an update of a value) which does the computations and store them in a variable.

Re: rules that take into account status of other easpeasy device.

Posted: 04 Nov 2019, 21:34
by analogworld
Thank you so much. There is enough material to study with your answer alone.

Re: rules that take into account status of other easpeasy device.

Posted: 09 Nov 2019, 23:21
by analogworld
Thank you, now it works.

Best regards,