I have a number of devices which I have designed and built myself using ESP 8266 Modules. The devices are programmed using the Arduino IDE and each one has a unique Hostname programmed into it. These Hostnames show up when I view the Devices List on my Router.
I would like to be able to use these hostnames in the URL within an HTTP request node so that a URL such as :-
192.168.1.125/gpio/?status/nodeRed
becomes:-
hotwatercylinder/gpio/?status/nodeRed
This second format works perfectly when used in a browser but when used in an HTTP request within nodeRed gives an error:-
This is more of a DNS issue and not a Node-RED issue.
You will likely get a quick answer on the Home Assistant forum. It will depend how they setup the docker image that runs node-red.
An alternative solution would be to use MQTT - that way your devices populate topics in a broker and you need not ever worry about accessing them via HTTP
Isn’t there an automatic local network host routing if you were to use hotwatercylinder.local? My router does this for me. I am not sure if this is universal or just specific to my hardware. It’s worth a try.
This is very much an operating system level question and depends on the OS and how it is set up.
Since you are using Home Assistant, probably better to ask in that forum since I know that most(?) people run HA as a complete OS.
However, a quick way to do this would be to edit the /etc/hosts file to add all of the devices with matching names. However, this can be a pain to manage.
The alternative - if you have access to the local router - is to define a fixed IP for each device and given them a name in the router's DNS (assuming you are using that).