From d203c540a906770866a950b8733980a3c3382eaf Mon Sep 17 00:00:00 2001 From: Shy Date: Fri, 15 Mar 2024 01:42:30 +0100 Subject: [PATCH] Added rgb/bell. --- c4ctrl.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/c4ctrl.py b/c4ctrl.py index cc51904..3ceabee 100755 --- a/c4ctrl.py +++ b/c4ctrl.py @@ -526,6 +526,13 @@ class Dmx7(Dmx): # {{{1 template = "000000000000ff" # }}}1 +class Rgb4(Dmx): # {{{1 + """ Abstraction of the 4 LED doorbell hardware. """ + + # 4 times 3 bytes (RGB). + template = "00ff0000ff0000ff0000ff00" +# }}}1 + class C4Room: # {{{1 """ Methods of rooms in the club. """ @@ -754,11 +761,12 @@ class Wohnzimmer(C4Room): # {{{1 Dmx7("dmx/wohnzimmer/mitte3"), Dmx7("dmx/wohnzimmer/gang"), Dmx7("dmx/wohnzimmer/baellebad"), - Dmx7("dmx/wohnzimmer/spuele1"), - Dmx7("dmx/wohnzimmer/spuele2"), - Dmx7("dmx/wohnzimmer/tresen"), - Dmx7("dmx/wohnzimmer/tresen2"), - Dmx7("dmx/wohnzimmer/chaosknoten") + Dmx("dmx/wohnzimmer/spuele1"), + Dmx("dmx/wohnzimmer/spuele2"), + Dmx("dmx/wohnzimmer/tresen"), + Dmx("dmx/wohnzimmer/tresen2"), + Dmx("dmx/wohnzimmer/chaosknoten"), + Rgb4("rgb/bell") ) # }}}1 @@ -1078,7 +1086,10 @@ is reserved. Please choose a different one.".format(name)) # Format payload more nicely. color = light.color if len(color) > 6: - color = color[:6] + ' ' + color[6:] + if type(light) == Rgb4: + color = color[:6] + ' ' + color[6:12] + ' ' + color[12:18] + ' ' + color[18:24] + else: + color = color[:6] + ' ' + color[6:] topic = light.topic.ljust(max_topic_len) # Out comment master, as it would override everything else. if self._topic_is_master(r.topic):