if install node-red on a own cloud server, then i have a ethernet relay board connect cloud server by TCP socket, board is TCP Client. whether this solution can be running stable long time for remote control relay for home automation use. how about ?
So I assume your main use case is to control the relay board from abroad, outside of the local premise where the relay board is physically installed.
In terms of the TCP client connection, you'll need to consider how the board-firmware will cope with outages of the internet connection / availability.
This includes the robustness of the higher level application protocol, used over the tcp connection (you probably want info/monitoring if a relay-command has been received, understood, excecuted and what state the relay is in).
When running node-red on a VPS, you want to consider security. Not only for the VPS and its OS but also for node-red and its services, including that tcp socket in question.
To be honest, I'd rather look into another architecture, depending on the capabilities of the firmware of that relay board and the use case that you have in mind.
If possible I'd recommend using a cloud mqtt connection, i.e. to a cloud service (self hosted or externally provided) instead. Then connect both, relay board and node-red to mqtt-service. Even a simple mqtt client on a phone will do (like mqtt-dash for Android) for that without using node-red at all.
If the relay board is not capable of doing this, use a local node-red instance on a RPi, next to the relay board to bride between tcp locally and mqtt remotely.
Thank you very much.
if use MQTT, i need to change STM32 CPU firmware.Is it easier to integrate with third-party platforms? first time, i think i don't change the MCU code, so make a TCP out node in node-red.if i change the code for MQTT,whether ethernet relay board can easy integrate to node-red and home assistant and openhab .... third platform?
Do you have any other computers (maybe a pi or a NAS or something) running on the same local network as the relay board?
It is not clear to me, if you already have the relay board and if you do, I'd recommend to set everything up locally, without cloud service, for testing.
When looking for an alternative firmware for the STM32 board, it might depend on the make and model. Do you have a link, providing information of that board?
Yes, openhab and home assistant offer integration with mqtt.
If you want to use the STM32-relay board and its existing firmware with TCP, I'd suggest to use a raspberry Pi with node red, and connect it locally. Node-red will then be able to use mqtt to the outside cloud service.
So it can look like this:
site A (openhab/home-assistant) <-> cloud (mqtt-broker (your VPS or service (i.e. cloudmqtt.com)) <-> site B (node-red (on a rPi), STM32-relay(TCP))
If you want an alternative relay board, with native mqtt support, it will depend on the load you are going to connect (assuming AC, 10-15Amps). Most relay boards I know of use WiFi, not ethernet.
So if you have WiFi @ site B, I'd recommend tasmota https://tasmota.github.io/docs/ and one of the relay boards or AC.plugs supported, like these https://shelly.cloud/products/shelly-1pm-smart-home-automation-relay/ (shelly devices also will work without crossflashing tasmota and with mqtt to an exernal broker, outside of their own cloud)
Other. more sturdy things/AC-Plugs/Sockets with mqtt support, I know of are from https://www.netio-products.com/en ...but they are expensive.
no other board in local LAN, only ethernet relay board install at home, when power on , relay board connect with node-red in cloud server by TCP socket. This is my idea, but i don't know whether can work stable for home automation use. because if node-red on the internet cloud server, i can use remote control on phone in anywhere.
If you added a Pi (or similar) locally, running node red, then you can still run node red in the cloud, and communicate between the two using MQTT.
this will add cost. how about my idea? whether not stable?
yes, i already have the board,it can work in LAN,now i want let it for remote control, so need a cloud server.i want to find a stable solution that can mobile phone control relay in anywhere.
this is my 32 channel relay board:
if add a local machine (such as PI) will add cost, i think maybe will rewrite the STM32 code for support MQTT directly.If someone can help me to write it ,I'll be very happy, and I can pay.
That product already comes with Apps for Android and iOS in order to remote control it,
Apparently the manufacturer offers a cloud based bridge service (for free?) for that.
Why don't you want to use what is already provided?
As already said, the challenge to use this thing with node-red in a cloud is to make it secure and and to make the protocol flow, over the underlying TCP connection robust and reliable against sudden dis- and re-connects.
The protocol documents suggest, that the commands are plain text over a TCP socket and the setup is as such as to connect to a fixed IP address.
The best option to move out of that infrastructre provided by the manufacturer, still IMHO, is link to it over LAN from a local node-red-instance (on a rPi) and use this to convert the protocol to mqtt to the outside world (mqtt-broker in cloud).
From there, you have all options to safely and reliably connect via App, openhab, home assistant...
The cost of the rPi is less that a potential developer would charge you for the time to even read and understand the documentaion of that thing, less starting devlepment and testing.
And only if there is a safe way to flash new code on that thing without the risk of turning it into a brick/paperweight.
Thank you very much for your patience. i found there is TCP-out and TCP-in node in "node-red",it's easy to control, whether openhab have this component for TCP socket? if have, i think easy to integrated.
There are dedicated nodes for integrating with openhab (V2.xx), like https://flows.nodered.org/node/node-red-contrib-openhab2 but I never used them.
Openhab V2 offers a full integration with mqtt, with the ability of providing a complete broker, so IMHO for integrating with openhab the way to go is, again using mqtt .
If you want to connect to the cloud service of the relay-provider with another "app", like node-red instead of the provided Phone Apps, I don't know if this will work.
As far as I understood, the protocol documentation of the relay over TCP itself is open.
But the Phone apps use UDP (and maybe a different protocol for messaging/relay-control) to connect to the cloud service and also require authentication (login credentials). Node-Rred does provide UDP/TCP nodes for client and server, but you will have to find the right documentation for the cloud service when "mocking" a Phone App with that.
What does your local installation with openhab look like?
Maybe you can install node-red there as well?
Also openhab offers a remote control via phone (see your App-store), which you could use once the integration with the relay is done.
So one case, selfmade could look like this:
Site A (openhab - NodeRed) <-> cloud mqtt service <-> Site B (rPi/NodeRed <-> TCP-local relay)
Edit: or, still without node.red on site A, when openhab uses mqtt as well:
Site A (openhab/wMQTT) <-> cloud mqtt service <-> Site B (rPi/NodeRed <-> TCP-local relay)
thanks you very much for patient. i want to know, if not use node-red,only use openhab, whether have a TCP in or TCP out component to integrate the ethernet relay board.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.