working examples feature complete

This commit is contained in:
Øyvind Saltvik 2012-08-10 20:37:16 +02:00
parent 9073d60858
commit c5c64435cf
4 changed files with 70 additions and 88 deletions

View file

@ -10,41 +10,38 @@ allMethods = telldus.TELLSTICK_TURNON | telldus.TELLSTICK_TURNOFF | telldus.TELL
for i in xrange(devices):
deviceid = telldus.tdGetDeviceId(i)
name = telldus.tdGetName(deviceid)
print "%s - %s\n" % (deviceid, name)
methods = telldus.tdMethods(deviceid, allMethods)
if methods & telldus.TELLSTICK_TURNON:
print " * TurnOn\n"
telldus.tdTurnOn(deviceid)
time.sleep(1)
if deviceid:
name = telldus.tdGetName(deviceid)
print "%s - %s\n" % (deviceid, name)
if methods & telldus.TELLSTICK_TURNOFF:
print " * TurnOff\n"
telldus.tdTurnOff(deviceid)
time.sleep(1)
methods = telldus.tdMethods(deviceid, allMethods)
if methods & telldus.TELLSTICK_BELL:
echo " * Bell\n"
telldus.tdBell(deviceid)
time.sleep(1)
if methods & telldus.TELLSTICK_TOGGLE:
print " * Toggle\n"
if methods & telldus.TELLSTICK_DIM:
print " * Dim\n"
telldus.tdDim(deviceid, 128)
time.sleep(1)
if methods & telldus.TELLSTICK_TURNON:
print " * TurnOn\n"
telldus.tdTurnOn(deviceid)
time.sleep(1)
if methods & telldus.TELLSTICK_TURNOFF:
print " * TurnOff\n"
telldus.tdTurnOff(deviceid)
time.sleep(1)
if methods & telldus.TELLSTICK_BELL:
print " * Bell\n"
telldus.tdBell(deviceid)
time.sleep(1)
if methods & telldus.TELLSTICK_TOGGLE:
print " * Toggle\n"
if methods & telldus.TELLSTICK_DIM:
print " * Dim\n"
telldus.tdDim(deviceid, 128)
time.sleep(1)
telldus.tdClose()
import time
time.sleep(30)
for i in xrange(20):
telldus.tdTurnOn(3)
telldus.tdTurnOff(3)