Skip to content

Commit 7c757d9

Browse files
Update Group.py (diyhue#1034)
1 parent 5d54bc9 commit 7c757d9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

BridgeEmulator/HueObjects/Group.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ def __init__(self, data):
1313
data["id_v1"]
1414
self.id_v1 = data["id_v1"]
1515
self.id_v2 = data["id_v2"] if "id_v2" in data else genV2Uuid()
16+
if "owner" in data:
17+
self.owner = data["owner"]
18+
else:
19+
self.owner = {"rid": str(uuid.uuid5(uuid.NAMESPACE_URL, self.id_v2 + 'device')), "rtype": "device"}
1620
self.icon_class = data["class"] if "class" in data else "Other"
1721
self.lights = []
1822
self.action = {"on": False, "bri": 100, "hue": 0, "sat": 254, "effect": "none", "xy": [
@@ -283,14 +287,15 @@ def getV2GroupedLight(self):
283287
result["id_v1"] = "/groups/" + self.id_v1
284288
result["on"] = {"on": self.update_state()["any_on"]}
285289
result["type"] = "grouped_light"
290+
result["owner"] = self.owner
286291
return result
287292

288293
def getObjectPath(self):
289294
return {"resource": "groups", "id": self.id_v1}
290295

291296
def save(self):
292297
result = {"id_v2": self.id_v2, "name": self.name, "class": self.icon_class,
293-
"lights": [], "action": self.action, "type": self.type}
298+
"lights": [], "action": self.action, "type": self.type, "owner": self.owner}
294299
for light in self.lights:
295300
if light():
296301
result["lights"].append(light().id_v1)

0 commit comments

Comments
 (0)