I just starting using Home Assistant os on a Raspberry Pi. I installed NR on that RPI. I have another RPI that is running a Java display app that communicates with Universal Devices devices and displays the status and has on/off buttons. Now, I have HA devices that I would like to add to the program.
So far after a lot of reading and videos, I have not figured out how to do it. I read that using REST commands are easier with Node-Red. The closest i got reportes "Cannot GET /api/switch/turn_on"
Shouldn't this be a question for the Home Assistant forum?
I don't think so, but I'm not sure. I am trying to get information from Node-red on one computer from a remote computer. I have it working in HA, so it is not a HA question. I think it is http: talking to NR.
Hello @GaryK4,
I am trying to understand your situation...
You have two Raspberry Pies.
One of them runs Home Assistant. I believe Home Assistant includes a Node-red installation, though many of the nodes are specific to HA.
Does this HA installation work correctly?
The other Pi runs a Java program which successfully communicate with Universal Devices devices.
What operating system is on this Pi?
Is Node-red installed on this Pi?
What are Universal Devices devices?
Are the two Pies on the same network?
Now you want to add HA devices to the program.
What devices?
Is the program on one of the Pies? Which one?
What program?
You have read that REST commands are easier with Node-red.
Read where?
What are REST commands?
What are they for?
And you have an error message "Cannot GET /api/switch/turn_on".
What device gives this error?
Is the error in Node-red?
What does your Node-red flow look like?
Hopefully clarifying a bit will improve the chance that someone can help you.
The usual answer to that question is MQTT.
Universal Devices is a computer that mainly works with Insteon devices and others. It does not handle the newer WiFi home automation devices. The second Pi is running Buster Linux. I have web requests to it that are displayed on a panel. Some of the Insteon devices have died and I replaced them with WiFi devices. I went to HA to be able to control then and that works great. Now I want to add them to my existing display panel.
The display Pi does NOT have Node-Red installed on it.
The HA installation is working correctly. Node-Red on it appears to be working as well.
The (2) Pi's are on the same network.
I get the error when trying the following command to Node-Red on the HA Pi.
http://192.168.1.57:1880/api/switch/turn_on?api_password=***{"enity_id:switch.all_lights"}
With Universal Devices, I can send a REST command like the following and get a response.
http://192.168.1.185/rest/nodes/24%2076%205C%201/cmd/DON
The program on the Pi is my own Java GUI program that I developed ~ 5 years ago. I have been very happy with it.
I am trying to do the same with HA or Node-Red in HA.
I don't remember where I read that "REST commands are easier with Node-red." I am Googling and looking all over to solve this.
Am I going down the wrong route with Node-Red? Should I just figure out how to get REST to work with HA and not use the add-on?
Thanks for the explanations.
I have never used the Node-red API, nor have I used Home Assistant.
I try not to use HTTP requests such as your API call or or REST command; I just find HTTP ugly and inelegant.
But I understand that for many people it's a natural choice.
When I want to pass information between machines and act on it, I use MQTT.
I have my own MQTT broker (mosquitto) on a Raspberry Pi, though I could use a free cloud based broker.
Node-red (or Python, C, shell script...) on one Pi can "publish a message".
The message is delivered to Node-red on the other Pi and triggers a flow.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.