Sonoff basic questions

604 views
Skip to first unread message

wayner

unread,
Sep 8, 2017, 1:53:55 PM9/8/17
to SonoffUsers
Hi - I want to use the Sonoff wifi switch in connection with my Control4 Home Automation system.  Ideally I would be able to do this via hitting a URL  like  "http://192.168.1.155/turnon" assuming that 192.168.1.155 is the sonoff IP address.  I have CGI enabled web servers on my LAN so I could do more complex commands if required by executing python code via CGI on a Raspberry Pi or a PC running Apache under Ubuntu - or even Let's encrypt-nginx.  Is that possible without hacking the sonoff and changing the firmware?  Can you intercept the calls to the cloud via router routing commands?  Is there an API for these devices (not as far as I can tell) that would allow simple control, as there is for devices like a Philips Hue hub?

If not what is the easiest way to do this?  Using Sonoff-Tasmota or are there other ways to accomplish what I am trying to do?

As an aside - why doesn't someone sell Sonoff units that have been prehacked?  Why doesn't iTead studio do this themselves or even sell units with headers pre-soldered?  Or even just provide an API?  It isn't as if they are like Apple and selling a system meant for a walled-off environment.

Phil

unread,
Sep 10, 2017, 6:51:45 PM9/10/17
to SonoffUsers
if your 'control4 home automation system' can use mqtt for message transfer rather than http calls then tasmota would work with it, if not then in order to use tasmota you will need something else to convert the http to mqtt, Nodered would do that very simply,  so run that on your pi and let it intercept the archaic http calls your s/w issues and issue the mqtt commands you can configure to run the tasmota firmware to perform your tasks.  Probably best if you install and run mosquitto too as a local mqtt server, you can use one of the free web services, but if your using a Pi in the system already you may as well host hour own mqtt server and keep all the traffic local to your personal network.

Mike Fenske

unread,
Sep 14, 2017, 9:52:48 AM9/14/17
to SonoffUsers
You can turn it on or off with a web command.
See the wiki for details:

Basically:
http://sonoff/cm?cmnd=Power%20TOGGLE
http://sonoff/cm?cmnd=Power%20On
http://sonoff/cm?cmnd=Power%20off
http://sonoff/cm?user=admin&password=joker&cmnd=Power%20Toggle
where sonoff is the ip address of the device

The above is copy/paste from the Wiki. Not sure, but I don't think the case of the command matters.

Mike
Reply all
Reply to author
Forward
0 new messages