I have a Temperature and Humidity Sensor (R444A01) connected to a LogicMachine (LM5LP2) via MODBUS RTU (RS485 port).
Sensor R444A01 Datasheet (Please bear in mind we are talking about a non-expensive device, poorly documented and with no support, aside from some User Reviews and Vendor Specifications)
This is my (very simple) code:
{
"manufacturer": "Embedded Systems",
"description": "Sensor R444A01",
"mapping": [
{
"name": "Temperature",
"bus_datatype": "float16",
"datatype": "int16",
"type": "register",
"address": 0,
"value_multiplier": 0.1,
"units": "C"
},
{
"name": "Humidity",
"bus_datatype": "float16",
"datatype": "uint16",
"type": "register",
"address": 1,
"value_multiplier": 0.1,
"units": "%"
}
]
}
The issue that I'm facing is that, when mapping these 2 addresses to a KNX address, if I only map 1 address, then I can read it, but if I map both of them, then I can only read "Temperature" (which happens to be the first address in my code). Here's a picture of what I see: KNX address mapping for MODBUS addresses
Apparently, for Humidity value, the LogicMachine reads the lowest possible number an int16
can give (32768), even though the received data should be uint16
datatype as it's Humidity (a percentage value) that we are talking about.
Finally, here is what the Modbus Poll Log says (suggesting that I should be able to read both the Temperature and Humidity values):
[18/05/2021 21:51:32] Modbus Request (COM10)
Address: 1 Function: 3 (0x03) - Read Holding Registers Starting Address: 0 Quantity: 2
Checksum: 50187(OK)
[18/05/2021 21:51:32] Modbus Response (COM10)
Address: 1 Function: 3 (0x03) - Read Holding Registers
Byte Count: 4
Values: 00 f3 01 ea
Register0: 243
Register1: 490
Checksum: 35359(OK)
Don't know if anybody has any idea why this could be happening, but I appreciate any responses.
Thank you very much.
As @Marcos G. pointed out in the question's comments, it turns out that the only way to succesfully ask the Sensor R444A01 about the values of multiple registers is to read these registers on a single query, instead of 1 query per 1 register.
Therefore, I needed to make use of the following keys: "read_count" and "read_offset".
Here is the correct code in order to read both Temperature and Humidity values on a single query: