Anyway, I wanted to duplicate a feature with SmartThings that simulated a sunrise for a gentle wakeup by very slowly fading up a lamp. I thought I would share the little script if this is the place to do that. Any comments to help me learn more would be appreciated. I found initially, it didn't work because it looks like my Intermatic dimmer wasn't responding to the brighten command so I had to use the setBrightness and calculate the level. This script brightens a light over 30 minutes (1800 seconds) updating every minute. I found I had to make it external because when I embedded it would not run as embedded scripts must complete in 10 seconds. For other newbies out there, just save to a text file and select in the Actions tab of a schedule. Choose Execute Script from the Server actions and select the file.
EDIT: Script below was edited for corrections
- Code: Select all
#!/usr/bin/env python
# Filename: wakeUp.py
# Description: Gently fade up one dimmer
import time
import indigo
dimmerDevice = "Master Bedroom Dressor"
ramptime = 1800.0
interval = 60
timer = 0
bright_amount = int((100.0/ramptime) * interval)
bright_level = 0
while ( timer < ramptime ):
bright_level=bright_level + bright_amount
if (bright_level <= 100 ):
# The dimmer being used doesn't respond to
# the brighten command so we have to set the brightness
# with the setBrightness command
indigo.dimmer.setBrightness(dimmerDevice, value=bright_level)
time.sleep(interval)
timer = timer + interval