Start a new topic

Control Sonoff socket with web interface instead of app?

I have a Sonoff remote control power socket, and find that the eWeLink app drains my phone's battery very quickly. Is there a way of controlling the socket over the internet using a web GUI instead of the eWeLink app?

3 people have this question

Download an android emulator like bluestacks & install ewelink app on it is the only way I could do in on a windows pc if thats any help

I've controlled mine via IFTTT website. I can open any web browser, paste the web address with event and presto.

1 person likes this

Use webhooks on IFTTT website.  Build applets for on and off.  Create a local web page on your computer that loads the webhooks url into an inline frame when you click a link for on or off.  This is working for me.


Keep the web page on your local computer to protect your webhooks key.  If you want to place it on a public site, use PHP or other server side language to hide it.


Another method, as described above, is create bookmarks in your browser with the webhooks urls required to turn the switch on or off.  Then you can click in the bookmark in your browser to do the job.

1 person likes this

Perfect - many thanks!

Hello E W.

As i not familiar with IFTTT Could you please explain the sentence: " ...that loads the webhooks url into an inline frame... "

In html you create an inline frame on a web page.  Then create links on the page to load webhooks url execution results into the frame.  The result is that webhooks sends the command to the applets and the reply from the process appears in the frame.

Here is a snippit of html code that creates the iframe and shows an example link.


<iframe id="I1" name="I1" src="http:/" title="Results" width="100%" style="height: 80px" >   </iframe>


<a href="" target="I1">Fan OFF</a>
In the code above weblinks.php is a script I created to send the trigger string (example: fan_off) to webhooks.
---my php script---
$key = "xxxxxxxxxxxxxxxxxxxxx"; // Set key to your IFTTT webhooks key.
if(isset($_GET['weblink0'])){ // if we have a command 0 send the commands else print generic message.
 for ($i=0; $i<3; $i++){ // retrieve up to 3 weblink trigger commands
   $result = send_link($_GET['weblink'.$i]);
   $result = str_replace("Congratulations! ", "", $result); // get rid of annoying text
   echo $result . ".<br>";
 echo "Results appear here.";
function send_link($comm){
global $key;
$result = file_get_contents(''. $comm .'/with/key/' . $key); // accessing the url will trigger webhooks
if($result) return $result;
else return "Did not trigger any event.";
See the page: for how to set up and use webhooks.
Login or Signup to post a comment