Like others, I upgraded to 2.4 release recently, and I’ve also been tweaking the OH Config files to take advantage of the updates, as well as add/remove the Lighting
tag on various items.
For me, the HueEmulation has been getting out of sync after certain openHAB configuration changes, resulting in odd behavior across openHAB Service restarts. It looks like the advertised/mapped HueId’s are changed, and no longer match what’s stored in Alexa (from it’s original Discover Devices)
The behaviour is that you’ll ask for a light to be turned on, and some other device will go on instead.
Looking at the Hue Storage JSON (the map between the HueId’s and the Item name):
/var/lib/openhab2/jsondb/hue.emulation.lights.json
I observe that, upon openHAB service restart, this file is emptied out at some point in the process and then rebuilt. To restart, I’m using:
service openhab2 restart
Using watch on this file, against a backup, during the service start I can see that it’s getting cleared out and then rebuilt with newly resequenced HueId’s.
To reproduce the issue:
- Backup the Hue Storage in
/var/lib/openhab2/jsondb/hue.emulation.lights.json
- Edit an Item, and disable it’s Hue tagging (eg
Lighting
->LightingDISABLED
) - Observe it disappear from the existing Hue Storage file, leaving a hole (expected)
- <at this point it’s still known by Alexa, no biggie>
- Restart the openHAB service (
service openhab2 restart
) - Observe the Hue Storage file eventually get blanked out (
{}
) - After a while, the Hue Storage will be rebuilt with new Id’s (off-by-one in many cases now)
Once the HueId’s are generated/persisted into the Hue Storage, I expected them to be immutable for a given openHAB Item. I’m not sure why item (6) is happening, but it seems to be the root cause of the off-by-one issues when accessing the Lighting controls via Hue. Presumably similar things happen when Lighting Items are added to the config files.
I can delete the Alexa-discovered stuff, and re-discover Devices, but I have a lot of them (20+) so I’d like to avoid that.
Environment
- openHAB 2.4 release, using config files for items, things, etc
- Ubuntu 16.04.10 (Linux version 4.4.0-140-generic) VM
- Amazon Echo Dot gen 1 & gen 2 (and an Alexa-enabled Brilliant Tech device)
The observed behaviour is similar to this discussion: