Modbus slave read issue

I am seeing a new issue with my Modbus config for my SolarEdge inverter that was not there before.
I am reading both AC Power Value and Scale Factor in a single read:with this config:

  - name: SolarEdge
    type: tcp
    host: 192.168.1.198
    port: 1502
    sensors:
      - name: SolarEdge_P
        slave: 1
        address: 40083
        data_type: int16
        slave_count: 1
        scan_interval: 5

This always worked fine with a smooth curve for AC Power. But now I see that the AC Power Value and Scale Factor are not in sync, so the Scale Factor has already changed but the Value not yet. With this I see spikes in the curve now…

What has changed so that whenever the Scale Factor changes I get to see this peak?! So, e.g. it should go from (29800, -1) to (29900, -1) to (3000, 0) - so from 2980 to 2990 to 3000 but it actually reads (28900, -1) and (29900, 0) and (3000, 0) which gives a spike since this means 2890 to 29900 to 3000…
So again what has changed in the Modbus config as this was not there before as far as I know.

Thanks, Rene.

You have to read the scale factor together with the related data registers as a single range read because the scale factor can (and will) change between reads, even if they are milliseconds apart.

This has always been the case; I don’t know why you would be seeing it as a new thing. Maybe you just got lucky before. I tried what you are trying years ago before realizing you can’t read them one at a time.

I actually ended up making an integration because there weren’t any that worked with my system (GitHub - WillCodeForCats/solaredge-modbus-multi: Home Assistant integration for SolarEdge inverters with Modbus/TCP. For single or multiple inverters, meters, and batteries.).

Hi, thanks for your reply!

I totally agree about reading them together (otherwise it is pretty clear this could happen indeed). However, as far as I know that is exactly what I am doing here with my config!?
Looking at the SunSpec Modbus specs, both power and power scale factor are sitting next to each other…

So with my config (slave: 1 and slave_count: 1) you get both in 1 read as far as I know. These will be represented in the following entities:

AC Power value: sensor.solaredge_p
AC Power scale factor: sensor.solaredge_p_1

Happy to hear it must be done in a different way!
Thanks, Rene.

The HA modbus integration doesn’t read multiple registers in the same request. Every entry under sensors is a separate request.