Skip to content

Commit

Permalink
Always include speed in scenes for api V2 (#960)
Browse files Browse the repository at this point in the history
* Always include `speed` in v2 API response for scene.

* Always include speed when saving scene object.
  • Loading branch information
jamesremuscat committed Nov 27, 2023
1 parent 555d4db commit 322a845
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions BridgeEmulator/HueObjects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 322a845

Please sign in to comment.