diff --git a/BridgeEmulator/HueObjects/Light.py b/BridgeEmulator/HueObjects/Light.py index c83c2d613..cf0985e05 100644 --- a/BridgeEmulator/HueObjects/Light.py +++ b/BridgeEmulator/HueObjects/Light.py @@ -125,7 +125,7 @@ def getV1Api(self): result["state"] = {"on": self.state["on"]} if "bri" in self.state and self.modelid not in ["LOM001", "LOM004", "LOM010"]: result["state"]["bri"] = int(self.state["bri"]) if self.state["bri"] is not None else 1 - if "ct" in self.state and self.modelid not in ["LOM001", "LOM004", "LOM010", "LTW001"]: + if "ct" in self.state and self.modelid not in ["LOM001", "LOM004", "LOM010", "LTW001", "LLC010"]: result["state"]["ct"] = self.state["ct"] result["state"]["colormode"] = self.state["colormode"] if "xy" in self.state and self.modelid not in ["LOM001", "LOM004", "LOM010", "LTW001", "LWB010"]: @@ -291,7 +291,7 @@ def getV2Api(self): "points_capable": self.protocol_cfg["points_capable"]} # color lights only - if self.modelid in ["LST002", "LCT001", "LCT015", "LCX002", "915005987201", "LCX004", "LCX006", "LCA005"]: + if self.modelid in ["LST002", "LCT001", "LCT015", "LCX002", "915005987201", "LCX004", "LCX006", "LCA005", "LLC010"]: colorgamut = lightTypes[self.modelid]["v1_static"]["capabilities"]["control"]["colorgamut"] result["color"] = { "gamut": { diff --git a/BridgeEmulator/HueObjects/Sensor.py b/BridgeEmulator/HueObjects/Sensor.py index 3395151fe..6466a5531 100644 --- a/BridgeEmulator/HueObjects/Sensor.py +++ b/BridgeEmulator/HueObjects/Sensor.py @@ -286,7 +286,7 @@ def getTemperature(self): "temperature": { "temperature_report":{ "changed": self.state["lastupdated"], - "temperature": self.state["temperature"]/100 + "temperature": self.state["temperature"]/100 if type(self.state["temperature"]) == int else self.state["temperature"] } }, "owner": { diff --git a/BridgeEmulator/lights/light_types.py b/BridgeEmulator/lights/light_types.py index 85692e10f..055dea555 100644 --- a/BridgeEmulator/lights/light_types.py +++ b/BridgeEmulator/lights/light_types.py @@ -55,6 +55,15 @@ lightTypes["LTW001"]["state"] = {"on": False, "colormode": "ct", "alert": "none", "mode": "homeautomation", "reachable": True, "bri": 254, "ct": 230} lightTypes["LTW001"]["dynamics"] = {"speed": 0, "speed_valid": False, "status": "none", "status_values": ["none", "dynamic_palette"]} +## Hue Iris +lightTypes["LLC010"] = {"v1_static": {"type": "Color Gamut light", "manufacturername": "Signify Netherlands B.V.", "swversion": "1.104.2"}} +lightTypes["LLC010"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-12-09T19:13:52"} +lightTypes["LLC010"]["v1_static"]["capabilities"] = {"certified": True,"control": {"colorgamut": [[0.704,0.296],[0.215,0.711],[0.138,0.08]],"colorgamuttype": "A","maxlumen": 600,"mindimlevel": 5000},"streaming": {"renderer": False,"proxy": False}} +lightTypes["LLC010"]["config"] = {"archetype": "hueiris","function": "functional","direction": "omnidirectional", "startup":{"mode":"safety","configured":True}} +lightTypes["LLC010"]["device"] = {"certified": True, "manufacturer_name": "Signify Netherlands B.V.", "product_archetype": "hueiris", "product_name": "Dimmable light", "software_version": "1.76.6"} +lightTypes["LLC010"]["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["LLC010"]["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.104.2","swconfigid": "C74E5108","productid": "Philips-LCX002-1-LedStripPXv1"}} lightTypes["LCX002"]["v1_static"]["swupdate"] = {"state": "noupdates","lastinstall": "2020-11-02T19:46:12"} diff --git a/BridgeEmulator/lights/protocols/deconz.py b/BridgeEmulator/lights/protocols/deconz.py index 029baa96f..b1d401664 100644 --- a/BridgeEmulator/lights/protocols/deconz.py +++ b/BridgeEmulator/lights/protocols/deconz.py @@ -47,6 +47,8 @@ def discover(detectedLights, credentials): modelid = "LTW001" elif light["type"] == "On/Off plug-in unit": modelid = "LOM001" + elif light["type"] == "Color light": + modelid = "LLC010" detectedLights.append({"protocol": "deconz", "name": light["name"], "modelid": modelid, "protocol_cfg": {"ip": credentials["deconzHost"] + ":" + str(credentials["deconzPort"]), "deconzUser": credentials["deconzUser"], "modelid": light["modelid"], "deconzId": id, "uniqueid": light["uniqueid"]}}) except Exception as e: logging.info("Error connecting to Deconz: %s", e) diff --git a/BridgeEmulator/lights/protocols/hue.py b/BridgeEmulator/lights/protocols/hue.py index 26a381984..2d98e277d 100644 --- a/BridgeEmulator/lights/protocols/hue.py +++ b/BridgeEmulator/lights/protocols/hue.py @@ -46,6 +46,8 @@ def discover(detectedLights, credentials): modelid = "LTW001" elif light["type"] == "On/Off plug-in unit": modelid = "LOM001" + elif light["type"] == "Color light": + modelid = "LLC010" detectedLights.append({"protocol": "hue", "name": light["name"], "modelid": modelid, "protocol_cfg": {"ip": credentials["ip"], "hueUser": credentials["hueUser"], "modelid": light["modelid"], "id": id, "uniqueid": light["uniqueid"]}}) except Exception as e: logging.info("Error connecting to Hue Bridge: %s", e) diff --git a/BridgeEmulator/lights/protocols/yeelight.py b/BridgeEmulator/lights/protocols/yeelight.py index e386bdf63..b29972acb 100755 --- a/BridgeEmulator/lights/protocols/yeelight.py +++ b/BridgeEmulator/lights/protocols/yeelight.py @@ -22,6 +22,8 @@ def discover(detectedLights): modelid = "LCT015" elif light["capabilities"]["ct"]: modelid = "LTW001" + elif light["capabilities"]["xy"]: + modelid = "LLC010" detectedLights.append({"protocol": "yeelight", "name": light["capabilities"]["name"] if light["capabilities"]["name"] != '' else 'Yeelight ' + light["capabilities"]["id"], "modelid": modelid, "protocol_cfg": {"ip": light["ip"], "id": light["capabilities"]["id"], "backlight": False, "model": light["capabilities"]["model"]}}) return detectedLights diff --git a/BridgeEmulator/services/homeAssistantWS.py b/BridgeEmulator/services/homeAssistantWS.py index 3365573c1..058cac609 100644 --- a/BridgeEmulator/services/homeAssistantWS.py +++ b/BridgeEmulator/services/homeAssistantWS.py @@ -296,14 +296,19 @@ def discover(detectedLights): supported_colourmodes = ha_state.get('attributes', {}).get('supported_color_modes', []) model_id = None - if HS in supported_colourmodes or XY in supported_colourmodes or RGB in supported_colourmodes or RGBW in supported_colourmodes or RGBWW in supported_colourmodes: + if HS in supported_colourmodes or XY in supported_colourmodes or RGB in supported_colourmodes or RGBW in supported_colourmodes or RGBWW in supported_colourmodes and COLOR_TEMP in supported_colourmodes: model_id = "LCT015" elif COLOR_TEMP in supported_colourmodes: model_id = "LTW001" + elif XY in supported_colourmodes: + model_id = "LLC010" elif BRIGHTNESS in supported_colourmodes: model_id = "LWB010" - else: + elif ONOFF in supported_colourmodes and not BRIGHTNESS in supported_colourmodes: model_id = "LOM001" + else: + logging.info("unknown model id " + str(supported_colourmodes)) + continue protocol_cfg = {"entity_id": entity_id, "ip": "none"} diff --git a/BridgeEmulator/services/mqtt.py b/BridgeEmulator/services/mqtt.py index 94cd5a6d6..8f640959d 100644 --- a/BridgeEmulator/services/mqtt.py +++ b/BridgeEmulator/services/mqtt.py @@ -261,14 +261,16 @@ def on_autodiscovery_light(msg): # Device capabilities keys = data.keys() - light_color = "xy" in keys and data["xy"] == True + light_xy = "xy" in keys and data["xy"] == True light_brightness = "brightness" in keys and data["brightness"] == True light_ct = "color_temp" in keys and data["color_temp"] == True modelid = None - if light_color and light_ct: + if light_xy and light_ct: modelid = "LCT015" - elif light_color: # Every light as LCT001? Or also support other lights + elif light_xy and not light_ct: + modelid = "LLC010" + elif light_xy: # Every light as LCT001? Or also support other lights modelid = "LCT001" elif light_ct: modelid = "LTW001"