node-red-contrib-home-assistant-llat
node-red-contrib-home-assistant-llat copied to clipboard
Take into account httpRoot.
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:
- Configure httpRoot in NodeRed settings.js
- Try to enter in an entity in NodeRed
- 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): https://github.com/AYapejian/node-red-contrib-home-assistant/issues/86
Thanks - following!
What does the httpRoot function do? I'll try to look into this this afternoon
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?
This may be a bug in AYapejian/node-home-assistant. I'll look into it further
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.
Here's another workaround for those using an nginx reverse proxy like I am
https://github.com/AYapejian/node-red-contrib-home-assistant/issues/41
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.
https://github.com/AYapejian/node-red-contrib-home-assistant/issues/76#issuecomment-408111524 This comment has more details about the issue.
@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?
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: https://github.com/zachowj/node-red-contrib-home-assistant-websocket/commit/04ad3984b326ea239de26eb4ffa8a168ad5b8d02 https://github.com/zachowj/node-red-contrib-home-assistant-websocket/commit/cf2a4ad5df8772a0fb508debe946ce39bccd9141
There is also fixes for #26, #34 and #36 but they're probably not as easily cherry-picked.
Has this arrived in an actual release? I am currently postponing all my HA-nodered stuff until this is fixed.
I think it's fixed in this fork
https://github.com/zachowj/node-red-contrib-home-assistant-websocket
On Wed, Oct 17, 2018, 4:06 PM Simon Szustkowski [email protected] wrote:
Has this arrived in an actual release? I am currently postponing all my HA-nodered stuff until this is fixed.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Spartan-II-117/node-red-contrib-home-assistant-llat/issues/25#issuecomment-430789080, or mute the thread https://github.com/notifications/unsubscribe-auth/ACqSwM-RqpuG1vP6NqlIUok2vIN_uNnvks5ul5vQgaJpZM4Vh53p .
I pushed the changes to NPM, so it should be fixed
I'm sorry, but it doesn't work for me. Maybe i've configured it the wrong way? Here's what i did:
- Deploy HA and node-red via docker
- Making sure that this module is installed in version 3.10
- Configured a reverse proxy, so that node-red is reachable via node-red.mydomain.tld and HA via assistant.mydomain.tld
- Both containers are in the same docker network, HA is reachable via internal hostname homeassistant_app_1
- Did not configure a legacy API password in HA, created a LLAT
- Configured node-red's httpRoot to "/"
- 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.