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

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
analogworld
Normal user
Posts: 16
Joined: 04 Nov 2019, 11:31

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

#1 Post by analogworld » 04 Nov 2019, 11:44

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.
Last edited by analogworld on 15 Dec 2019, 11:14, edited 2 times in total.

analogworld
Normal user
Posts: 16
Joined: 04 Nov 2019, 11:31

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

#2 Post by analogworld » 04 Nov 2019, 20:17

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?

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

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

#3 Post by TD-er » 04 Nov 2019, 21:06

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.

analogworld
Normal user
Posts: 16
Joined: 04 Nov 2019, 11:31

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

#4 Post by analogworld » 04 Nov 2019, 21:34

Thank you so much. There is enough material to study with your answer alone.

analogworld
Normal user
Posts: 16
Joined: 04 Nov 2019, 11:31

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

#5 Post by analogworld » 09 Nov 2019, 23:21

Thank you, now it works.

Best regards,

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 22 guests