Skip to content

Commit b6df0a4

Browse files
authoredApr 17, 2020
Fix color temp detection for mqtt lights
1 parent 7f122eb commit b6df0a4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎BridgeEmulator/protocols/mqtt.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def set_light(address, light, data):
5353
state = {"transition": 0.3}
5454
colorFromHsv = False
5555
for key, value in data.items():
56+
if key == "ct":
57+
state['color_temp'] = value
5658
if key == "on":
5759
state['state'] = "ON" if value == True else "OFF"
5860
if key == "bri":
@@ -85,6 +87,8 @@ def get_light_state(address, light):
8587
state['on'] = (value == 'ON')
8688
if key == "brightness":
8789
state['bri'] = value
90+
if key == "color_temp":
91+
state['ct'] = value
8892
if key == "color":
8993
state["colormode"] = "xy"
9094
state['xy'] = [value['x'], value['y']]
@@ -111,7 +115,7 @@ def discover(bridge_config, new_lights):
111115
keys = data.keys()
112116
light_color = "xy" in keys and data["xy"] == True
113117
light_brightness = "brightness" in keys and data["brightness"] == True
114-
light_ct = "ct" in keys and data["ct"] == True
118+
light_ct = "color_temp" in keys and data["color_temp"] == True
115119

116120
modelid = None
117121
if light_color and light_ct:

0 commit comments

Comments
 (0)
Please sign in to comment.