MODBUS data from SMA Inverter

address 30517 (data_type uint64) is total daily yield in Wh,
address 30513 (also uint64) is total yield in Wh of the SMA from the initial start.

1 Like

Thank you. I have a 485 Data Module and a Waveshare RS485 to Ethernet converter on their way. The installation instructions for the module make it look fairly simple (hopefully).

@Crash123Crash123 I also have a 3600, I added your config, checked modbus was all ok in the SunnyBoy app but HA just chucks out loads in the error log

nvalid config for 'modbus' at configuration.yaml, line 108: SMA_grid: `count` illegal with `data_type: uint32` 'modbus->0->sensors->6', got {'name': 'SMA_grid', 'slave': 3, 'address': 30217, 'scan_interval': 60, 'count': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at configuration.yaml, line 114: SMA_Insulation: `count` illegal with `data_type: DataType.INT16` 'modbus->0->sensors->7', got {'name': 'SMA_Insulation', 'slave': 3, 'address': 30225, 'scan_interval': 120, 'count': 2}
Invalid config for 'modbus' at configuration.yaml, line 53: SMA_Power_AC: `count` illegal with `data_type: uint32` 'modbus->0->sensors->0', got {'name': 'SMA_Power_AC', 'state_class': 'measurement', 'unit_of_measurement': 'W', 'slave': 3, 'address': 30775, 'count': 2, 'data_type': 'uint32', 'scan_interval': 10}
Invalid config for 'modbus' at configuration.yaml, line 61: SMA_PV_Daily_Yield: `count` illegal with `data_type: int64` 'modbus->0->sensors->1', got {'name': 'SMA_PV_Daily_Yield', 'unit_of_measurement': 'kWh', 'state_class': 'measurement', 'slave': 3, 'address': 30517, 'scan_interval': 60, 'scale': 0.001, 'precision': 3, 'count': 4, 'data_type': 'int64'}
Invalid config for 'modbus' at configuration.yaml, line 71: SMA_PV_Total_Production: `count` illegal with `data_type: int64` 'modbus->0->sensors->2', got {'name': 'SMA_PV_Total_Production', 'unit_of_measurement': 'MWh', 'state_class': 'measurement', 'slave': 3, 'address': 30513, 'scan_interval': 3600, 'scale': 1e-06, 'precision': 3, 'count': 4, 'data_type': 'int64'}
Invalid config for 'modbus' at configuration.yaml, line 81: SMA_Grid Voltage: `count` illegal with `data_type: int32` 'modbus->0->sensors->3', got {'name': 'SMA_Grid Voltage', 'unit_of_measurement': 'V', 'slave': 3, 'address': 30783, 'scan_interval': 120, 'count': 2, 'scale': 0.01, 'precision': 2, 'data_type': 'int32'}
Invalid config for 'modbus' at configuration.yaml, line 90: SMA_Grid frequency: `count` illegal with `data_type: uint32` 'modbus->0->sensors->4', got {'name': 'SMA_Grid frequency', 'unit_of_measurement': 'Hz', 'slave': 3, 'address': 30803, 'scan_interval': 120, 'count': 2, 'scale': 0.01, 'precision': 2, 'data_type': 'uint32'}
Invalid config for 'modbus' at configuration.yaml, line 99: SMA_temp: `count` illegal with `data_type: int32` 'modbus->0->sensors->5', got {'name': 'SMA_temp', 'unit_of_measurement': '°C', 'slave': 3, 'address': 30953, 'scan_interval': 60, 'count': 2, 'scale': 0.1, 'precision': 1, 'data_type': 'int32


Unfortunately i do not have a SMA anymore.

1 Like

Same here, I think development changed MODBUS, I read something about not accepting a single device in its config. I think they killed it.
No SMA MODBUS guess a new breaking news. I think it wil affect a lot of people with older SMA inverters, for they can not use the webcon module of those inverters.
I hope they roll back the change or come with a solution.

I’m having a SMA 7000-TL, MODBUS is just working fine with 2024.4 core. I still get my present yield and daily total yield. So I don’t think MODBUS is broken.
(for info: I use MODBUS over tcp)

I can not use the integrated MODBUS option, for my older SMA inverter only understands the MODBUS in configuration.yaml, not the integrations option, that never did work.

modbus:
  - name: SMA
    type: tcp
    host: 192.168.0.xxx
    port: 502
    sensors:
      - name: SMA_Power_AC
        unique_id: SMA_Power_AC
        state_class: measurement
        device_class: "power"
        unit_of_measurement: W
        slave: 3
        address: 30775
        #        count: 2
        data_type: uint32
        scan_interval: 10
      - name: SMA_PV_Daily_Yield
        unique_id: SMA_PV_Daily_Yield
        unit_of_measurement: kWh
        state_class: measurement
        device_class: "energy"
        slave: 3
        address: 30517
        scan_interval: 60
        scale: 0.001
        precision: 3
        #        count: 4
        data_type: int64
      - name: SMA_PV_Total_Production
        unique_id: SMA_PV_Total_Production
        unit_of_measurement: MWh
        device_class: "energy"
        state_class: measurement
        slave: 3
        address: 30513
        scan_interval: 3600
        scale: 0.000001
        precision: 3
        #        count: 4
        data_type: int64
      - name: SMA_Grid_Voltage
        unique_id: SMA_Grid_Voltage
        unit_of_measurement: V
        slave: 3
        address: 30783
        scan_interval: 120
        #        count: 2
        scale: 0.01
        precision: 2
        data_type: int32
      - name: SMA_Grid_frequency
        unique_id: SMA_Grid_frequentie
        state_class: "measurement"
        device_class: "frequency"
        unit_of_measurement: Hz
        slave: 3
        address: 30803
        scan_interval: 120
        #        count: 2
        scale: 0.01
        precision: 2
        data_type: uint32
      - name: SMA_temp
        unique_id: SMA_temp
        state_class: "measurement"
        device_class: "temperature"
        unit_of_measurement: °C
        slave: 3
        address: 30953
        scan_interval: 60
        #        count: 2
        scale: 0.1
        precision: 1
        data_type: int32
      - name: SMA_status
        unique_id: SMA_status
        slave: 3
        address: 30201
        scan_interval: 10
        #        count: 2
        data_type: int32
      - name: SMA_grid
        unique_id: SMA_grid
        slave: 3
        address: 30217
        scan_interval: 60
        #        count: 2
        data_type: uint32
      - name: SMA_Power_L1
        unique_id: SMA_Power_L1
        state_class: measurement
        device_class: power
        unit_of_measurement: W
        slave: 3
        address: 30777
        scan_interval: 120
        #        count: 2
        data_type: int32

This is my config in configurations, it worked very well up to core 2024.4.4 What do I need to change to get this running again.

Like you, I’m only using MODBUS in the configuration.yaml, never tried the integration.
This is my Modbus configuration

- name: sma
  type: tcp
  host: 192.168.178.100
  port: 502
  sensors:
    - name: SMA_Power_AC
      unique_id: SMA_Power_AC
      state_class: measurement
      device_class: "power"
      unit_of_measurement: W
      slave: 3
      address: 30775
      data_type: int32
      min_value: 0
    - name: SMA_Power_Day
      unique_id: SMA_Power_Day
      state_class: total
      device_class: "energy"
      unit_of_measurement: Wh
      slave: 3
      address: 30517
      data_type: uint64
      min_value: 0

Only noticable differences I see: datatypes are different, I don’t use scan_interval, default is then every 30 seconds.
Hope this helps.

I tried without the Scan_intervals but it did not fix the issue. I have some uint32 and uint64 too but, changing them did not fix the problem either.
Thank you for answering, I hope there is another way to get this solved?

My only guess is that there is a problem with one of the items and therefore modbus configuration is failing.

I would try with a new configuration, start with one item first and see if that works. Then continue with one item per try, maybe in this way you could find and solve the problem.

I can get modbus over TCP working for a few days to weeks, but then it disappears from HA. It’s still online according to my router, just not getting modbus data.
Restarting things makes no difference.
I can get in fine through Sunny Explorer, and changing the port brings it back again…

- name: "sma"
  type: tcp
  host: 192.168.11.29
  port: 5025
  message_wait_milliseconds: 500
  sensors:
    - name: "SMA Energy Total"
      slave: 3
      data_type: uint64
      address: 30513
      scan_interval: 10
      unit_of_measurement: "Wh"
      state_class: 'total'
      device_class: 'energy'
    - name: "SMA Energy Today"
      slave: 3
      data_type: uint64
      address: 30517
      scan_interval: 10
      unit_of_measurement: "Wh"
    - name: "SMA_Power_AC"
      slave: 3
      data_type: int32
      address: 30775
      scan_interval: 10

Hello,
Are you sure that your port is right?
This is my configuration, and it runs for months now

 - name: 'sma'
   type: tcp
   host: 192.168.1.36      # ip nummer omvormer
   port: 502
   delay: 5
   timeout: 5
   sensors:
    - name: "MB_sma_aanpasbaarvermogen"
      data_type: int32
      device_class: 'power'
      unit_of_measurement: W
      slave: 3
      address: 40915
    - name: "MB_active_power"
      data_type: int32
      device_class: 'power'
      unit_of_measurement: W
      slave: 3
      address: 30231
    - name: "MB_sma_status"
      data_type: int32
      slave: 3
      address: 30201
    - name: "MB_sma_power"
      data_type: int32
      device_class: 'power'
      unit_of_measurement: W
      slave: 3
      address: 30775
      scan_interval: 5

Is there any possibility to get the data of the different strings connected to the inverter?
I asked cause I had trouble with one string some days before without recognizing it. By monitoring the strings I would be able to detect it much earlier that there is an issue.

Which inverter are you using?

If you are using a Tripower X, you could use my integraton.

It’s a Tripower 20000tl-30.
Any chance that your integration is working with this one?

Not sure. You can install the integration on a test basis and see if you get the values via “webconnect” or “speedwire”. If not, delete them again.

Seems to work.
Thanks for the hint!

Did you used “webconnect” or “speedwire”?

I would like to update my list of supported devices.

Speedwire as it seems to be more reliable.

Hi!

Inspired by this post, I adjusted it a bit.

I made a helper in which I can set the max power:

I can show it as a slider in Lovelace:
image

Linked to that helper, I made an automation which writes the helper-value to the SMA modbus:

alias: Set Max PV Power from Helper
description: ""
trigger:
  - platform: state
    entity_id:
      - input_number.maxpvpower
condition: []
action:
  - service: modbus.write_register
    data:
      address: 40915
      slave: 3
      value:
        - 0
        - "{{ states('input_number.maxpvpower') | int  }}"
      hub: sma_modbus
mode: single

then I made 2 automations which set the helper to 0 or max, depending on the current Tibber energy price:

alias: Price Negative, Max Power 0
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.electricity_price_address
    from: ">0"
    to: <0
condition: []
action:
  - service: input_number.set_value
    target:
      entity_id: input_number.maxpvpower
    data:
      value: 0
mode: single
alias: Price Positive, Max Power 8000
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.electricity_price_address
    from: <0
    to: ">0"
condition: []
action:
  - service: input_number.set_value
    target:
      entity_id: input_number.maxpvpower
    data:
      value: 8000
mode: single

So now I can adjust the max power that my SMA delivers with the slider in Lovelace. (this is not quite useful for my situation, but it works).

But when the energy-price goes negative, the max power goes to 0. Besides that, my heat-pump starts heating the DHW. In the future my batteries will load at the lowest point and my future swimming pool, jacuzzi and sauna will start heating. All up to the max power my connection allows.