QNimbus/node-red-contrib-openhab-v2

Node is completely broken with OpenHab Version 3 Milestone 2

Closed this issue · 6 comments

I haven't been able to track down the problem just yet but the node fails to communicate with the REST API. It appears to be an authentication problem.

Error messages include:

  • "Cannot destructure property 'state' of 'undefined' as it is undefined."
  • "Error: Request failed with status code 401"

Node was working fine with Version 2.

From what I can establish, OpenHAB Version 3 Milestone 2 does not accept anonymous REST API calls any more - not sure if this is intentional or a bug.
The credentials configuration in this node does not seem to be working. I can enter my credentials in the config node but they do not get saved and are blank when I return to the config node settings. A packet dump of the traffic between this node and OpenHAB shows that the credentials are missing from the API request header.

Thank you for your elaborate feedback, I will try to investigate this issue - if you happen to have found a working solution for this I would be happy to accept a PR.

I haven't been able to find proper documentation (yet) on the new REST API and how to properly authenticate against it. (It uses a bearer token that needs to be acquired - but I'm not sure if you can also authenticate using a regular username and password combination)

If you have more info I would be happy to look into it - I'm a bit short on time due to several other projects I'm currently working on.

@QNimbus
Milestone2 added support for basic auth, but its not working in node-red for some reason.
I also have Blue iris, and there I used token.

I've worked it this was
http://TOKEN@/items/ITEMNAME

If i'll add the token to flow.json "username":"token" I can get a list of items, but after some deployment its gone :(

I found out the following for the rest api:

subscribtion to events the smarthome has been replaced by openhab:
"/rest/events?topics=smarthome/items", {}); has to become "/rest/events?topics=openhab/items", {});

Put and post requests need the following header:
Knipsel

I tested this on the openhab2 contribution

to retrieve item states by the get method, post, or put requests to update items authentication is not need

Hope this helps

Hi, is there any update on this issue ?
I have the same issue with RC1 of OH3.
error 401 and user/password is not saved in the Node-Red controller