switch relay sending command from another esp

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
megamarco83
Normal user
Posts: 230
Joined: 13 Apr 2017, 23:09

switch relay sending command from another esp

#1 Post by megamarco83 » 24 Dec 2018, 01:03

Hi, i have n°2 esp
ESP 192.168.0.157 has a relay as sitch impunt on GPIO 14

ESP 192.168.0.155 has a wall switch (push button) on GPIO13

how i can use the wall switch to turn on / off the relay on ESP 157?

i set a rule:

Code: Select all

on pulsante155#Switch do
  if [pulsante155#Switch]=1
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0
  else
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,1
  endif
endon
but is not working.
but, if i write the command SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0
inside the web page of espeasy tools it works

User avatar
enesbcs
Normal user
Posts: 587
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: switch relay sending command from another esp

#2 Post by enesbcs » 24 Dec 2018, 08:50

megamarco83 wrote: 24 Dec 2018, 01:03

Code: Select all

on pulsante155#Switch do
  if [pulsante155#Switch]=1
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0
  else
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,1
  endif
endon
but is not working.
but, if i write the command SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0
inside the web page of espeasy tools it works
Try this:

Code: Select all

on pulsante155#Switch do
  if [pulsante155#Switch]>0
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0
  else
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,1
  endif
endon
If this not works, you can always use "sendto,unitnum,command" after enabling the same (udp) port in the Advanced settings.

megamarco83
Normal user
Posts: 230
Joined: 13 Apr 2017, 23:09

Re: switch relay sending command from another esp

#3 Post by megamarco83 » 24 Dec 2018, 09:54

enesbcs wrote: 24 Dec 2018, 08:50 Try this:

Code: Select all

on pulsante155#Switch do
  if [pulsante155#Switch]>0
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0
  else
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,1
  endif
endon
If this not works, you can always use "sendto,unitnum,command" after enabling the same (udp) port in the Advanced settings.
is it now workin.
my unit number has the last numbers of ip, so i try also this:

Code: Select all

on pulsante155#Switch do
on pulsante155#Switch do
  if [pulsante155#Switch]>0
    SendTo,157,/control?cmd=GPIO,14,0
  else
    SendTo,157,/control?cmd=GPIO,14,1
  endif
endon
but is still not working...why? :(

if i write this in web page of espeasy inside space for "command" i see "ok" but the relay is not turned ON / OFF
SendTo,157,/control?cmd=GPIO,14,0
SendTo,157,/control?cmd=GPIO,14,1


if i write this in web page of espeasy inside space for "command" i see "ok" but the relay is turned ON / OFF
SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,1
SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0

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

Re: switch relay sending command from another esp

#4 Post by grovkillen » 24 Dec 2018, 10:18

megamarco83 wrote: 24 Dec 2018, 09:54
enesbcs wrote: 24 Dec 2018, 08:50 Try this:

Code: Select all

on pulsante155#Switch do
  if [pulsante155#Switch]>0
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0
  else
    SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,1
  endif
endon
If this not works, you can always use "sendto,unitnum,command" after enabling the same (udp) port in the Advanced settings.
is it now workin.
my unit number has the last numbers of ip, so i try also this:

Code: Select all

on pulsante155#Switch do
on pulsante155#Switch do
  if [pulsante155#Switch]>0
    SendTo,157,/control?cmd=GPIO,14,0
  else
    SendTo,157,/control?cmd=GPIO,14,1
  endif
endon
but is still not working...why? :(

if i write this in web page of espeasy inside space for "command" i see "ok" but the relay is not turned ON / OFF
SendTo,157,/control?cmd=GPIO,14,0
SendTo,157,/control?cmd=GPIO,14,1


if i write this in web page of espeasy inside space for "command" i see "ok" but the relay is turned ON / OFF
SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,1
SendToHTTP 192.168.0.157,80,/control?cmd=GPIO,14,0
This is how it should look like:

Code: Select all

on pulsante155#Switch do
  if [pulsante155#Switch]>0
    SendTo,157,GPIO,14,0
  else
    SendTo,157,GPIO,14,1
  endif
endon
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:

Post Reply

Who is online

Users browsing this forum: No registered users and 135 guests