Author Topic: Sonoff ESP Easy  (Read 476 times)

Offline congkai

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Sonoff ESP Easy
« on: June 15, 2017, 01:45:07 pm »
I have a Sonoff (wifi smart switch) flashed with ESP Easy.

It response to
 http://sonoffip/control?cmd=gpio,12,1 (On)
 http://sonoffip/control?cmd=gpio,12,2 (off)

is there anyway i can make a switch in vera that can send http commands to On or Off this sonoff? There is this httpswitch but it's designed for kankun k3 switch.
(i'm new to vera and luup).

Thanks!

Offline wantedfoot

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Sonoff ESP Easy
« Reply #1 on: July 13, 2017, 04:31:55 pm »
Hi there congkai.  Just in case you still need help with this... I ended up using a scene to conrol the sonoff device.  Just create a scene in Vera that is triggered however you wish and throw this in the lua code section of your scene under the label that says, "Also, execute the following Luup code:"
luup.inet.wget('http://SONOFF IP ADDRESS GOES HERE/control?cmd=event,turnon')

Replace "turnon" with "turnoff" or any other labels you've used in your rules on the sonoff device.  Hope that helps.  For more info on using the rules, check this page out. 
https://www.letscontrolit.com/wiki/index.php/Tutorial_Rules#SendToHTTP

Hope that helps.

Offline xbmcnut

  • Full Member
  • ***
  • Posts: 111
  • Karma: +1/-0
Re: Sonoff ESP Easy
« Reply #2 on: August 28, 2017, 05:48:59 am »
Hi there congkai.  Just in case you still need help with this... I ended up using a scene to conrol the sonoff device.  Just create a scene in Vera that is triggered however you wish and throw this in the lua code section of your scene under the label that says, "Also, execute the following Luup code:"
luup.inet.wget('http://SONOFF IP ADDRESS GOES HERE/control?cmd=event,turnon')

Replace "turnon" with "turnoff" or any other labels you've used in your rules on the sonoff device.  Hope that helps.  For more info on using the rules, check this page out. 
https://www.letscontrolit.com/wiki/index.php/Tutorial_Rules#SendToHTTP

Hope that helps.

Great tip thank you. Is the 'turnon' or 'turnoff' command calling a rule name in ESPEasy or can the GPIO be controlled directly? I'm assuming we'd also have to send something back to Vera to validate the execution (virtual switch?).

Offline wantedfoot

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
Re: Sonoff ESP Easy
« Reply #3 on: August 28, 2017, 08:14:47 am »
Great tip thank you. Is the 'turnon' or 'turnoff' command calling a rule name in ESPEasy or can the GPIO be controlled directly? I'm assuming we'd also have to send something back to Vera to validate the execution (virtual switch?).

You are correct.  The rule must be created in ESPEasy first and virtual switches are the only way that I currently know of for reporting the on/off status of the device to Vera.  I'm sure more seasoned or learned veterans at the link I've referencee or even some on this board might have other secrets but for now this system has been working well for me.