- Code: Select all
fan_id = 11175177
bright_change = 1
senseMeID = "com.pennypacker.indigoplugin.senseme"
senseMePlugin = indigo.server.getPlugin(senseMeID)
office_fan = indigo.devices[fan_id].name
try:
current_fan_bright = int(indigo.devices[fan_id].states["brightness"])
except:
indigo.server.log("could not read the current fan brightness")
return
new_fan_bright = current_fan_bright + bright_change
if new_fan_bright > 7:
indigo.server.log("could not change the fan brightness beyond level 16")
return
elif new_fan_bright < 0:
indigo.server.log("could not change the fan brightness below level 0")
return
output_str = ""
if new_fan_bright > current_fan_bright:
output_str = "increasing "
else:
output_str = "decreasiong "
indigo.server.log(output_str + "'" + office_fan + "' brightness from " + str(current_fan_bright) + " to " + str(new_fan_bright))
senseMePlugin.executeAction("fanLightBrightness", deviceId=fan_id, props={'brightness':str(new_fan_bright)})
When I run this script, the event log reports:
- Code: Select all
Feb 9, 2020 at 7:38:04 PM
Script increasing 'Haiku Office Fan' brightness from 0 to 1
SenseME Fan Debug set brightness to None this:
I think there is a problem with the last line of script?