MODBUS data from SMA Inverter

Yes, this is the right sensor. This is only available in W.

The helpers - integration - Riemann sum integral sensor gives me wrong values. How can I summarize these two. That would be the easiest way, right?

Take a look at youtube at Simon42, who once made a fairly detailed video.

I see it but the values are false

I’m rather new to home assistant.
I have an SMA STP 8000TL-20 invertor and I would like to connect this to home assistant if possible.
Is there somebody that can help me to get this running step by step.
Don’t know if modbus is the beste way to do this…

Look at this video: (1) SMA-Wechselrichter über Modbus in den ioBroker integrieren | haus-automatisierung.com [4K] - YouTube

  1. Activate Modbus in SMA (like shown in the video)

  2. Edit your config Yaml (like i posted in post 217)

  3. Perhaps your addresses are different, then you have to search in the sma manual (you can find on google: sma modbus register)

Another way would be to install a shelly 3em, if you need only the actual power, voltage and current

You can also try SBFSpot.
If you use Modbus you also need template sensors because as soon as the sun stops shining you get crazy values. The only thing you need is Mqtt, see post from November 2022.

@Crash123Crash123 : Thanks for the feedback. Need Some time for finding the installer Password. Have aksed for the puk code at SMA. Then I will try out what you proposed…

Normally the password is 1111 for installer if it has not been changed.
Why don’t you ask your installer, he is obliged to tell you.
You can test it with Sunny Explorer to see if it works (1111).

Hello, a note on Modbus !!!
As it looks at the moment, there are more and more failures in Modbus configurations since the last update from HA !!!

Hi Bimbo009,

I have SMA STP 5000TL-20 Inverter, and I searching for a MODBUS port list. I find your post this topic, could You send me the document?

Please. You can also use SBFSpot and save yourself a lot of work. If you need anything else just let us know.



Thanks a lot. I didn’t know SBFSpot addon, but looks like iteresting. I made MODBUS configuration in the configuration.yaml few monts ago, and now I want to add DC inputs. The attached document is a great help.

here the complete modbus and template






Is it working again for you? I still got some problems.

regards,
Chris

Which problems ?
Please define exactly. At everything works again.

Hi Bimbo009!

Looks great! :slight_smile: :+1:
Would it be possible that you share the modbus.yaml and template.yaml as code?
I’m about to integrate my SMA inverter and you have some good metrics.
That would save me a lot of manual retyping.

Thx and regards

Webrat

 sensors:
      - name: "PV_Status"
        unique_id: "PV_Status"
        state_class: "measurement"
        data_type: "int32"
        unit_of_measurement: "status"
        slave: 3
        address: 30201
        count: 2
      - name: "PV_Gesamtertrag"
        unique_id: "PV_Gesamtertrag"
        device_class: "energy"
        state_class: "total_increasing"
        data_type: "int32"
        unit_of_measurement: "kWh"
        slave: 3
        address: 30531
        count: 2
      - name: "PV_Leistung"
        unique_id: "PV_Leistung"
        state_class: measurement
        device_class: power
        data_type: "int32"
        unit_of_measurement: "W"
        slave: 3
        address: 30775
        count: 2
      - name: "PV_Tagesertrag"
        unique_id: "PV_Tagesertrag"
        state_class: "total_increasing"
        device_class: "energy"
        data_type: "int64"
        unit_of_measurement: "Wh"
        slave: 3
        address: 30517
        count: 4
      - name: "PV_Frequenz"
        unique_id: "PV_Frequenz"
        state_class: "measurement"
        device_class: "frequency"
        data_type: "uint32"
        unit_of_measurement: "Hz"
        slave: 3 
        address: 30803
        count: 2
        scale: 0.01
        precision: 2
      - name: "Power_L1"
        unique_id: "Powe_L1"
        state_class: "measurement"
        device_class: "power"
        unit_of_measurement: "W"
        slave: 3
        address: 30777
        count: 2
        data_type: "int32"
      - name: "Power_L2"
        unique_id: "Powe_L2"
        state_class: "measurement"
        device_class: "power"
        unit_of_measurement: "W"
        slave: 3
        address: 30779
        count: 2
        data_type: "int32"
      - name: "Power_L3"
        unique_id: "Powe_L3"
        state_class: "measurement"
        device_class: "power"
        unit_of_measurement: "W"
        slave: 3
        address: 30781
        count: 2
        data_type: "int32"
      - name: "AMP_L1"
        unique_id: "AMP_L1"
        state_class: "measurement"
        device_class: "current"
        unit_of_measurement: "A"
        slave: 3
        address: 30797
        count: 2
        scale: 0.001
        precision: 2
        data_type: "int32"
      - name: "AMP_L2"
        unique_id: "AMP_L2"
        state_class: "measurement"
        device_class: "current"
        unit_of_measurement: "A"
        slave: 3
        address: 30799
        count: 2
        data_type: "int32"
        scale: 0.001
        precision: 2
      - name: "AMP_L3"
        unique_id: "AMP_L3"
        state_class: "measurement"
        device_class: "current"
        unit_of_measurement: "A"
        slave: 3
        address: 30801
        count: 2
        data_type: "int32"
        scale: 0.001
        precision: 2
      - name: "Volt_L1"
        unique_id: "Volt_L1"
        state_class: "measurement"
        device_class: "voltage"
        unit_of_measurement: "V"
        slave: 3
        address: 30783
        count: 2
        data_type: "int32"
        scale: 0.01
        precision: 1
      - name: "Volt_L2"
        unique_id: "Volt_L2"
        device_class: "voltage"
        state_class: "measurement"
        unit_of_measurement: "V"
        slave: 3
        address: 30785
        count: 2
        data_type: "int32"
        scale: 0.01
        precision: 1
      - name: "Volt_L3"
        unique_id: "Volt_L3"
        device_class: "voltage"
        state_class: "measurement"
        unit_of_measurement: "V"
        slave: 3
        address: 30787
        count: 2
        data_type: "int32"
        scale: 0.01
        precision: 1
1 Like
  - sensor:
    - name: "PV_Leistung_template"
      unique_id: "PV_Leistung_template"
      device_class: "power"
      state_class: "measurement"
      unit_of_measurement: "W"
      state: >
        {% if states('sensor.PV_Leistung') is not none %}
        {% if states('sensor.PV_Leistung') | int < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.PV_Leistung') | int }}
        {% endif %}
        {% else %}
        {% endif %}
    - name: "pv_status_template"
      unique_id: "pv_status_template"
      state: >
        {% if is_state('sensor.PV_Status', '35') %} Fault
        {% elif is_state('sensor.PV_Status', '303') %} Off
        {% elif is_state('sensor.PV_Status', '455') %} Warning
        {% elif is_state('sensor.PV_Status', '307') %} OK
        {% else %} Unknown Code
        {% endif %}
    - name: "pv_frequenz_template"
      unique_id: "pv_frequenz_template"
      device_class: "frequency"
      state_class: "measurement"
      unit_of_measurement: "Hz"
      state: >
        {% if states('sensor.pv_frequenz') is not none %}
        {% if states('sensor.pv_frequenz') | float(default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.pv_frequenz') | float(default=0) }}
        {% endif %}
        {% endif %}
    - name: "Power_L1_template"
      unique_id: "Power_L1_template"
      device_class: "power"
      state_class: "measurement"
      unit_of_measurement: "W"
      state: > 
        {% if states('sensor.power_l1') is not none %}
        {% if states('sensor.power_l1') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.power_l1') | float(default=0.0) }}
        {% endif %}
        {% else %}
        {% endif %}
    - name: "Power_L2_template"
      unique_id: "Power_L2_template"
      device_class: "power"
      state_class: "measurement"
      unit_of_measurement: "W"
      state: >
        {% if states('sensor.power_l2') is not none %}
        {% if states('sensor.power_l2') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.power_l2') | float(default=0.0) }}
        {% endif %}
        {% else %}
        {% endif %}
    - name: "Power_L3_template"
      unique_id: "Power_L3_template"
      device_class: "power"
      state_class: "measurement"
      unit_of_measurement: "W"
      state: >
        {% if states('sensor.power_l3') is not none %}
        {% if states('sensor.power_l3') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.power_l3') | float(default=0.0) }}
        {% endif %}
        {% else %}
        {% endif %}
    - name: "Volt_L1_template"
      unique_id: "Volt_L1_template"
      device_class: "voltage"
      state_class: "measurement"
      unit_of_measurement: "V"
      state: >
        {% if states('sensor.volt_l1') is not none %}
        {% if states('sensor.volt_l1') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.volt_l1') | float(default=0.0) }}
        {% endif %}
        {% else %}
        {% endif %}
    - name: "Volt_L2_template"
      unique_id: "Volt_L2_template"
      device_class: "voltage"
      state_class: "measurement"
      unit_of_measurement: "V"
      state: >
        {% if states('sensor.volt_l2') is not none %}
        {% if states('sensor.volt_l2') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.volt_l2') | float(default=0.0) }}
        {% endif %}
        {% endif %}
    - name: "Volt_L3_template"
      unique_id: "Volt_L3_template"
      device_class: "voltage"
      state_class: "measurement"
      unit_of_measurement: "V"
      state: >
        {% if states('sensor.volt_l3') is not none %}
        {% if states('sensor.volt_l3') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.volt_l3') | float(default=0.0) }}
        {% endif %}
        {% endif %}
    - name: "AMP_L1_template"
      unique_id: "AMP_L1_template"
      device_class: "current"
      state_class: "measurement"
      unit_of_measurement: "A"
      state: >
        {% if states('sensor.amp_l1') is not none %}
        {% if states('sensor.amp_l1') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.amp_l1') | float(default=0.0) }}
        {% endif %}
        {% endif %}
    - name: "AMP_L2_template"
      unique_id: "AMP_L2_template"
      device_class: "current"
      state_class: "measurement"
      unit_of_measurement: "A"
      state: >
        {% if states('sensor.amp_l2') is not none %}
        {% if states('sensor.amp_l2') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.amp_l2') | float(default=0.0) }}
        {% endif %}
        {% endif %}
    - name: "AMP_L3_template"
      unique_id: "AMP_L3_template"
      device_class: "current"
      state_class: "measurement"
      unit_of_measurement: "A"
      state: >
        {% if states('sensor.amp_l3') is not none %}
        {% if states('sensor.amp_l3') | round(2,default=0) < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.amp_l3') | float(default=0.0) }}
        {% endif %}
        {% endif %}
    - name: "PV_Tagesertrag01_template"
      unique_id: "PV_Tagesertrag01_template"
      state: >
        {% if states('sensor.PV_Tagesertrag') is not none %}
        {% if states('sensor.PV_Tagesertrag') | int < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.PV_Tagesertrag') | int }}
        {% endif %}
        {% endif %}
      unit_of_measurement: "Wh"
      device_class: "energy"
      state_class: "total"
    - name: "PV_Leistung01_template"
      unique_id: "PV_Leistung01_template"
      state: >
        {% if states('sensor.PV_Leistung') is not none %}
        {% if states('sensor.PV_Leistung') | int < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.PV_Leistung') | int }}
        {% endif %}
        {% endif %}
      unit_of_measurement: "W"
      device_class: "power"
    - name: "Gesamtertrag_template"
      unique_id: "Gesamtertrag_template"
      unit_of_measurement: "kWh"
      state: >
        {% if states('sensor.PV_Gesamtertrag') is not none %}
        {% if states('sensor.PV_Gesamtertrag') | int < 0 %}
        {{ 0 }}
        {% else %}
        {{ states('sensor.PV_Gesamtertrag') | int }}
        {% endif %}
        {% endif %}
      device_class: "energy"
      state_class: "total"
1 Like

@ Bimbo009Stefan Boy

I was actually responding to @Crash123Crash123, because he has the same unit as I have (SMA Sunnyboy 3600TL-21 , but I tried it with your config now, tomorrow I will check the result.

@Crash123Crash123, Is yours fully working again? (and if so, can you post the config files :slight_smile: )

thanks !

1 Like

Yes, everything works as usual.
The config is already online, see above, except for the beginning with the IP and whatever else is included, but all sensors and template sensors that I use. I wrote the normal sensors so that I can use the conversion that has been available in ha since the last update so that I no longer need them with the Riemann helper and the correct symbols are also displayed immediately.

1 Like