Page 1 of 1

HA Bridge not working after update to latest Stable

Posted: Tuesday 14 November 2023 20:59
by StanHD
Version: 2023.2 (build 15457)
Platform: Windows 10
Plugin/Hardware: HA Bridge
Description:

Good evening. I have had a reliable Domoticz system for some time now, however I have just updated to the stable version as above.

I make use of HA Bridge to enable Alexa with my Domoticz installation. Since the update, most of the calls from HA Bridge no longer work, and it is now unable to call the list of devices as it did before, returning these errors:-

HTTP response code was not an expected successful response of between 200 - 299, the code was: HTTP/1.1 401 Unauthorized with the content of <<<<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>>>>

On/Off Request failed with: [{"error":{"type":"6","address":"/lights/116","description":"Error on calling url to change device state","method_name":"/lights/116/state"}}]

Could this be due to the JSON API changes, or the API protection.

When I paste the JSON form the Bridge into a browser, the expected switch state response from Domoticz is correct.

Any help gratefully received, thank you.

Re: HA Bridge not working after update to latest Stable

Posted: Wednesday 15 November 2023 0:30
by waltervl
Would have helped if you told from what version you updated.
But you probably have to look in menu setup - settings tab security for the setting Allow API basic authorisation for Http.

In your case you should switch it on as you are not using https

Re: HA Bridge not working after update to latest Stable

Posted: Wednesday 15 November 2023 10:41
by StanHD
Thank you for your quick response.
Apologies, previous version was 2022.2
I have now set to allow for Basic Auth for HTTP, however this has not yet fixed the problem. I have erased caches on browsers and checked using incognito mode in Chrome, but still getting same errors.
Thanks for any further advice.

Re: HA Bridge not working after update to latest Stable

Posted: Wednesday 15 November 2023 12:47
by waltervl
Then it could be a HA Bridge integration configuration issue.

I don't know what it is and how implemented (plugin, integration MQTT?). Perhaps search for an HA Bridge forum topic for users with similar issues.

Re: HA Bridge not working after update to latest Stable

Posted: Thursday 16 November 2023 0:22
by StanHD
I have investigated further and discovered that there is a pull request awaiting a merge on Github that should fix the issue. This was made in September so I guess I will just need to await an update.

Thanks for your advice.

Re: HA Bridge not working after update to latest Stable

Posted: Thursday 16 November 2023 14:14
by waltervl
Or implement the fix yourself manually.

Re: HA Bridge not working after update to latest Stable

Posted: Thursday 16 November 2023 19:56
by StanHD
HA-Bridge runs from a .JAR file on a dedicated RPi. The 2 modified lines in the "DomoticzHandler.java" are:-

public class DomoticzHandler {
private static final Logger log = LoggerFactory.getLogger(DomoticzHandler.class);
private static final String GET_REQUEST = "/json.htm?type=";
private static final String DEVICES_TYPE = "devices";

private static final String GET_REQUEST = "/json.htm?type=command&param=";
private static final String DEVICES_TYPE = "getdevices";

I have no idea how to get these modified lines into the .JAR file but I think I may know someone who does.

I will update here if I get it done.

Re: HA Bridge not working after update to latest Stable

Posted: Thursday 16 November 2023 23:42
by waltervl
A jar file is a kind of a zip file. See for example instructions https://www.w3docs.com/snippets/java/ho ... -file.html

Re: HA Bridge not working after update to latest Stable

Posted: Friday 17 November 2023 16:08
by StanHD
Thank you, I really appreciate your advice, and have followed the link.
I have opened the archive in 7Zip as suggested. I have located the DomoticzHandler.Class file, but unfortunately it is binary so not a simple text edit.
Will keep trying though.

Re: HA Bridge not working after update to latest Stable

Posted: Wednesday 28 August 2024 21:10
by dthompson
I've also been fighting this beast since i upgraded to the latest version of Domoticz 2024.7 and had to completely redo my system of Zwave devices to move to the new Z-Wave JS UI and MQTT broker configuration. Boy, was that fun.......NOT !!!

Anyhow, i'm mostly back up and running and my last hurdle was to get HA-Bridge up and running under the new configuration. Through much trial and error, i was able to get it to mostly work. The auto discover of Domoticz devices is broken, as noted by someone else. The old JSON calls need to be fixed in HA-Bridge, but i don't know how to do that.

So, instead, i manually added the few lights that i wanted into HA-Bridge. See my screen capture below. I can't seem to get the dimming function to work, but at least i can now tell Alexa to turn my lights on or off again. YAY !!!!!
HA-Bridge switch control.png
HA-Bridge switch control.png (63.51 KiB) Viewed 642 times
Also, you'll need to set the "Unique ID to use 9 Octets (Renumber after saving this setting)" to true under the Bridge Control tab. Otherwise, i couldn't get Alexa to discover my lights.

Good luck !!!