send data via rules to another device

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
NetEye
Normal user
Posts: 51
Joined: 22 Jun 2016, 00:48

send data via rules to another device

#1 Post by NetEye » 27 Sep 2019, 14:42

Dear,
I want to send or read data from one device to another, I hope somebody can help me with this.
Perhaps the same was asked before, but a similar task I did not found.

On the first NodeMCU called ESP1 (DigiDash 1) I have "Accu1" = Task 8 and "Accu2" = Task 9 (192.168.3.104)
On the second there is ESP3 (DigiDash 3) there I have "Accu keuze 1 of 2" = Task 5 (192.168.3.107)
When "Accu1" has a value of for instance 22.5V on ESP1 I want a rule that switches "Accu keuze 1 of 2" on ESP3 (DigiDash 3) to 1.
And when "Accu2" has a value of for instance 22.5V on ESP1 its has to switch "Accu keuze 1 of 2" on ESP3 (DigiDash 3) to 0.
With searching in the tutorial I made (Maybe you can correct it or complete it).

Switch to 1:

On ESP1 rule:

on Accu1#Voltage=22.5 do
SendToHTTP 192.168.3.107,80,/control?cmd=event, Accu keuze 1 of 2 ?????command?????
endon


On ESP3 rule:

on Accu keuze 1 of 2 ?????command????? do
pcfgpio,67,1 //Accu keuze 1 of 2 switch naar 1, and 67 stands for ESPEasy port nr
endon



Switch to back to 0:

On ESP1 rule:

on Accu2#Voltage=22.5 do
SendToHTTP 192.168.3.107,80,/control?cmd=event, Accu keuze 1 of 2 ?????command?????
endon


On ESP3 rule:

on Accu keuze 1 of 2 ?????command????? do
pcfgpio,67,0 //Accu keuze 1 of 2 switch naar 0, and 67 stands for ESPEasy port nr
endon


If this works I want also do something with Gell accu 3 (calls now: "Accu3"), I then want him to switch another switch on ESP3 (that's for later ;-) )
Thanks for your time.
NetEye
Attachments
5 devices.png
5 devices.png (276.74 KiB) Viewed 8237 times
6 devices.png
6 devices.png (297.81 KiB) Viewed 8237 times
5 devices.PNG
5 devices.PNG (428.63 KiB) Viewed 8237 times

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: send data via rules to another device

#2 Post by grovkillen » 29 Sep 2019, 17:17

First I would like you to download latest version of ESP Easy. Then we'll talk ;)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: send data via rules to another device

#3 Post by kimot » 01 Oct 2019, 23:17

First I suggest do not use =22.5 but better >22.5.
You can easily miss exact value.

Switch to 1:

On ESP1 rule:

on Accu1#Voltage>22.5 do
SendToHTTP 192.168.3.107/control?cmd=event,Accu1
endon

On ESP3 rule:

on Accu1 do
pcfgpio,67,1 //Accu keuze 1 of 2 switch naar 1, and 67 stands for ESPEasy port nr
endon


Switch to back to 0:

On ESP1 rule:

on Accu2#Voltage>22.5 do
SendToHTTP 192.168.3.107/control?cmd=event,Accu2
endon

On ESP3 rule:

on Accu2 do
pcfgpio,67,0 //Accu keuze 1 of 2 switch naar 0, and 67 stands for ESPEasy port nr
endon

NetEye
Normal user
Posts: 51
Joined: 22 Jun 2016, 00:48

Re: send data via rules to another device

#4 Post by NetEye » 03 Oct 2019, 09:36

Dear Kimot,
Wow, thanks,
I will try the rule.
I’ll be back 👊

NetEye
Normal user
Posts: 51
Joined: 22 Jun 2016, 00:48

Re: send data via rules to another device

#5 Post by NetEye » 04 Oct 2019, 16:46

Dear Kimot,
I changed > higher to < smaller (voltage drops).
The words Accu1 and Accu2 does nothing on ESP3, it does not change the values from 0 to 1 or reverse.
Pity.
Maybe you know the solution or else I have to do it manualy.
Regards and nice weekend

NetEye
Normal user
Posts: 51
Joined: 22 Jun 2016, 00:48

Re: send data via rules to another device

#6 Post by NetEye » 05 Oct 2019, 16:37

Maybe ,80, is the issue?

SendToHTTP 192.168.3.107,80,/control?cmd=event,Accu2

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: send data via rules to another device

#7 Post by kimot » 05 Oct 2019, 17:28

I am not using port number and it works in my system:
( 192.168.1.102 is IP address my ESPeasy thermostat )


2019-10-05-171547_1920x1080_scrot.png
2019-10-05-171547_1920x1080_scrot.png (154.33 KiB) Viewed 7754 times
But I am not using Mega version - it is absolutely inapplicable for me and my rules.

I am using v2.0-20180322

And here are my rules for switch, which can be triggered by pressing local switch, sending events lamp_on or lamp_off from Domoticz
or even lamp_change from other ESP.
Actual state of relay is reported back to Domoticz.

Code: Select all

on lamp_on do
    gpio,12,1   // sepnuti rele
    gpio,13,0  // rozsviceni LED
endon

on lamp_off do
    gpio,12,0
    gpio,13,1
endon

on lamp_change do
  if [rele#Switch]=1        // jestliže je rele v sepnutem stavu
    event,lamp_off           // tak ho vypni
    SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=19&switchcmd=Off        // pošli aktuální stav do Domoticz
  else
    event,lamp_on
    SendToHTTP 192.168.1.253,8080,/json.htm?type=command&param=switchlight&idx=19&switchcmd=On
  endif
endon

on SW01#Switch do          // jestliže bylo stisknuto tlačítko
  event,lamp_change        // změň stav rele
endon

NetEye
Normal user
Posts: 51
Joined: 22 Jun 2016, 00:48

Re: send data via rules to another device

#8 Post by NetEye » 05 Oct 2019, 17:36

Impressive to see what people can make.
I will stroggle on.
I think I’am almost there
Thanks kimot

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests