@@ -13,6 +13,10 @@ def __init__(self, data):
13
13
data ["id_v1" ]
14
14
self .id_v1 = data ["id_v1" ]
15
15
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" }
16
20
self .icon_class = data ["class" ] if "class" in data else "Other"
17
21
self .lights = []
18
22
self .action = {"on" : False , "bri" : 100 , "hue" : 0 , "sat" : 254 , "effect" : "none" , "xy" : [
@@ -283,14 +287,15 @@ def getV2GroupedLight(self):
283
287
result ["id_v1" ] = "/groups/" + self .id_v1
284
288
result ["on" ] = {"on" : self .update_state ()["any_on" ]}
285
289
result ["type" ] = "grouped_light"
290
+ result ["owner" ] = self .owner
286
291
return result
287
292
288
293
def getObjectPath (self ):
289
294
return {"resource" : "groups" , "id" : self .id_v1 }
290
295
291
296
def save (self ):
292
297
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 }
294
299
for light in self .lights :
295
300
if light ():
296
301
result ["lights" ].append (light ().id_v1 )
0 commit comments