Translate

Sunday, May 30, 2021

Home Automation - fixing Ha-Bridge

Are now years I'm using a program called Ha-Bridge that basically simulate a Philips Hue hub.

The peculiarity of this program is that can be recognized by Alexa and it can control my X10 lights via Heyu. I did set up this system in the 2016, as described in the article of this blog Playing with Alexa and Echo

After many years I never update the HA-bridge code and things always worked well ... almost :)

In the past I already experienced some small problems, having some "macro" on Alexa suddenly not properly working.
But the problem solved apparently itself after few days.

This time I had to add a new X10 device and there started the odyssey.
The new device was not added to the list of the discovered devices in Alexa.
Alexa was unable to discover the device, however I was able to see it in the HA-bridge web page and use it !
So, as apparently many other people did, I decided to erase all the devices from Alexa and start a total new discovery.

Disaster !

Alexa was unable to rediscover the devices !
Suddenly I was without vocal interface to control the house.

So ... here a possible solution, meaning it worked for me, about the problem 

"Amazon Alexa is unable to discover devices defined with Ha-Bridge"

I spent quite some time reading posts and similar experiences and of course doing so I also update the Ha-Bridge code to the latest.
But it took quite some time to find the problem.

The problem seems related to the way Alexa store the ID of the devices, it has an internal cache that prevent to rediscovery a device found previously.
So the hack is relatively easy :
  • log in to the server with a terminal
  • go in the Ha-Bridge directory (in my case : ~/habridge)
  • go in the data directory (cd data)
  • edit the file devices.db that contain a Json formatted load
  • manually change the value of the uniqueid for each device present in the db in something new and unique
  • save the file
  • restart the Ha-Bridge (can be done from the web interface)
At this point is possible to ask Alexa to discover devices and all the devices should appears !

To simplify the editing I did install a utility called JSONEditor.

That's it !
 

No comments:

Post a Comment