node-red-contrib-home-assistant icon indicating copy to clipboard operation
node-red-contrib-home-assistant copied to clipboard

/homeassistant/entities not found

Open FezVrasta opened this issue 7 years ago • 18 comments

Hi I'm having the same problem of #52, it worked fine a week ago. I'm on latest Hass and Node-RED and node-red-contrib-home-assistant

FezVrasta avatar May 21 '18 05:05 FezVrasta

Same problem. My setup: I run node-red on a raspbian pi3 with the IP of 192.168.0.10 I run hass.io (created with the hass.io image) on a separate pi3 with the IP of 192.168.0.11

If I put http://192.168.0.11:8123 as my base URL in the server node settings I get the following error: "Cannot GET /homeassistant/entities"

If I manually check the URL http://192.168.0.11:8123/homeassistant/entities I get a 404 error. All my homeassistant folders seem to be at http://192.168.0.11:8123/ eg. http://192.168.0.11/history returns the states history page.

SierraLimaOscar avatar May 21 '18 11:05 SierraLimaOscar

/homeassistant/entities is a Node-RED Home Assistant endpoint AFAIK, it has nothing to do with your Hass instance.

FezVrasta avatar May 21 '18 11:05 FezVrasta

Oh, @AYapejian I figured out where's the problem, it should look for /node-red/homeassistant/entities in my case, because I configured node-red to be served from the /node-red route (it's a Node-RED option).

I think your lib should take in account that option.

FezVrasta avatar May 21 '18 11:05 FezVrasta

@FezVrasta - OK I get the endpoint comment. Thanks. Weird thing is that while I was trying to figure out what was going on it started working. The only thing I did that might of had an impact was a reset of the hassio host while looking at the tcp traffic. Anyway disregard the above post since a base URL of "http://192.168.0.11:8123" now works.

SierraLimaOscar avatar May 21 '18 12:05 SierraLimaOscar

Me too, but I have "fix" :) /homeassistant/entities (http://localhost:1880/homeassistant/entities) is Node-RED endpoint and it started return values (not 404) actually when I configured (set "Base URL" and "API Pass") Server property in "events: state" node and deployed flow.

My configuration: Home Assistant 0.65.6 Node-RED 0.18.7

blahlt avatar Jun 09 '18 15:06 blahlt

I run HomeAssistant & Node-Red on a standard Debian Buster server not a Pi or HASS.IO or a docker image. Just plain old HomeAssistant. I do not have external ports open nor do I have a DDNS name pointing back to my server. Any external interaction I use HomeKit/HomeBridge and thus Apples security. No issues at all.

Try to get node-red-contrib-home-assistant and HASS communicating is next to impossible. I have tried so many variations of internal address. In fact HomeBridge is on the same server and has no issues talking to HASS. Everywhere I look (HASS Community & Reddit) this seems to be a reoccurring issue and people are saying use an external address. I just don't want to open ports.

Has this been addressed somewhere I am unaware of? Looking forward to getting it going.

Cheers

KmanOz avatar Jun 18 '18 03:06 KmanOz

So what is the fix here, the other thread was a confusing mess and then closed?

Just deploy a flow and it will start working?

ghost avatar Jun 19 '18 10:06 ghost

I tried deploying a flow when it said that it could not communicate with HomeAssistant. Got stuck in an endless loop of trying to find the HomeAssistant instance. In fact after deleting the flow was still trying to communicate with HomeAssistant and failing. I had to delete all the .json files in .node-red and start it again. This is very frustrating :D

KmanOz avatar Jun 19 '18 13:06 KmanOz

Has anyone been able to get this to work with home-assistant? Not hassio but home-assistant? Preferably without ssl. What servername was used? Ip Address and port or FQFN? What steps were taken?

This is frustrating because I left hassio to have more flexibility and because of problems with ring, environment and directory locations being different between the two. I swear docker is supposed to make deployment and configuration simple amd just work between hosts. But why is it that nothing ever works right and because there is some many different install options and configurations, what fixed something for someone usually doesn’t work for another. This makes tracking down and troubleshooting a problem hella frustrating. Like hassio on pi is different than hassio docker on ubuntu, is different than home assistant docker, is different than home-assistant installed in a python environment. FFS this frustrating as hell.

ghost avatar Jun 19 '18 17:06 ghost

blahlt - could you provide a little more detail on how you did this please.

I have worked out that the cause of the error is when you change the httpRoot as per below.

Iif you change http route then it no longer pulls the data form home assistant - anyone got any ideas? I need to change the http root to be able to reverse proxy with lets encrypt

// The following property can be used in place of 'httpAdminRoot' and 'httpNodeRoot', // to apply the same root to both parts. httpRoot: '/node-red',

So for me it should be pulling the data from http://192.168.0.19:1880/node-red/homeassistant/entities

But it is actually trying to pull it from http://192.168.0.19:1880/homeassistant/entities

schford avatar Jun 25 '18 11:06 schford

On line 47 of server-events-state-changed.html - we can see the url it fetches to show entities, as it does not take into account httpRoot variable I have done a quick and dirty hard code - I am sure there must be a better way of fixing this but I am not a coder :-( as you can see below all I have done is manually put in the additional info for my installation.

            $.get('/node-red/homeassistant/entities').done((entities) => {

schford avatar Jun 25 '18 12:06 schford

Fault seems to be here, lines 41 - 48?

https://github.com/AYapejian/node-red-contrib-home-assistant/blob/master/nodes/config-server/config-server.js

Switching the '/homeassistant/entities' to 'api/entities' etc, not a dev so not sure

smadgerano avatar Jul 25 '18 12:07 smadgerano

I could go through and refactor all instances where it doesn't include the httpRoot

I'll also see what changing this.RED.httpAdmin.get('/homeassistant/entities', httpHandlers.getEntities.bind(this)); to this.RED.httpRoot.get('/homeassistant/entities', httpHandlers.getEntities.bind(this));

Does when I get home from work tonight. If I submit a PR, it'll be to Spartan-II's fork. Since the author of this repo no longer seems to respond to PRs

kevinduong avatar Jul 26 '18 14:07 kevinduong

Thanks - could you post here when it is done so we can update to new fork :-)

schford avatar Jul 26 '18 14:07 schford

Hi,

I have the same issue. Is it solved now ?

PITP2 avatar Aug 11 '18 15:08 PITP2

same problem, so no

lordfiSh avatar Aug 17 '18 17:08 lordfiSh

The issue lies with lines 69-71 in what appears to be some addition for multiple data stores. https://github.com/node-red/node-red/blob/28b311b7ed37a8bd4c00268b56fd5972a31bc602/red/api/admin/context.js#L69-L71

I commented out those lines in my own docker image of node red and things are now working for me.

DarienFord avatar Aug 21 '18 03:08 DarienFord

Here's a workaround for those of you who need one for now: https://github.com/AYapejian/node-red-contrib-home-assistant/issues/41

kevinduong avatar Aug 21 '18 18:08 kevinduong