From c56afba137f15c211163e6e0d8a307e05143fc9f Mon Sep 17 00:00:00 2001 From: Marius Motea Date: Tue, 24 Sep 2024 13:03:35 +0300 Subject: [PATCH] minor fix --- BridgeEmulator/HueObjects/Group.py | 3 ++- BridgeEmulator/functions/behavior_instance.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BridgeEmulator/HueObjects/Group.py b/BridgeEmulator/HueObjects/Group.py index 42fa2c4ff..da8b2c489 100644 --- a/BridgeEmulator/HueObjects/Group.py +++ b/BridgeEmulator/HueObjects/Group.py @@ -150,6 +150,7 @@ def setV1Action(self, state, scene=None): v2State = v1StateToV2(state) self.genStreamEvent(v2State) + def genStreamEvent(self, v2State): streamMessage = {"creationtime": datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"), "data": [], @@ -163,7 +164,7 @@ def genStreamEvent(self, v2State): "id": light.id_v2, "id_v1": "/lights/" + light.id_v1, "owner": { - "rid": light().getDevice()["id"], + "rid": self.id_v2, "rtype":"device" }, "service_id": light.protocol_cfg["light_nr"]-1 if "light_nr" in light.protocol_cfg else 0, diff --git a/BridgeEmulator/functions/behavior_instance.py b/BridgeEmulator/functions/behavior_instance.py index 393d174f0..bcc3ce048 100755 --- a/BridgeEmulator/functions/behavior_instance.py +++ b/BridgeEmulator/functions/behavior_instance.py @@ -153,10 +153,11 @@ def checkBehaviorInstances(device): resource.setV1Action({"bri_inc": +30}) elif instance.configuration["buttons"][button][buttonAction]["action"] == "dim_down": resource.setV1Action({"bri_inc": -30}) - elif device.modelid == "SML001": # Motion Sensor if "settings" in instance.configuration: if "daylight_sensitivity" in instance.configuration["settings"]: + if device.elements["ZLLLightLevel"]().protocol_cfg["lightSensor"] == "on": + device.elements["ZLLLightLevel"]().state["lightlevel"] = 25000 if bridgeConfig["sensors"]["1"].state["daylight"] else 6000 if instance.configuration["settings"]["daylight_sensitivity"]["dark_threshold"] >= device.elements["ZLLLightLevel"]().state["lightlevel"]: logging.debug("Light ok") else: