Modbus simultaneous query

Hi,
I’m using modbus for my SMA inverter to read PV power, grid supply and absorption to calculate the electricity consumption of the house out of these three values.
At the the moment there is a delay between the reading of the values via modbus which cause that the consumption is heavily fluctuating and often negative, especially when one of the values is not stable over time, eg. Clouds and devices being shut on/off.
The reason is that the calculation is done once a single value is changed.
I’ve modbus reading set up to a refresh rate every 15sec each. But first the PV power value will be refreshed first so that the consumption calculation is done with a new PV power but with 14sec old grid value. One second later it’s again calculated when one of the grid values is being refreshed.

Is there a possibility to read the values at the same time without significant delay?

I had the SMA integration used in the on past, which reads the values from the local http dashboard of the inverter. There are the tree values matching at the same time, which results in valid differences for house consumptions.

Use slave_count

I’ve found slave_count in the modbus documentation, but I don’t know how to use it.
at the moment my configuration is as follows. the addresses are not consecutive.

modbus:
  - type: tcp
    host: 192.168.178.76 # SMA STP10.0 Smart Energy
    port: 502
    name: "sma_modbus"
    close_comm_on_error: true
    delay: 5
    timeout: 5
    sensors:
      - name: SMA_PV_Power     #PV Leistung gesamt
        unit_of_measurement: W
        slave: 3
        address: 30775
        input_type: input
        count: 2
        data_type: int32
        min_value: 0
        device_class: power
        state_class: measurement
        scan_interval: 5
      - name: SMA_Metering_Power_Absorbed     #Zähler Leistung Bezug
        unit_of_measurement: W
        slave: 3
        address: 30865
        input_type: input
        count: 2
        data_type: int32
        min_value: 0
        device_class: power
        state_class: measurement
        scan_interval: 5
      - name: SMA_Metering_Power_Supplied    #Zähler Leistung Einspeisung
        unit_of_measurement: W
        slave: 3
        address: 30867
        input_type: input
        count: 2
        data_type: int32
        min_value: 0
        device_class: power
        state_class: measurement
        scan_interval: 5

slave_count will not work.

Remove delay. And use scan_interval: 10.

It should request all values every 10s with 30ms delay. Or network latency.

With watts it’s a little bit hard.

Or change order of sensors if it help.