Configuring RUT241 via subscribed mqtt topic

@pwhooftman Hello,

Hello,

Regarding the number of registers - it depends on the length of the device name when determining how many Modbus registers are needed. Each register is 16 bits, and since ASCII (extended) characters are 8 bits, each register can store two characters. For the string “RUT241,” which has 6 characters, 3 registers are used.

When it comes to MQTT, the format is not specified (application does not know what to expect), so you see decimal values like 21077, 21554, and 13361. Each of these decimal values can be split into two bytes, and each byte corresponds to a single ASCII character. Converting 21077 gives “RU,” 21554 gives “T2,” and 13361 gives “41.” Below is a short Python snippet that shows how to convert decimal register values to ASCII:

Here’s a short python example:

registers = [21077, 21554, 13361]  # Example 16-bit registers

# Collect ASCII characters
chars = []
for reg in registers:
    high_byte = (reg >> 8) & 0xFF
    low_byte = reg & 0xFF
    chars.append(chr(high_byte))
    chars.append(chr(low_byte))

decoded_string = ''.join(chars)
print(decoded_string)

Image for reference:

Hope this helps!

Kind Regards,