I've bought an Energenie module and plug for use with the raspberry pi. I'm completely new to GPIO and managed to get it working with the demo script on their website (https://energenie4u.co.uk/res/pdfs/ENER314%20UM.pdf)
I've since followed the instruction here, installed with Python 2 (https://libraries.io/pypi/energenie) as I simply want to turn the plug on, wait a time period and then turn off, but can't get it to work using a python script I've written using the above link. What am I missing? Here's the script:
from energenie import switch_on, switch_off
print("Sockets 1-4 or 0 for all")
while True:
socket = int(raw_input('Turn socket on: '))
switch_on(socket)
socket = int(raw_input("Turn socket off: "))
switch_off(socket)
I've also tried this:
from energenie import switch_on, switch_off
from time import sleep
# turn some plug sockets on, then turn them off after 10 seconds
switch_on()
sleep(10)
switch_off()