Hi ,
I am new to HA .I created an endpoint in node-red but cannot access it . I get the following error when I hit the URL:
Cannot GET /hello
Please let me know if I am missing any configs from HA side? Thanks !
Hi ,
I am new to HA .I created an endpoint in node-red but cannot access it . I get the following error when I hit the URL:
Cannot GET /hello
Please let me know if I am missing any configs from HA side? Thanks !
If youâre using the Node-RED add-on.
Note : In order to use the
http_node
you will need to expose Node-RED using a network port in addition to ingress. The HTTP nodes will also be presented under/endpoint/
as shown in the UI. If using thenode-red-dashboard
module this will also be hosted under this path and will use any credentials set here.
From GitHub - hassio-addons/addon-node-red: Node-RED - Home Assistant Community Add-ons
@mbonani Thanks for the response.I am able to access node red fine on HA . I couldnât get to an endpoint that I created in a flow in node-red.
A little more information would be helpful.
How did you create the endpoint? What do its properties look like? How are you trying to get to it?
I followed the exact same procedure @ https://cookbook.nodered.org/http/create-an-http-endpoint
When I test the endpoint form a browser , I get this error .
Does /endpoint/hello
work?
Ok the above mentioned endpoint worked . But my practical use case is unable to get the endpoint .
I have a flow in node red where I wanted to play a mp3 file from my local server (where home assistant and node red both are running) to a chromecast device . When I deploy this flow in node red and try to get to this endpoint @ 192.168.XX.XX:1880/endpoint/alavp ,I get this error:
The file exists in the /tmp directory and permissions are changed to 777 . Are there any steps where I need to grant acced to node-red user. If so, what would be the user thatâs running node red
I donât think the Node-RED add-on has access to /tmp
.
From what Iâve seen, add-ons seem to share specific folders with each other. /share
in particular seems to be a common and shared folder among them. I would recommend putting a file you want both to see in there.
That being said, if you already use this file in service calls in HA, why not just make a service call from Node RED? For instance if you already have the ability to cast this music from HA you could just use the same service call from Node RED in the same way.
Thanks for the response. After placing the file in /share , I was able to play the file from browser @ http://192.168.XX.XX:1880/endpoint/alavp. However the cast node is unable to play . Still getting this error
"Not able to load media:Load failed Not able to load the media."
Ok I think I understand what youâre trying to do. I donât use the cast node at all so Iâm not familiar with it but looking at its documentation it seems to want a URL to the a media file rather then the actual file. Are you trying to give it the endpoint /endpoint/alavp
as the URL to the media file? If so couple questions:
http_node
? If so the cast node is likely getting a 401 unauthenticated error since that endpoint is protected by authenticationAlso is all this an exercise just to see if you can do this? Because it seems like it would be so much easier to just put this file in your /config/www
folder of home assistant. Then you can access it directly via /local/ without trying to pull it in then serve it up in a Node RED flow.
Or alternatively if you already have the Google integration in HA just use the media_player.play_media service. Itâs a lot easier to use from the looks of it.
HI Mike,
Thanks for the response .
Yes I am trying to give the endpoint /endpoint/alavp
as the URL to the media file
Yes I have http_node credentials configured
No ,my node red is not accessible externally
Could you pls explain more on the other option that you mentioned for playing using /config/www ?
My end goal is to use this as a continuation for a flow in node red where my Projector starts ,it has to play a custom video file via chromecast . I can have the custom video file on youtube / local . For the local option, I tried creating an endpoint and trying to get it to chromecast but its failing with above mentioned error .
Take a look at the below URL . Search for âPlay local filesâ . I tried to play my local files using the procedure mentioned here but it fails
Thanks!
Gotcha ok so looks like what youâre trying to should work. Except
If you have credentials configured then that means the endpoint /endpoint/alavp
requires basic authentication. Since the cast node does not ask you to provide authentication details for the URL you gave it I have to assume that it only allows URLS which do not require authentication. So I think you would need to remove authentication from your node RED config by setting the http_node
option as follows:
http_node:
username: ''
password: ''
The alternative I was suggesting is that HA comes with a special folder in the config directory that it auto-exposes. Like I said above, any file you put in /config/www
can be accessed via <HA Base URL>/local/<file name>
. So its effectively a shortcut to the HTTP In node thing, just by putting a file in the www
folder gives you a URL directly to that file.
Thank you , Yes , the authentication was the problem,It works when I remove the credentials .
Solution
<iframe title="Node-RED" src="/api/hassio_ingress/sometingsomething/"> </iframe>
src=
http://homeassistant.local:8123/api/hassio_ingress/<some-id>/endpoint/test
for the [get] on /test.