2016-12-03 21:11:52 +01:00
|
|
|
import hyperion, time, colorsys
|
2013-11-30 17:42:57 +01:00
|
|
|
|
2013-11-30 17:46:07 +01:00
|
|
|
# Get the parameters
|
2013-12-08 16:23:01 +01:00
|
|
|
rotationTime = float(hyperion.args.get('rotation-time', 30.0))
|
2017-01-04 10:55:10 +01:00
|
|
|
brightness = float(hyperion.args.get('brightness', 100))/100.0
|
|
|
|
saturation = float(hyperion.args.get('saturation', 100))/100.0
|
2016-12-03 21:11:52 +01:00
|
|
|
reverse = bool(hyperion.args.get('reverse', False))
|
2013-11-30 17:42:57 +01:00
|
|
|
|
|
|
|
# Calculate the sleep time and hue increment
|
|
|
|
sleepTime = 0.1
|
|
|
|
hueIncrement = sleepTime / rotationTime
|
|
|
|
|
|
|
|
# Switch direction if needed
|
|
|
|
if reverse:
|
|
|
|
increment = -increment
|
|
|
|
|
|
|
|
# Start the write data loop
|
|
|
|
hue = 0.0
|
|
|
|
while not hyperion.abort():
|
|
|
|
rgb = colorsys.hsv_to_rgb(hue, saturation, brightness)
|
|
|
|
hyperion.setColor(int(255*rgb[0]), int(255*rgb[1]), int(255*rgb[2]))
|
|
|
|
hue = (hue + hueIncrement) % 1.0
|
|
|
|
time.sleep(sleepTime)
|