Skip to content

Instantly share code, notes, and snippets.

@mattcuk
Created April 22, 2018 18:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattcuk/5a2b1fa2104da0e253574d0cb878e800 to your computer and use it in GitHub Desktop.
Save mattcuk/5a2b1fa2104da0e253574d0cb878e800 to your computer and use it in GitHub Desktop.
Basic webservice to allow us to control an Energenie power socket
<?php
/* MattC - Call this with various parameters..
callenergenie.php?
delay = time in seconds to sleep before calling Energenie
switch = which socket to talk to
state = turn socket on/off
e.g. callenergenie.php?delay=5&switch=2&state=off
*/
print ("Waiting ".$_GET['delay']." seconds");
sleep($_GET['delay']);
print ("Switching socket ".$_GET['switch']." ".$_GET['state']);
exec("sudo python /var/www/callenergenie.py ".$_GET['state']." ".$_GET['switch']);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment