Some minor fixes
This commit is contained in:
parent
fc18301af4
commit
d2aab86956
2 changed files with 9 additions and 8 deletions
13
c4ctrl.py
13
c4ctrl.py
|
@ -251,7 +251,7 @@ class C4Room:
|
|||
|
||||
light.set_color(colorscheme.color_for(light.topic))
|
||||
cmd.append({
|
||||
"topic" : Fluffy().ghost_of(light.topic),
|
||||
"topic" : Fluffy().ghostly_topic(light.topic),
|
||||
"payload" : Fluffy().ghostly_payload(light.payload, mode_id)
|
||||
})
|
||||
else:
|
||||
|
@ -813,6 +813,7 @@ class Fluffy:
|
|||
"""Fluffyd functions."""
|
||||
|
||||
modes = {
|
||||
# Fluffy modes and their id's
|
||||
"fade" : 1,
|
||||
"wave" : 4,
|
||||
"pulse" : 8,
|
||||
|
@ -820,7 +821,7 @@ class Fluffy:
|
|||
"flash" : 12
|
||||
}
|
||||
|
||||
def ghost_of(self, topic):
|
||||
def ghostly_topic(self, topic):
|
||||
# Return the ghost topic of topic
|
||||
return "ghosts" + topic[topic.find('/'):]
|
||||
|
||||
|
@ -828,8 +829,8 @@ class Fluffy:
|
|||
return payload + int(mode_id).to_bytes(1, "little")
|
||||
|
||||
def mode_id(self, name):
|
||||
if name.isdecimal():
|
||||
if int(name) in self.modes.values():
|
||||
if name.isdecimal() and int(name) <= 255:
|
||||
# Let's trust the user with this
|
||||
return (int(name), False)
|
||||
else:
|
||||
if name.lower() in self.modes.keys():
|
||||
|
@ -1047,7 +1048,7 @@ if __name__ == "__main__":
|
|||
help="apply local colorscheme PRESET to Fnordcenter")
|
||||
group_cl.add_argument(
|
||||
"-m", "--magic", type=str, default="fade", metavar="MODE",
|
||||
help="EXPERIMENTAL: blend into preset (needs a running instance of fluffyd on the network). MODE is either \"fade\", \"wave\", \"emp[1]\", \"flash\" or \"none\".")
|
||||
help="EXPERIMENTAL: blend into preset (needs a running instance of fluffyd on the network). MODE is either \"fade\", \"wave\", \"pulse\", \"emp\", \"flash\" or \"none\".")
|
||||
group_cl.add_argument(
|
||||
"-l", "--list-presets", action="store_true",
|
||||
help="list locally available presets")
|
||||
|
@ -1056,7 +1057,7 @@ if __name__ == "__main__":
|
|||
help="store current state as preset NAME ('-' to write to stdout)")
|
||||
# Switch control
|
||||
group_sw = parser.add_argument_group(title="light switch control",
|
||||
description="BINARY_CODE is a string of 0s or 1s for every light in the room. Accepts integers also. Will show some information and ask for input if missing.")
|
||||
description="BINARY_CODE is a string of 0s or 1s for every light in the room. Accepts integers also. Will show some information and ask for input if omitted.")
|
||||
group_sw.add_argument(
|
||||
"-W", nargs='?', dest="w_switch", const="", metavar="BINARY_CODE",
|
||||
help="switch lights in Wohnzimmer on/off")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
" Vim plugin to use some functionality of c4ctrl from within Vim.
|
||||
"
|
||||
" Last Change: 2017 Mar 28
|
||||
" Last Change: 2017 Mar 29
|
||||
" Maintainer: Shy
|
||||
" License: This file is placed in the public domain.
|
||||
"
|
||||
|
|
Loading…
Reference in a new issue