Hello all
I am trying to read data from a RS485 Modbus output on a wind turbine.
The RS485 is converted to Ethernet via a TCP Server adaptor
Using Radzio I can read the data via rtuovertcp no problem.
Try as I might with every variation I can think of of address, data type, count etc I cannot get HA to display a value - I just get Unavailable all the time.
It must be related to the address I am calling and how I am calling off the data fields within it.
I might add that at the moment I am just trying to read the first field ‘0’ not the whole data - if i can get that working then I am sure I can add the extra fields easily.
I don’t understand what you mean.
In your yaml config, you have specified that the holding register’s data should be interpreted as uint16 – 16-bit unsigned integer.
uint16_t is just the typename for a 16-bit unsigned integer in the C programming language. The _t suffix is there only because that’s the convention for naming types in that language.
However, according to the log message, the failure occurs earlier in the communication process – much earlier that this data type conversion.
If I had to guess, I would say that either Home Assistant cannot reach 192.168.2.90 (although I’d expect to get a different error message even earlier if that was the case), or there is a problem somewhere on the modbus link (between the TCP adapter and the wind turbine). Since you were able to get it working Radzio, my guess would be that the TCP adapter is at fault here. Did you disconnect Radzio before trying to connect with Home Assistant? Perhaps it only supports one connection at a time.
OK.
If uint16 and uint16_t are in fact the same it’s not that then.
I can run more than one instance of Radzio and the data streams to all instances OK. The TCP Server is set to accept up to 4 streams currently (max 16).
I have tried it with Radzio off anyway - no difference.
I think we are getting comms just not either reading the data or interpreting it:
2023-01-18 20:53:14.042 DEBUG (SyncWorker_2) [pymodbus.client.sync] Connection to Modbus server established. Socket (‘192.168.2.45’, 49753)
2023-01-18 20:53:14.042 INFO (SyncWorker_2) [homeassistant.components.modbus.modbus] modbus hub1 communication open
2023-01-18 20:53:29.246 DEBUG (SyncWorker_7) [pymodbus.client.sync] New Transaction state ‘SENDING’
2023-01-18 20:53:32.251 ERROR (SyncWorker_7) [homeassistant.components.modbus.modbus] Pymodbus: hub1: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 2 bytes (0 received)
I have RESOLVED this
It appears that (despite the documentation saying it was not needed for non-direct serial connections) you need to add a Slave address as well.
So a valid entry is for instance: