From 630a75348cfcd5a5320b4a5aef19f9378b4207d4 Mon Sep 17 00:00:00 2001 From: Ryan Rix Date: Wed, 16 Sep 2015 08:03:15 +0000 Subject: [PATCH] Clean up timebase crasher --- lightrix.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightrix.py b/lightrix.py index 7a69148..4fcd276 100644 --- a/lightrix.py +++ b/lightrix.py @@ -59,9 +59,10 @@ class Lightrix: return def timebased(idx, msg): + """Set different colors depending on the time of the day""" time = datetime.datetime.now(tz=pytz.timezone('US/Pacific')) m = time.minute - if time.hour < 7 and time.hour > 0: # low red at night + if time.hour < 7 and time.hour >= 0: # low red at night return Color(64, 0, 0) if time.hour == 7: # fade to brighter yellow over the morning return Color(64 + m, m, 0) @@ -77,8 +78,7 @@ class Lightrix: return Color(255 - m*2, 255 - m*2, 128 - m) if time.hour == 23: # slowly fade to low red over the hour return Color(64 + 60 - m, 64 + 60 - (m * 2), 0) - if time.hour == 24: # low red at night - return Color(64, 0, 0) + return Color(64, 0, 0) # failback def wheelStrip(idx, msg): val = int(msg.split(' ')[1])