Skip to content

Commit

Permalink
Add effect_v2
Browse files Browse the repository at this point in the history
Update light effects to effects_v2.
Add effects to mqtt. #1053
  • Loading branch information
hendriksen-mark committed Nov 24, 2024
1 parent e64e613 commit 5515247
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions BridgeEmulator/HueObjects/Light.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ def setV1State(self, state, advertise=True):

def setV2State(self, state):
v1State = v2StateToV1(state)
if "effects_v2" in state and "action" in state["effects_v2"]:
v1State["effect"] = state["effects_v2"]["action"]["effect"]
self.effect = v1State["effect"]
if "effects" in state:
v1State["effect"] = state["effects"]["effect"]
self.effect = v1State["effect"]
Expand Down
4 changes: 2 additions & 2 deletions BridgeEmulator/configManager/configHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ def download_debug(self):
debug["apiUsers"] = "privately"
debug["Hue Essentials key"] = "privately"
debug["users"] = "privately"
if debug["mqtt"]["enabled"]:
if debug["mqtt"]["enabled"] or "mqttPassword" in debug["mqtt"]:
debug["mqtt"]["mqttPassword"] = "privately"
if debug["homeassistant"]["enabled"]:
if debug["homeassistant"]["enabled"] or "homeAssistantToken" in debug["homeassistant"]:
debug["homeassistant"]["homeAssistantToken"] = "privately"
if debug["hue"]:
debug["hue"]["hueUser"] = "privately"
Expand Down
4 changes: 3 additions & 1 deletion BridgeEmulator/flaskUI/restful.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ def post(self):
else:
logging.error("link button not pressed")
logging.error("last_button_press " + str(last_button_press))
logging.error("current time " + str(datetime.now().timestamp()))
logging.error("current_time " + str(datetime.now().timestamp()))
if last_button_press != datetime.now().timestamp():
logging.error("last_button_press is not current_time, please check timezone setting")
return [{"error": {"type": 101, "address": "/api/", "description": "link button not pressed"}}]
else:
logging.error("parameter, " + list(postDict.keys())[0] + ", not available")
Expand Down
2 changes: 2 additions & 0 deletions BridgeEmulator/lights/protocols/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def set_light(light, data):
payload['alert'] = value
if key == "transitiontime":
payload['transition'] = value / 10
if key == "effect":
payload["effect"] = value
if colorFromHsv:
color = hsv_to_rgb(data['hue'], data['sat'], light.state["bri"])
payload['color'] = { 'r': color[0], 'g': color[1], 'b': color[2] }
Expand Down

0 comments on commit 5515247

Please sign in to comment.