Skip to content

Commit

Permalink
Fixed #136. Backlight mispelled in set_flags extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
TD22057 committed Mar 30, 2019
1 parent 54915ed commit 6146ffa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
3 changes: 3 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
Switch. This prevented customizing the MQTT scene topic and payload for
those devices ([Issue #130][I130])

- Fixed incorrect set-backlight command parsing ([Issue #136][I136])


## [0.6.7]

Expand Down Expand Up @@ -260,3 +262,4 @@
[I126]: https://github.com/TD22057/insteon-mqtt/issues/126
[I130]: https://github.com/TD22057/insteon-mqtt/issues/130
[I132]: https://github.com/TD22057/insteon-mqtt/issues/132
[I136]: https://github.com/TD22057/insteon-mqtt/issues/136
12 changes: 7 additions & 5 deletions insteon_mqtt/device/Dimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ def set_flags(self, on_done, **kwargs):

# Check the input flags to make sure only ones we can understand were
# passed in.
flags = set(["backlight", "on_level"])
FLAG_BACKLIGHT = "backlight"
FLAG_ON_LEVEL = "on_level"
flags = set([FLAG_BACKLIGHT, FLAG_ON_LEVEL])
unknown = set(kwargs.keys()).difference(flags)
if unknown:
raise Exception("Unknown Dimmer flags input: %s.\n Valid flags "
Expand All @@ -412,12 +414,12 @@ def set_flags(self, on_done, **kwargs):
# Start a command sequence so we can call the flag methods in series.
seq = CommandSeq(self.protocol, "Dimmer set_flags complete", on_done)

if "backlink" in kwargs:
backlight = util.input_byte(kwargs, "backlight")
if FLAG_BACKLIGHT in kwargs:
backlight = util.input_byte(kwargs, FLAG_BACKLIGHT)
seq.add(self.set_backlight, backlight)

if "on_level" in kwargs:
on_level = util.input_byte(kwargs, "on_level")
if FLAG_ON_LEVEL in kwargs:
on_level = util.input_byte(kwargs, FLAG_ON_LEVEL)
seq.add(self.set_on_level, on_level)

seq.run()
Expand Down
12 changes: 7 additions & 5 deletions insteon_mqtt/device/KeypadLinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,9 @@ def set_flags(self, on_done, **kwargs):

# Check the input flags to make sure only ones we can understand were
# passed in.
flags = set(["backlight", "on_level"])
FLAG_BACKLIGHT = "backlight"
FLAG_ON_LEVEL = "on_level"
flags = set([FLAG_BACKLIGHT, FLAG_ON_LEVEL])
unknown = set(kwargs.keys()).difference(flags)
if unknown:
raise Exception("Unknown KeypadLinc flags input: %s.\n Valid "
Expand All @@ -596,12 +598,12 @@ def set_flags(self, on_done, **kwargs):
seq = CommandSeq(self.protocol, "KeypadLinc set_flags complete",
on_done)

if "backlink" in kwargs:
backlight = util.input_byte(kwargs, "backlight")
if FLAG_BACKLIGHT in kwargs:
backlight = util.input_byte(kwargs, FLAG_BACKLIGHT)
seq.add(self.set_backlight, backlight)

if "on_level" in kwargs:
on_level = util.input_byte(kwargs, "on_level")
if FLAG_ON_LEVEL in kwargs:
on_level = util.input_byte(kwargs, FLAG_ON_LEVEL)
seq.add(self.set_on_level, on_level)

seq.run()
Expand Down
7 changes: 4 additions & 3 deletions insteon_mqtt/device/Outlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ def set_flags(self, on_done, **kwargs):

# Check the input flags to make sure only ones we can understand were
# passed in.
flags = set(["backlight"])
FLAG_BACKLIGHT = "backlight"
flags = set([FLAG_BACKLIGHT])
unknown = set(kwargs.keys()).difference(flags)
if unknown:
raise Exception("Unknown Outlet flags input: %s.\n Valid flags "
Expand All @@ -397,8 +398,8 @@ def set_flags(self, on_done, **kwargs):
# Start a command sequence so we can call the flag methods in series.
seq = CommandSeq(self.protocol, "Outlet set_flags complete", on_done)

if "backlink" in kwargs:
backlight = util.input_byte(kwargs, "backlight")
if FLAG_BACKLIGHT in kwargs:
backlight = util.input_byte(kwargs, FLAG_BACKLIGHT)
seq.add(self.set_backlight, backlight)

seq.run()
Expand Down
7 changes: 4 additions & 3 deletions insteon_mqtt/device/Switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,8 @@ def set_flags(self, on_done, **kwargs):

# Check the input flags to make sure only ones we can understand were
# passed in.
flags = set(["backlight"])
FLAG_BACKLIGHT = "backlight"
flags = set([FLAG_BACKLIGHT])
unknown = set(kwargs.keys()).difference(flags)
if unknown:
raise Exception("Unknown Switch flags input: %s.\n Valid flags "
Expand All @@ -327,8 +328,8 @@ def set_flags(self, on_done, **kwargs):
# Start a command sequence so we can call the flag methods in series.
seq = CommandSeq(self.protocol, "Switch set_flags complete", on_done)

if "backlink" in kwargs:
backlight = util.input_byte(kwargs, "backlight")
if FLAG_BACKLIGHT in kwargs:
backlight = util.input_byte(kwargs, FLAG_BACKLIGHT)
seq.add(self.set_backlight, backlight)

seq.run()
Expand Down

0 comments on commit 6146ffa

Please sign in to comment.