Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Take into account httpRoot. #25

Open
kevinduong opened this issue Jul 26, 2018 · 14 comments
Open

Take into account httpRoot. #25

kevinduong opened this issue Jul 26, 2018 · 14 comments

Comments

@kevinduong
Copy link

The NodeRed contrib plugin doesn't take into account httpRoot. This breaks routing if you're trying to view some of the endpoints.

Steps to reproduce the behavior:

  1. Configure httpRoot in NodeRed settings.js
  2. Try to enter in an entity in NodeRed
  3. You'll get a 404.

Expected behavior
Shouldn't receive a 404.

  • Node Red Version: Latest
  • NR Home Assistant Plugin Version: Latest
  • Is Node Red running in Docker: Yes

Other (please complete the following information):
AYapejian#86

@schford
Copy link

schford commented Jul 26, 2018

Thanks - following!

@Spartan-II-117
Copy link
Owner

What does the httpRoot function do?
I'll try to look into this this afternoon

@kevinduong
Copy link
Author

I don't think it's a function, it's a variable that gets stored in nodered's settings.js.
This is an issue for users that have custom routing (ex: nginx reverse proxy). The plugin doesn't handle these routes correctly.

The URLs would also need to be updated in the .html files. The httpRoot setting should be taken into account here.

Example:
If you look in server-events-state-changed.html:
Line47: $.get('/homeassistant/entities').done((entities)

Maybe the httpRoot setting needs to be concatenated to that?

@Spartan-II-117
Copy link
Owner

This may be a bug in AYapejian/node-home-assistant.
I'll look into it further

@kevinduong
Copy link
Author

Going off the .html stuff I mentioned in my previous comment, a good temporary workaround is to go through all of the .html files under each folder under the nodes directory and add your directory to the URL.

So I basically just did a CTRL + F on "homeassistant" and concatenated my route to the URL it's trying to get.

Restart nodered, then you'll see your entity IDs populating.

Let me know if you'd like any help or a test environment. I could probably throw one up.

@kevinduong
Copy link
Author

Here's another workaround for those using an nginx reverse proxy like I am

AYapejian#41

@Spartan-II-117
Copy link
Owner

I think i understand it, I'll check if i can just add a variable to the beginning, I just need to figure out how to access it properly.

@fanthos
Copy link

fanthos commented Sep 20, 2018

AYapejian#76 (comment)
This comment has more details about the issue.

@Spartan-II-117
Copy link
Owner

@kevinduong is there a variable (I presume httproot) that could/should be aded to the beginning of the html strings? if so could you submit a PR with an example?

zachowj added a commit to zachowj/node-red-contrib-home-assistant-websocket that referenced this issue Sep 23, 2018
@zachowj
Copy link

zachowj commented Oct 7, 2018

I have a fix for this on my WebSocket fork feel free to cherry-pick it if you would like.

These are the two commits:
zachowj/node-red-contrib-home-assistant-websocket@04ad398
zachowj/node-red-contrib-home-assistant-websocket@cf2a4ad

There is also fixes for #26, #34 and #36 but they're probably not as easily cherry-picked.

@simonszu
Copy link

Has this arrived in an actual release? I am currently postponing all my HA-nodered stuff until this is fixed.

@kevinduong
Copy link
Author

kevinduong commented Oct 17, 2018 via email

@Spartan-II-117
Copy link
Owner

I pushed the changes to NPM, so it should be fixed

@simonszu
Copy link

I'm sorry, but it doesn't work for me. Maybe i've configured it the wrong way? Here's what i did:

  1. Deploy HA and node-red via docker
  2. Making sure that this module is installed in version 3.10
  3. Configured a reverse proxy, so that node-red is reachable via node-red.mydomain.tld and HA via assistant.mydomain.tld
  4. Both containers are in the same docker network, HA is reachable via internal hostname homeassistant_app_1
  5. Did not configure a legacy API password in HA, created a LLAT
  6. Configured node-red's httpRoot to "/"
  7. Added a HA element to the flow, configured it with the server "http://homeassistant_app_1:8123" and the LLAT. API password field is empty.

Result: Error "Cannot get /homeassistant/entities", however, when i deploy the flow, the node says "Connected". The element list stays empty.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants