my Usecase:
i have integrated homeatic IP Data to homeassistant.
I want to setup a Modbus Slave on HA and read the Modbus from Technische Alternative (TA) CMI from Home assistant.
I only read how to read data from HA via modbus. I have done that successfully with the configuration.yaml.
But i don’t find any information to setup a own Modbus Register with HA fill it with data from HA, like Temperature Data from homematic and then read it from other Modbus Masters like TA CMI.
It would be great if some can give me advice, tip, dokumentation how to set it up in HA.
I cannot comment on possible integrations for HA to act as a Modbus server (slave) but this can be done relatively easily from within Node-RED. I have certainly managed to use Node-RED to set up an HTTP server that responds to client requests, and I can ‘pull’ data from Node-RED into HA using a REST call.
I use Node-RED extensively, and this includes Modbus master (client) interaction with my solar inverter as a Modbus slave (server). The node-red-contrib-modbus set of nodes includes a Modbus Server (and Modbus Flex Server) node which hold ‘registers’ that can be written to and read from.
I have only used the included example flow for testing, but I have managed to write to registers and to be able to read back on the same machine. I see no reason why this could not be developed into a flow that responds to HA entity state changes, writes these changes to the NR Modbus server ‘registers’, and provides the ability for an external Modbus client to read (and perhaps also write) these registers.
Note that the Modbus server acts just as a stand-alone server with a defined register capacity. To use this you need to define your own register map, and to set up Modbus writes to actually put data into the registers.
Alternatively, if you are using Modbus over TCP, then this is just a protocol using TCP, so it should be possible to build a Modbus server based on http in and http response nodes.
I’m a bit confused as to who is the Modbus server in this scenario.
Based on my understanding I thought that TA C.M.I. is the modbus server. I can’t get this work however.
I can read/write values from/to CMI if I treat it as slave using EasyModbusTCP Server Simulator.
I’m currently using the JSON API to publish to mqtt - but only have that working for sensor values.
So looking into another way to get function data from the UVR16x2 / CMI.
Hi @davidhom ,
thanks for your solution.
I want to achieve the same, I want to send the current temperature and the target temperature from my room thermostats over modbus_tcp to the C.M.I. But my UVR16x2 + C.M.I isn’t installed yet. I just figure out how it would work.
As I understand the CMI is the Modbus master and HA cannot act as HA Slave?
In your script snippet where is the information to which IP data is sent? Will the modbus.write_register takes the IP from the modbus configuration from configuration.yaml?
Do I need to setup a third-party modbus server (act as slave)? Or what do you mean with
Hi all!
I am also trying to integrate the inputs and outputs of my UVR1611 in HA… At the moment I am using the following integration, which is working fine:
Only drawback is that I recieve the data obly each 10min. So I am looking to a solution, which is completely local, where I can read the values more often. This should be possible over modbus. Now my question is what I would need for this and how to setup everything? Do I need something like this:
Waveshare RS485 to RJ45 Ethernet Converter Module, Industrial Rail-Mount RS485 Serial Server,TCP/IP to Serial Module,300~115200 BPS Baudrate,10 / 100M Auto-Negotiation RJ45 Connector Amazon.de
I did a workaround and with that you can get the data every minute, but quicker than 1 minute is not possible because of the “too much requests” error.
And i can also controll the CMI in Home Assistant without the Modbus integration.
Hi Biscuit
Can that Node-red Modbus integration be used with esphome and modbus rtu? I have a Growatt inverter and I want to emulate an SDM630 smart meter, is this possible with node-red?
As far as I know, yes.
I did experiment with this and successfully managed to create a Modbus server inside Node-RED. I have always used Modbus over TCP. It should all be possible over RTU provided the hardware can be seen by HA/Node-RED, but I have no personal experience with RTU.
The hardest part, for me, was getting my head around what was the server and what was the client.
Good luck.