Skip to content

Commit

Permalink
Update Group.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hendriksen-mark committed Aug 2, 2024
1 parent 5d54bc9 commit e9d2ffd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion BridgeEmulator/HueObjects/Group.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ def __init__(self, data):
data["id_v1"]
self.id_v1 = data["id_v1"]
self.id_v2 = data["id_v2"] if "id_v2" in data else genV2Uuid()
if "owner" in data:
self.owner = data["owner"]
else:
self.owner = {"rid": str(uuid.uuid5(uuid.NAMESPACE_URL, self.id_v2 + 'device')), "rtype": "device"}
self.icon_class = data["class"] if "class" in data else "Other"
self.lights = []
self.action = {"on": False, "bri": 100, "hue": 0, "sat": 254, "effect": "none", "xy": [
Expand Down Expand Up @@ -283,14 +287,15 @@ def getV2GroupedLight(self):
result["id_v1"] = "/groups/" + self.id_v1
result["on"] = {"on": self.update_state()["any_on"]}
result["type"] = "grouped_light"
result["owner"] = self.owner
return result

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

def save(self):
result = {"id_v2": self.id_v2, "name": self.name, "class": self.icon_class,
"lights": [], "action": self.action, "type": self.type}
"lights": [], "action": self.action, "type": self.type, "owner": self.owner}
for light in self.lights:
if light():
result["lights"].append(light().id_v1)
Expand Down

0 comments on commit e9d2ffd

Please sign in to comment.