Skip to content

Commit afeb6ba

Browse files
committed
Incomplete work from Sunday.
1 parent 874fcaf commit afeb6ba

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

libcbus.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
ROUTING_NONE = '00'
1313

1414

15+
# light on
16+
#\0538007964 (GA 100)
17+
18+
# light off
19+
#\0538000164 (GA 100)
20+
21+
# set to level
22+
#\053800rr64FF (GA 100, to level 100%/0xff)
23+
1524
def duration_to_ramp_rate(seconds):
1625
if seconds == 0:
1726
return '02'
@@ -33,7 +42,19 @@ def duration_to_ramp_rate(seconds):
3342
return '42'
3443
elif seconds <= 120:
3544
return '4A'
36-
elif seconds
45+
elif seconds <= 180:
46+
return '52'
47+
elif seconds <= 300:
48+
return '5A'
49+
elif seconds <= 420:
50+
return '62'
51+
elif seconds <= 600:
52+
return '6A'
53+
elif seconds <= 900:
54+
return '72'
55+
elif seconds <= 1020:
56+
return '7A'
57+
raise OutOfRangeException, 'That duration is too long'
3758

3859

3960
class CBusPCISerial(object):

0 commit comments

Comments
 (0)