From 322a8453ec7485978b9ac84b73a42c998e6ed91a Mon Sep 17 00:00:00 2001 From: James Muscat Date: Mon, 27 Nov 2023 07:54:00 +0000 Subject: [PATCH] Always include speed in scenes for api V2 (#960) * Always include `speed` in v2 API response for scene. * Always include speed when saving scene object. --- BridgeEmulator/HueObjects/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BridgeEmulator/HueObjects/__init__.py b/BridgeEmulator/HueObjects/__init__.py index 19c5ab88c..ef024e5cb 100644 --- a/BridgeEmulator/HueObjects/__init__.py +++ b/BridgeEmulator/HueObjects/__init__.py @@ -1227,6 +1227,8 @@ def save(self): class Scene(): + DEFAULT_SPEED = 0.6269841194152832 + def __init__(self, data): self.name = data["name"] self.id_v1 = data["id_v1"] @@ -1241,7 +1243,7 @@ def __init__(self, data): ).strftime("%Y-%m-%dT%H:%M:%S") self.lightstates = weakref.WeakKeyDictionary() self.palette = data["palette"] if "palette" in data else {} - self.speed = data["speed"] if "speed" in data else 0.6269841194152832 + self.speed = data["speed"] if "speed" in data else self.DEFAULT_SPEED self.group = data["group"] if "group" in data else None self.lights = data["lights"] if "lights" in data else [] if "group" in data: @@ -1400,8 +1402,7 @@ def getV2Api(self): result["type"] = "scene" if self.palette: result["palette"] = self.palette - if self.speed != 1: - result["speed"] = self.speed + result["speed"] = self.speed return result def storelightstate(self): @@ -1455,8 +1456,7 @@ def save(self): return False if self.palette != None: result["palette"] = self.palette - if self.speed != None: - result["speed"] = self.speed + result["speed"] = self.speed or self.DEFAULT_SPEED for light in self.lights: if light(): result["lights"].append(light().id_v1)