diff --git a/HISTORY.md b/HISTORY.md index c577e3bd..10b42440 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -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] @@ -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 diff --git a/insteon_mqtt/device/Dimmer.py b/insteon_mqtt/device/Dimmer.py index 49ef9abc..926099db 100644 --- a/insteon_mqtt/device/Dimmer.py +++ b/insteon_mqtt/device/Dimmer.py @@ -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 " @@ -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() diff --git a/insteon_mqtt/device/KeypadLinc.py b/insteon_mqtt/device/KeypadLinc.py index 9e57cc33..276c5b01 100644 --- a/insteon_mqtt/device/KeypadLinc.py +++ b/insteon_mqtt/device/KeypadLinc.py @@ -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 " @@ -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() diff --git a/insteon_mqtt/device/Outlet.py b/insteon_mqtt/device/Outlet.py index 52d32f08..a8617235 100644 --- a/insteon_mqtt/device/Outlet.py +++ b/insteon_mqtt/device/Outlet.py @@ -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 " @@ -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() diff --git a/insteon_mqtt/device/Switch.py b/insteon_mqtt/device/Switch.py index de8918bf..ae15e1f5 100644 --- a/insteon_mqtt/device/Switch.py +++ b/insteon_mqtt/device/Switch.py @@ -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 " @@ -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()