Assuming a python script can test for a device state, could I bug someone for
a sample script that would toggle a device on/off and set at variable depending which
state the device was in?
Trying to get started with python.
Thanks,
Carl
This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo
# Test to see if the Desk Lamp is off or not.
if indigo.devices['Desk Lamp'].onState == False:
# Desk Lamp is off. Save the "false" state into the OldDeskLampState variable.
indigo.variable.updateValue(indigo.variables['OldDeskLampState'], "false")
# Now turn on the Desk Lamp.
indigo.device.turnOn('Desk Lamp')
else:
# Desk Lamp is on. Save the "true" state into the OldDeskLampState variable.
indigo.variable.updateValue(indigo.variables['OldDeskLampState'], "true")
# Now turn off the Desk Lamp.
indigo.device.turnOff('Desk Lamp')
Users browsing this forum: Google [Bot] and 1 guest