SMA Solar WebConnect

thanks for all your help, but still no luck.
ik keep getting a static value when i try 30517
image

i checked the HTML list of the modbus specs for my SMA, and in the sunspecs register there is no daily yield. (see html on my wetransfer upload: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free).

so i think for now i’ll have to live with it :slight_smile:
but realy thank you for your effort and help.

Thank you. This was very helpful for me because the SMA Solar component doesn´t seems to work for me.

Everything looked fine until after sunset when some of the values i supposed to be 0. At that time Home Assisitant shows the value -2147483648 or 42949672.95. Any ideas how to fix this? I´ve understand that this isn´t just a random numbers. I have copied your sensor config.

It’s normal because the inverter cpu is not working.You can only use template sensor in HA and filter the results

1 Like

Ok, I don´t really understand how to use the template to filter my results. I did try just to copy/paste your template without really understanding what it´s supposed to do. Should your template filter this?

  - platform: template
    sensors:
      modbus_sma_pv_power:
        entity_id: sensor.sma_power_ac
        friendly_name: 'Power Output'
        value_template: >-
            {% if states('sensor.sma_power_ac')|float < 0 or states('sensor.sma_power_ac')|float > 10000 %}
              0
            {% else %}
              {{ states('sensor.sma_power_ac') }}
            {% endif %}
        unit_of_measurement: "W"
        icon_template: mdi:flash-circle
      modbus_sma_pv_apparent_power:
        entity_id: sensor.apparent_power
        friendly_name: 'Apparent Power'
        value_template: >-
            {% if states('sensor.apparent_power')|float < 0 or states('sensor.apparent_power')|float > 10000 %}
              0
            {% else %}
              {{ states('sensor.apparent_power') }}
            {% endif %}
        unit_of_measurement: "VA"
        icon_template: mdi:flash-circle
      modbus_sma_pv_reactive_power:
        entity_id: sensor.reactive_power
        friendly_name: 'Reactive Power'
        value_template: >-
            {% if states('sensor.reactive_power')|float < 0 or states('sensor.reactive_power')|float > 10000 %}
              0
            {% else %}
              {{ states('sensor.reactive_power') }}
            {% endif %}
        unit_of_measurement: "VAr"
        icon_template: mdi:flash-circle
      modbus_sma_pv_residual:
        entity_id: sensor.sma_residual_current
        friendly_name: 'Residual Current'
        value_template: >-
            {% if states('sensor.sma_residual_current')|float < 0 or states('sensor.sma_residual_current')|float > 10000 %}
              0
            {% else %}
              {{ states('sensor.sma_residual_current') }}
            {% endif %}
        unit_of_measurement: "mA"
        icon_template: mdi:flash-circle
      modbus_sma_temperature:
        entity_id: sensor.sma_temp
        friendly_name: 'Inverter Temp'
        value_template: >-
            {% if states('sensor.sma_temp')|float < 0 or states('sensor.sma_temp')|float > 100 %}
              0
            {% else %}
              {{ states('sensor.sma_temp') }}
            {% endif %}
        unit_of_measurement: "°C"
      modbus_grid_frequency:
        entity_id: sensor.grid_frequency
        friendly_name: 'Grid Frequency'
        value_template: >-
            {% if states('sensor.grid_frequency')|float < 30 or states('sensor.grid_frequency')|float > 100 %}
              Not Measured
            {% else %}
              {{ states('sensor.grid_frequency') }}
            {% endif %}
        unit_of_measurement: "Hz"
      modbus_grid_voltage:
        entity_id: sensor.grid_voltage
        friendly_name: 'Grid Voltage'
        value_template: >-
            {% if states('sensor.grid_voltage')|float < 180 or states('sensor.grid_voltage')|float > 300 %}
              Not Measured
            {% else %}
              {{ states('sensor.grid_voltage') }}
            {% endif %}
        unit_of_measurement: "V"
      modbus_inverter_status:
        entity_id: sensor.sma_status
        friendly_name: 'Inverter Status'
        value_template: >-
            {% if is_state('sensor.sma_status', '307' ) %}
              OK
            {% elif is_state('sensor.sma_status', '303' ) %}
              Off
            {% elif is_state('sensor.sma_status', '455' ) %}
              Warning
            {% elif is_state('sensor.sma_status', '35' ) %}
              Fault
            {% endif %}
      modbus_grid_contactor:
        entity_id: sensor.sma_grid
        friendly_name: 'Grid contactor'
        value_template: >-
            {% if is_state('sensor.sma_grid', '51' ) %}
              Closed
            {% else %}
              Open
            {% endif %} 

Yes you have to use the new template sensors on lovelace eg. sensor.modbus_sma_pv_power instead of the sensor.sma_power_ac…

Alternative option is to use https://github.com/SBFspot/SBFspot
My setup available here Integration with SMA Solar STP 10000TL-20 via SBFspot

@Tom_Rubbens did you ever solve the problem with the really long number for the daily output kWh reading? im having the same issue

No, still not solved. If you ever find a solution let let know😉

Thanks for all the info in this thread :slight_smile:

I have an older SunnyBoy and the webconnect module but no HTTP access. Just enabled the modbus and can now see the values.

I also got mine working today, I have a Sunny Boy 4.0. I have the same problem, PV Daily Yield displays a fixed value. Have you been able to fix it?
I also have managed to display the DC power values for each string of panels (I have two). After looking into the modbuslist document I created the following sensors:

  • name: DC Power Input A
    unit_of_measurement: W
    slave: 3
    register: 30961
    scale: 1
    count: 2
    data_type: int
  • name: DC Power Input B
    unit_of_measurement: W
    slave: 3
    register: 30773
    scale: 1
    count: 2
    data_type: int
    I’m really happy with that, as I wanted a way to be able to quickly check what the two strings are producing.
    image

I’m also from Belgium. Have got a sunny boy 1.5
Dont have any expirience with modbus ore python.
Can i get it zorking in YAML ore do i need the python stuf?
Thanks in advance

I’ve got this working in HA. I’m also from Belgium and i’ve got a sunny boy 1.5

I am using the standard SMA integration from here https://www.home-assistant.io/integrations/sma. For some reason I do not get all values populated. Am I missing something or make changes other place where the documentation does not talk about?

your integration will be ok, but are you getting all the readings from the SMA?

When I login in the SMA webconnect portal and I do see daily_yield values and few others. Some I could not find when I login as a user.

I logged in as installer and put the tcp server “on”. After doing so i could use them all. Try to get that code from the company that installed yours or ask them to do it for you

Updated the TCP and tried with user and installer accounts and I still do not see these values. I will keep researching and see if I am missing something from my end.

I tried using the modbus option and i do get daily yield but that is a very long number as others have mentioned. Hopefully there is a fix for that and my setup for SMA is complete.

I use this and never had any issue. Hope this helps for you. keep me posted if it did

modbus:

  • type: tcp

    host: IP from the inverter

    port: 502

sensor:

  • platform: modbus

    scan_interval: 60 #time in seconds for getting values

    registers:

    • name: SMA_Power_AC

      unit_of_measurement: W

      slave: 3

      register: 30775

      count: 2

      data_type: int

    • name: PV Daily Yield

      unit_of_measurement: kWh

      slave: 3

      register: 30517

      scale: 0.001

      precision: 3

      count: 4

      data_type: uint

    • name: PV Total Production

      unit_of_measurement: MWh

      slave: 3

      register: 30513

      scale: 0.000001

      precision: 3

      count: 4

    • name: Grid Voltage

      unit_of_measurement: V

      slave: 3

      register: 30783

      count: 2

      scale: 0.01

      precision: 2

      data_type: uint

    • name: Grid frequency

      unit_of_measurement: Hz

      slave: 3

      register: 30803

      count: 2

      scale: 0.01

      precision: 2

      data_type: uint

    • name: SMA_temp

      unit_of_measurement: °C

      slave: 3

      register: 30953

      count: 2

      scale: 0.1

      precision: 1

      data_type: int

    • name: SMA_status

      slave: 3

      register: 30201

      count: 2

    • name: SMA_grid

      slave: 3

      register: 30217

      count: 2

    • name: Insulation

      slave: 3

      register: 30225

      count: 2

      scale: 0.001

      unit_of_measurement: kOhms

    • name: SMA_Residual_current

      slave: 3

      register: 31247

      count: 2

      scale: 1

      unit_of_measurement: mA

    • name: Apparent Power

      unit_of_measurement: VA

      slave: 3

      register: 30813

      scale: 1

      precision: 0

      count: 2

      data_type: int

    • name: Reactive Power

      unit_of_measurement: VAr

      slave: 3

      register: 30805

      scale: 1

      precision: 0

      count: 2

      data_type: int

  • platform: template

    sensors:

    modbus_sma_pv_power:

    entity_id: sensor.sma_power_ac
    
    friendly_name: 'Power Output'
    
    value_template: >-
    
        {% if states('sensor.sma_power_ac')|float < 0 or states('sensor.sma_power_ac')|float > 10000 %}
    
          0
    
        {% else %}
    
          {{ states('sensor.sma_power_ac') }}
    
        {% endif %}
    
    unit_of_measurement: "W"
    
    icon_template: mdi:flash-circle
    

    modbus_sma_pv_apparent_power:

    entity_id: sensor.apparent_power
    
    friendly_name: 'Apparent Power'
    
    value_template: >-
    
        {% if states('sensor.apparent_power')|float < 0 or states('sensor.apparent_power')|float > 10000 %}
    
          0
    
        {% else %}
    
          {{ states('sensor.apparent_power') }}
    
        {% endif %}
    
    unit_of_measurement: "VA"
    
    icon_template: mdi:flash-circle
    

    modbus_sma_pv_reactive_power:

    entity_id: sensor.reactive_power
    
    friendly_name: 'Reactive Power'
    
    value_template: >-
    
        {% if states('sensor.reactive_power')|float < 0 or states('sensor.reactive_power')|float > 10000 %}
    
          0
    
        {% else %}
    
          {{ states('sensor.reactive_power') }}
    
        {% endif %}
    
    unit_of_measurement: "VAr"
    
    icon_template: mdi:flash-circle
    

    modbus_sma_pv_residual:

    entity_id: sensor.sma_residual_current
    
    friendly_name: 'Residual Current'
    
    value_template: >-
    
        {% if states('sensor.sma_residual_current')|float < 0 or states('sensor.sma_residual_current')|float > 10000 %}
    
          0
    
        {% else %}
    
          {{ states('sensor.sma_residual_current') }}
    
        {% endif %}
    
    unit_of_measurement: "mA"
    
    icon_template: mdi:flash-circle
    

    modbus_sma_temperature:

    entity_id: sensor.sma_temp
    
    friendly_name: 'Inverter Temp'
    
    value_template: >-
    
        {% if states('sensor.sma_temp')|float < 0 or states('sensor.sma_temp')|float > 100 %}
    
          0
    
        {% else %}
    
          {{ states('sensor.sma_temp') }}
    
        {% endif %}
    
    unit_of_measurement: "°C"
    

    modbus_grid_frequency:

    entity_id: sensor.grid_frequency
    
    friendly_name: 'Grid Frequency'
    
    value_template: >-
    
        {% if states('sensor.grid_frequency')|float < 30 or states('sensor.grid_frequency')|float > 100 %}
    
          Not Measured
    
        {% else %}
    
          {{ states('sensor.grid_frequency') }}
    
        {% endif %}
    
    unit_of_measurement: "Hz"
    

    modbus_grid_voltage:

    entity_id: sensor.grid_voltage
    
    friendly_name: 'Grid Voltage'
    
    value_template: >-
    
        {% if states('sensor.grid_voltage')|float < 180 or states('sensor.grid_voltage')|float > 300 %}
    
          Not Measured
    
        {% else %}
    
          {{ states('sensor.grid_voltage') }}
    
        {% endif %}
    
    unit_of_measurement: "V"
    

    modbus_inverter_status:

    entity_id: sensor.sma_status
    
    friendly_name: 'Inverter Status'
    
    value_template: >-
    
        {% if is_state('sensor.sma_status', '307' ) %}
    
          OK
    
        {% elif is_state('sensor.sma_status', '303' ) %}
    
          Off
    
        {% elif is_state('sensor.sma_status', '455' ) %}
    
          Warning
    
        {% elif is_state('sensor.sma_status', '35' ) %}
    
          Fault
    
        {% endif %}
    

    modbus_grid_contactor:

    entity_id: sensor.sma_grid
    
    friendly_name: 'Grid contactor'
    
    value_template: >-
    
        {% if is_state('sensor.sma_grid', '51' ) %}
    
          Closed
    
        {% else %}
    
          Open
    
        {% endif %}

Yes. I am using the same one. But for Daily Yield I get a very large number as others above have mentioned.

I have been looking into this more and the register 30517 is not a valid value for the version in US and that could explain why this random value. I looked into the sunny web portal and seems like it is calculating based on the 5 minute intervals it gathers data from the TotWh (30513) register and displaying in the UI. I am not sure how I go about adding the date parameter to this sensor and do the calculation to make it happen. This way we can calculate Today, Yesterday and daily generation from SMA.