This is the code I am currently using:
Code: Select all
print "Content-Type: text/html"
print
print '<title>Power - ON</title>'
print "<h1>Fan - <font color=green>On</font></h1>"
print 'Please click <a href="/index.html">here</a> to go back.'
from tellcore.telldus import TelldusCore
core = TelldusCore()
devices = core.devices()
for device in devices:
if device.name == "Switch":
device.turn_on()
My goal, would be to have it so I can type in example.com/cgi-bin/power.py?id=1;power=0
Or something similar, which obviously would turn off the device that has the ID '1'.
Is this possible? I'm sure it shouldn't be too difficult, from what knowledge I have from other programming languages, I'm just not too sure how to do it in Python, and I couldn't really understand what I found on Google.