Skip to content

Commit

Permalink
fix entertainment area creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mariusmotea committed Dec 3, 2023
1 parent d5d7fc4 commit a7feb33
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 25 deletions.
38 changes: 29 additions & 9 deletions BridgeEmulator/HueObjects/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def v1StateToV2(v1State):
if "bri" in v1State:
v2State["dimming"] = {"brightness": round(v1State["bri"] / 2.54, 2)}
if "ct" in v1State:
v2State["color_temperature"] = {"mirek": v1State["ct"]}
v2State["color_temperature"] = {"mirek": v1State["ct"], "color_temperature_delta": {}}
if "xy" in v1State:
v2State["color"] = {
"xy": {"x": v1State["xy"][0], "y": v1State["xy"][1]}}
Expand Down Expand Up @@ -527,6 +527,7 @@ def getV2Api(self):
}
result["color_temperature"]["mirek_valid"] = True if self.state[
"ct"] != None and self.state["ct"] < 500 and self.state["ct"] > 153 else False
result["color_temperature_delta"] = {}
if "bri" in self.state:
bri_value = self.state["bri"]
if bri_value is None or bri_value == "null":
Expand All @@ -535,15 +536,25 @@ def getV2Api(self):
"brightness": round(float(bri_value) / 2.54, 2),
"min_dim_level": 0.1 # Adjust this value as needed
}
# if "bri" in self.state:
# result["dimming"] = {
# "brightness": round(self.state["bri"] / 2.54, 2),
# "min_dim_level": 0.10000000149011612
# }
result["dimming_delta"] = {}
result["dynamics"] = self.dynamics
result["effects"] = {
"effect_values": [
"no_effect",
"candle",
"fire"
],
"status": "no_effect",
"status_values": [
"no_effect",
"candle",
"fire"
]
}
result["identify"] = {}
result["id"] = self.id_v2
result["id_v1"] = "/lights/" + self.id_v1
result["metadata"] = {"name": self.name,
result["metadata"] = {"name": self.name, "function": "mixed",
"archetype": archetype[self.config["archetype"]]}
result["mode"] = "normal"
if "mode" in self.state and self.state["mode"] == "streaming":
Expand All @@ -555,17 +566,26 @@ def getV2Api(self):
"rid": str(uuid.uuid5(uuid.NAMESPACE_URL, self.id_v2 + 'device')),
"rtype": "device"
}
result["product_data"] = {"function": "mixed"}
result["signaling"] = {"signal_values": [
"no_signal",
"on_off"]}
result["type"] = "light"
return result

def getV2Entertainment(self):
entertainmenUuid = str(uuid.uuid5(
uuid.NAMESPACE_URL, self.id_v2 + 'entertainment'))
result = {
"equalizer": True,
"id": entertainmenUuid,
"id_v1": "/lights/" + self.id_v1,
"proxy": lightTypes[self.modelid]["v1_static"]["capabilities"]["streaming"]["proxy"],
"renderer": lightTypes[self.modelid]["v1_static"]["capabilities"]["streaming"]["renderer"]
"renderer": lightTypes[self.modelid]["v1_static"]["capabilities"]["streaming"]["renderer"],
"renderer_reference": {
"rid": self.id_v2,
"rtype": "light"
}
}
result["owner"] = {
"rid": self.getDevice()["id"], "rtype": "device"}
Expand Down Expand Up @@ -853,7 +873,7 @@ def getV2Api(self):
{"rtype": "light", "rid": light().id_v2})
entertainmentUuid = str(uuid.uuid5(
uuid.NAMESPACE_URL, light().id_v2 + 'entertainment'))
result["locations"]["service_locations"].append({"positions": self.locations[light()],
result["locations"]["service_locations"].append({"equalization_factor": 1, "positions": self.locations[light()],
"service": {"rid": entertainmentUuid, "rtype": "entertainment"}, "position": self.locations[light()][0]})

loops = 1
Expand Down
32 changes: 16 additions & 16 deletions BridgeEmulator/lights/light_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
lightTypes = {}

## Hue Color Bulb #1
lightTypes["LCT001"] = {"v1_static": {"type":"Extended color light", "manufacturername": "Signify Netherlands B.V.", "swversion": "1.90.1"}}
lightTypes["LCT001"] = {"v1_static": {"type":"Extended color light", "manufacturername": "Signify Netherlands B.V.", "swversion": "1.104.2"}}
lightTypes["LCT001"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"}
lightTypes["LCT001"]["v1_static"]["capabilities"] = {"certified": True,"control": {"colorgamut": [[0.675,0.322],[0.409,0.518],[0.167,0.04]],"colorgamuttype": "B","ct": {"max": 500,"min": 153},"maxlumen": 600,"mindimlevel": 5000},"streaming": {"proxy": False,"renderer": True}}
lightTypes["LCT001"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.","product_archetype": "sultan_bulb","product_name": "Hue color lamp","software_version": "1.90.1"}
lightTypes["LCT001"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.","product_archetype": "sultan_bulb","product_name": "Hue color lamp","software_version": "1.104.2"}
lightTypes["LCT001"]["state"] = {"alert": "none", "bri":0, "colormode": "xy", "effect": "none","hue": 0, "mode": "homeautomation","on": False,"reachable": True, "sat": 0,"xy": [0.408,0.517]}
lightTypes["LCT001"]["config"] = {"archetype": "sultanbulb","direction": "omnidirectional","function": "mixed","startup": {"configured": True, "mode": "safety"}}
lightTypes["LCT001"]["dynamics"] = {"speed": 0, "speed_valid": False, "status": "none", "status_values": ["none", "dynamic_palette"]}

## Hue Color Bulb #2
lightTypes["LCT015"] = {"v1_static": {"type": "Extended color light", "swversion":"1.90.1","swconfigid":"772B0E5E","productid":"Philips-LCT015-1-A19ECLv5","manufacturername": "Signify Netherlands B.V."}}
lightTypes["LCT015"] = {"v1_static": {"type": "Extended color light", "swversion":"1.104.2","swconfigid":"772B0E5E","productid":"Philips-LCT015-1-A19ECLv5","manufacturername": "Signify Netherlands B.V."}}
lightTypes["LCT015"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"}
lightTypes["LCT015"]["v1_static"]["capabilities"] = {"certified": True,"control": {"colorgamut": [[0.6915,0.3083],[0.17,0.7],[0.1532,0.0475]],"colorgamuttype": "C","ct": {"max": 500,"min": 153},"maxlumen": 800,"mindimlevel": 1000},"streaming": {"proxy": False,"renderer": True}}
lightTypes["LCT015"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.","product_archetype": "sultan_bulb","product_name": "Hue color lamp","software_version": "1.90.1"}
lightTypes["LCT015"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.","product_archetype": "sultan_bulb","product_name": "Hue color lamp","software_version": "1.104.2"}
lightTypes["LCT015"]["state"] = {"on": False, "bri": 200, "hue": 0, "sat": 0, "xy": [0.0, 0.0], "ct": 461, "alert": "none", "mode": "homeautomation", "effect": "none", "colormode": "ct", "reachable": True}
lightTypes["LCT015"]["config"] = {"archetype": "sultanbulb", "function": "mixed", "direction": "omnidirectional","startup":{"mode":"safety","configured": True}}
lightTypes["LCT015"]["dynamics"] = {"speed": 0, "speed_valid": False, "status": "none", "status_values": ["none", "dynamic_palette"]}

## Hue Lightstrip Plus
lightTypes["LST002"] = {"v1_static": {"type": "Color light", "manufacturername": "Signify Netherlands B.V.", "swversion": "1.90.1", "productname":"Hue lightstrip plus","swconfigid":"59F2C3A3","productid":"Philips-LST002-1-LedStripsv3"}}
lightTypes["LST002"] = {"v1_static": {"type": "Color light", "manufacturername": "Signify Netherlands B.V.", "swversion": "1.104.2", "productname":"Hue lightstrip plus","swconfigid":"59F2C3A3","productid":"Philips-LST002-1-LedStripsv3"}}
lightTypes["LST002"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"}
lightTypes["LST002"]["v1_static"]["capabilities"] = {"certified":True,"control":{"mindimlevel":40,"maxlumen":1600,"colorgamuttype":"C","colorgamut":[[0.6915,0.3083],[0.17,0.7],[0.1532,0.0475]],"ct":{"min":153,"max":500}},"streaming":{"renderer":True,"proxy":True}}
lightTypes["LST002"]["device"] = {"certified": True, "manufacturer_name": "Signify Netherlands B.V.", "product_archetype": "hue_lightstrip", "product_name": "Hue lightstrip plus", "software_version": "1.90.1"}
lightTypes["LST002"]["device"] = {"certified": True, "manufacturer_name": "Signify Netherlands B.V.", "product_archetype": "hue_lightstrip", "product_name": "Hue lightstrip plus", "software_version": "1.104.2"}
lightTypes["LST002"]["state"] = {"on": False, "bri": 200, "hue": 0, "sat": 0, "xy": [0.0, 0.0], "ct": 461, "alert": "none", "mode": "homeautomation", "effect": "none", "colormode": "ct", "reachable": True}
lightTypes["LST002"]["config"] = {"archetype": "huelightstrip", "function": "mixed", "direction": "omnidirectional", "startup": {"mode": "safety", "configured": False}}
lightTypes["LST002"]["dynamics"] = {"speed": 0, "speed_valid": False, "status": "none", "status_values": ["none", "dynamic_palette"]}
Expand All @@ -42,12 +42,12 @@
lightTypes["LWB010"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"}
lightTypes["LWB010"]["config"] = {"archetype": "classicbulb", "function": "mixed", "direction": "omnidirectional", "startup":{"mode":"safety","configured":True}}
lightTypes["LWB010"]["v1_static"]["capabilities"] = {"certified": True,"control": {"mindimlevel": 5000, "maxlumen": 806}, "streaming": {"renderer": False, "proxy": False}}
lightTypes["LWB010"]["device"] = {"certified": True, "manufacturer_name": "Signify Netherlands B.V.", "product_archetype": "classic_bulb", "product_name": "Color temperature light", "software_version": "1.90.1"}
lightTypes["LWB010"]["device"] = {"certified": True, "manufacturer_name": "Signify Netherlands B.V.", "product_archetype": "classic_bulb", "product_name": "Color temperature light", "software_version": "1.104.2"}
lightTypes["LWB010"]["state"] = {"on": False, "bri": 254,"alert": "none", "mode": "homeautomation", "reachable": True}
lightTypes["LWB010"]["dynamics"] = {"speed": 0, "speed_valid": False, "status": "none", "status_values": ["none", "dynamic_palette"]}

## Controlt Temp Hue Bulb
lightTypes["LTW001"] = {"v1_static": {"type": "Color temperature light", "manufacturername": "Signify Netherlands B.V.", "swversion": "1.90.1"}}
lightTypes["LTW001"] = {"v1_static": {"type": "Color temperature light", "manufacturername": "Signify Netherlands B.V.", "swversion": "1.104.2"}}
lightTypes["LTW001"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"}
lightTypes["LTW001"]["v1_static"]["capabilities"] = {"certified": True,"control": {"mindimlevel": 1000,"maxlumen": 806,"ct": {"min": 153,"max": 454}},"streaming": {"renderer": False,"proxy": False}}
lightTypes["LTW001"]["config"] = {"archetype": "classicbulb","function": "functional","direction": "omnidirectional", "startup":{"mode":"safety","configured":True}}
Expand All @@ -56,10 +56,10 @@
lightTypes["LTW001"]["dynamics"] = {"speed": 0, "speed_valid": False, "status": "none", "status_values": ["none", "dynamic_palette"]}

## Hue Gradient TV Lightstrip
lightTypes["LCX002"] = {"v1_static": {"type": "Extended color light", "manufacturername": "Signify Netherlands B.V.", "productname": "Hue play gradient lightstrip","swversion": "1.90.1","swconfigid": "C74E5108","productid": "Philips-LCX002-1-LedStripPXv1"}}
lightTypes["LCX002"] = {"v1_static": {"type": "Extended color light", "manufacturername": "Signify Netherlands B.V.", "productname": "Hue play gradient lightstrip","swversion": "1.104.2","swconfigid": "C74E5108","productid": "Philips-LCX002-1-LedStripPXv1"}}
lightTypes["LCX002"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-11-02T19:46:12"}
lightTypes["LCX002"]["v1_static"]["capabilities"] = {"certified": True,"control": {"mindimlevel": 100,"maxlumen": 1600,"colorgamuttype": "C","colorgamut": [[0.6915,0.3083],[0.1700,0.7000],[0.1532,0.0475]],"ct": {"min": 153,"max": 500}},"streaming": {"renderer": True,"proxy": True}}
lightTypes["LCX002"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.","model_id": "LCX002","product_archetype": "hue_lightstrip_tv","product_name": "Hue play gradient lightstrip","software_version": "1.90.1"}
lightTypes["LCX002"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.","model_id": "LCX002","product_archetype": "hue_lightstrip_tv","product_name": "Hue play gradient lightstrip","software_version": "1.104.2"}
lightTypes["LCX002"]["state"] = {"on": False, "bri": 254,"hue": 8417,"sat": 140,"effect": "none","xy": [0.0,0.0],"ct": 366,"alert": "select","colormode": "ct","mode": "homeautomation","reachable": True, "gradient": {"points": []}}
lightTypes["LCX002"]["config"] = {"archetype": "huelightstriptv","function": "mixed","direction": "omnidirectional","startup": {"mode": "safety","configured": False}}
lightTypes["LCX002"]["dynamics"] = {"speed": 0, "speed_valid": False, "status": "none", "status_values": ["none", "dynamic_palette"]}
Expand Down Expand Up @@ -93,26 +93,26 @@


## Hue Plug
lightTypes["LOM001"] = {"v1_static": {"type": "On/Off plug-in unit","manufacturername": "Signify Netherlands B.V.","productname": "Hue Smart plug","swversion": "1.90.1","swconfigid": "A641B5AB","productid": "SmartPlug_OnOff_v01-00_01"}}
lightTypes["LOM001"] = {"v1_static": {"type": "On/Off plug-in unit","manufacturername": "Signify Netherlands B.V.","productname": "Hue Smart plug","swversion": "1.104.2","swconfigid": "A641B5AB","productid": "SmartPlug_OnOff_v01-00_01"}}
lightTypes["LOM001"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"}
lightTypes["LOM001"]["v1_static"]["capabilities"] = {"certified": True,"control": {},"streaming": {"renderer": False,"proxy": False}}
lightTypes["LOM001"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.", "model_id": "LOM001", "product_archetype": "plug","product_name": "Hue Smart plug","software_version": "1.90.1"}
lightTypes["LOM001"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.", "model_id": "LOM001", "product_archetype": "plug","product_name": "Hue Smart plug","software_version": "1.104.2"}
lightTypes["LOM001"]["state"] = {"on": False,"alert": "select","mode": "homeautomation","reachable": True}
lightTypes["LOM001"]["config"] = {"archetype": "plug","function": "functional","direction": "omnidirectional","startup":{"mode": "safety","configured": True}}
lightTypes["LOM001"]["dynamics"] = {"status": "none", "status_values": ["none"]}

lightTypes["LOM004"] = {"v1_static": {"type": "On/Off plug-in unit","manufacturername": "Signify Netherlands B.V.","productname": "Hue Smart plug","swversion": "1.90.1","swconfigid": "A641B5AB","productid": "SmartPlug_OnOff_v01-00_01"}}
lightTypes["LOM004"] = {"v1_static": {"type": "On/Off plug-in unit","manufacturername": "Signify Netherlands B.V.","productname": "Hue Smart plug","swversion": "1.104.2","swconfigid": "A641B5AB","productid": "SmartPlug_OnOff_v01-00_01"}}
lightTypes["LOM004"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"}
lightTypes["LOM004"]["v1_static"]["capabilities"] = {"certified": True,"control": {},"streaming": {"renderer": False,"proxy": False}}
lightTypes["LOM004"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.", "model_id": "LOM001", "product_archetype": "plug","product_name": "Hue Smart plug","software_version": "1.90.1"}
lightTypes["LOM004"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.", "model_id": "LOM001", "product_archetype": "plug","product_name": "Hue Smart plug","software_version": "1.104.2"}
lightTypes["LOM004"]["state"] = {"on": False,"alert": "select","mode": "homeautomation","reachable": True}
lightTypes["LOM004"]["config"] = {"archetype": "plug","function": "functional","direction": "omnidirectional","startup":{"mode": "safety","configured": True}}
lightTypes["LOM004"]["dynamics"] = {"status": "none", "status_values": ["none"]}

lightTypes["LOM010"] = {"v1_static": {"type": "On/Off plug-in unit","manufacturername": "Signify Netherlands B.V.","productname": "Hue Smart plug","swversion": "1.90.1","swconfigid": "A641B5AB","productid": "SmartPlug_OnOff_v01-00_01"}}
lightTypes["LOM010"] = {"v1_static": {"type": "On/Off plug-in unit","manufacturername": "Signify Netherlands B.V.","productname": "Hue Smart plug","swversion": "1.104.2","swconfigid": "A641B5AB","productid": "SmartPlug_OnOff_v01-00_01"}}
lightTypes["LOM010"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"}
lightTypes["LOM010"]["v1_static"]["capabilities"] = {"certified": True,"control": {},"streaming": {"renderer": False,"proxy": False}}
lightTypes["LOM010"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.", "model_id": "LOM001", "product_archetype": "plug","product_name": "Hue Smart plug","software_version": "1.90.1"}
lightTypes["LOM010"]["device"] = {"certified": True,"manufacturer_name": "Signify Netherlands B.V.", "model_id": "LOM001", "product_archetype": "plug","product_name": "Hue Smart plug","software_version": "1.104.2"}
lightTypes["LOM010"]["state"] = {"on": False,"alert": "select","mode": "homeautomation","reachable": True}
lightTypes["LOM010"]["config"] = {"archetype": "plug","function": "functional","direction": "omnidirectional","startup":{"mode": "safety","configured": True}}
lightTypes["LOM010"]["dynamics"] = {"status": "none", "status_values": ["none"]}
Expand Down

0 comments on commit a7feb33

Please sign in to comment.