Closed freddebo closed 5 years ago
Have we introduced a bug @mariusmotea
It feels like it would be simple to add another exception in the updateConfig() for the Tradfri section of the code. Tried to add another else if at the end with the type of "On/OFF plug-in unit" but it did't work. Same error.
Deconz API for the lights looks like this:
"4": {
"etag": "a7e421c45b8981e0de70d19984b07fb8",
"hascolor": false,
"manufacturername": "IKEA of Sweden",
"modelid": "TRADFRI control outlet",
"name": "Light 4",
"state": {
"alert": "none",
"bri": 25,
"on": true,
"reachable": true
},
"swversion": "1.4.020",
"type": "On/Off plug-in unit",
"uniqueid": "90:fd:9f:ff:fe:31:ec:2a-01"
}
Tried an older versin of the HueEmulator also but it is the same now. Only works if they are added to deconz while running.
Please remove this part from HueEmulatior:
if bridge_config["lights"][light]["modelid"].startswith("TRADFRI"):
if bridge_config["lights"][light]["type"] == "Color temperature light":
bridge_config["lights"][light].update({"manufacturername": "Philips", "modelid": "LTW001", "uniqueid": "00:17:88:01:00:" + hex(random.randrange(0,255))[2:] + ":" + hex(random.randrange(0,255))[2:] + ":" + hex(random.randrange(0,255))[2:] + "-0b","swversion": "5.50.1.19085"})
elif bridge_config["lights"][light]["type"] == "Color light":
bridge_config["lights"][light].update({"type": "Extended color light", "manufacturername": "Philips", "modelid": "LCT015", "uniqueid": "00:17:88:01:00:" + hex(random.randrange(0,255))[2:] + ":" + hex(random.randrange(0,255))[2:] + ":" + hex(random.randrange(0,255))[2:] + "-0b", "swversion": "1.29.0_r21169"})
elif bridge_config["lights"][light]["type"] == "Dimmable light":
bridge_config["lights"][light].update({"manufacturername": "Philips", "modelid": "LWB010", "uniqueid": "00:17:88:01:00:" + hex(random.randrange(0,255))[2:] + ":" + hex(random.randrange(0,255))[2:] + ":" + hex(random.randrange(0,255))[2:] + "-0b", "swversion": "1.15.0_r18729"})
I believe this was imported from deconz without modelid key and to solve this you need to add the "modelid": "TRADFRI control outlet"
also in config.json to this light.
So was this an error with deconz or our code. Just want to make sure it can't happen again
From your log the modelid for that light had the value None
. If this way was imported from deconz, then is a problem with deconz, if it was changed by HueEmulator then is a problem with this software. I believe the issue was with deconz because the import is done by simply copy all details from deconz
for light in deconz_lights:
if light not in bridge_config["deconz"]["lights"] and "modelid" in deconz_lights[light]:
new_light_id = nextFreeId(bridge_config, "lights")
logging.debug("register new light " + new_light_id)
bridge_config["lights"][new_light_id] = deconz_lights[light]
bridge_config["lights"][new_light_id] = deconz_lights[light]
is the copy line with no other filters.
It works fine by just removing the startswith("TRADFRI")
part of the code. The "modelid": "TRADFRI control outlet"
was already defined in the config.json. Now it also works with adding another outlet directly without changing anything.
But I have not tested any Trådfri Lights, so I don't know if it still is needed.
Thanks!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed as it has not had any recent activity. Thank you for your contributions.
I had the same problem with the current release and fixed it with removing line 235 and following.
File "/opt/hue-emulator/HueEmulator3.py", line 1783, in <module>
updateConfig()
File "/opt/hue-emulator/HueEmulator3.py", line 235, in updateConfig
if light["modelid"].startswith("TRADFRI"):
AttributeError: 'NoneType' object has no attribute 'startswith'
After I have added the Trådfri Outlet in Deconz, it works fine. Just that it shows as a dimmer light instead of on/off. No real problem. Think that's in Deconz.
After I updated the software last night, it won't start any more and get this error from the debug:
Any suggestions other than removing the outlets, add them again and not restart the Hue emulator? That works but is not optimal.