Modbus RTU read float and/or string values

Good morning,

I am trying to communicate with a Schneider PM3250 energy meter via Modbus RTU.

I have successfully edited my configuration.yaml usind the modbus platform and i can read all the register values from PM3250.

However, i can only read the Unsigned INT16 register values, using the ‘register’ field of the configuration.yaml code.

How can i read the “real” values, i.e float or strings values, similar to read_float(), or read_string() functions of minimalmodbus python library ?.

Thank you in advance.

2 Likes

Hi. It happens the same to me.

I have integrated a PM3255 with ComX210 via TCP / IP modbus.

The result is not real.

Anyone who can help us?

Thank.

  - platform: modbus
    scan_interval: 2
    registers:
      - name: Sensor1
        hub: hub1
        slave: 1
        register: 3028
        #register_type: input #input #holding (default)
        unit_of_measurement: V
        data_type: float #int (default), uint, float, custom, uint
        precision: 2
        
      - name: Sensor2
        hub: hub1
        slave: 1
        register: 3110
        #register_type: input #input #holding (default) 
        
        unit_of_measurement: Hz
        data_type: float
        #structure: ">f" #para data_type: custom
        precision: 2
        

#modbus

modbus:
  name: hub1
  type: tcp #rtuovertcp #tcp
  host: 192.168.1.38
  port: 502

finally I got it!!

You just have to subtract a number in the entry provided by the Schneider manual table, and add the line “count: 2” (32 bits - size 2).

sensor:

  - platform: modbus
    scan_interval: 10
    registers:
     
      - name: tension
        hub: comx210
        slave: 1
        register: 3027 #3028 este es el registro del manual (hay que restar uno y que lea dos (count: 2))
        #register_type: input #input #holding (default)
        unit_of_measurement: V
        count: 2
        #reverse_order: false #false
        #scale: 1
        precision: 1
        data_type: float #int (default), uint, float, custom, uint
        
      - name: frecuencia
        hub: comx210
        slave: 1
        register: 3109 #3010 este es el registro del manual (hay que restar uno y que lea dos (count: 2))
        #register_type: input #input #holding (default) 
        unit_of_measurement: Hz
        count: 2
        #reverse_order: true
        #scale: 1
        precision: 1
        data_type: float
              
     

# modbus

modbus:
  name: comx210
  type: tcp #rtuovertcp #tcp
  host: 192.168.1.38
  port: 502

image

1 Like
      - name: "modbusmodbus0"
        device_address: 2
        address: 0
        unit_of_measurement: volt
        data_type: float32 # int32
        input_type: input
        unique_id: "modbusmodbus0"
        state_class: measurement

wil give you the 2registers converted to 1decimal value

1 Like