SMA Sunny Tripower Smart Energy Modbus - Run without Sunny Home Manager 2.0

Hi there,

i am actually planning to install a SMA Sunny Tripower Smart Energy solar inverter.

As i already own a smart meter from our local electricity provider and get the relevant data via mqtt into home assistant. I wondered if it is possible to run it without installing a Sunny Home Manager 2.0 or SMA Energy Meter. Additionally i would like to install a SMA Home Storage battery - SMA Home Storage battery | SMA Solar

My plan is to do all the automation in Home Assistant, like loading the battery. Loading my EV (honda e), unloading the battery in the night etc.

Has anyone an idea if this is possible without installing a Sunny Home Manager 2.0 or SMA Energy Meter?

KR
Robert

I’m pretty sure that’s not possible, as the inverter actually communicates with the SHM or energy meter to know what the inverter should do, charge/discharge battery based on grid consumption or production

2 Likes

It ist possible using modbus. As Home Assistant works on 1 second time slots the charge and discharge regulation produces more overshoots than the 200ms SMA control. Results in somewhat higher regulation “losses”, aka discharge to the grid. Otherweise works fine for half a year now.

So how do you managed it? Any example code or even maybe a guid? :smiley:

In my opinion you need some sort of an energy manager.

I operate an SMA Sunny Tripower with a Smartfox Pro.

Without an energy manager, you have only the value for PV-production and no idea about your actual load of the household.

True but as written in my i inital post, i am already owning a smart meter from our local electricity provider, where i am able to read out all the relevant data.

Hi, do you have any docs or repo on how you achieved control via modbus? I am able to read out my tripower 10.0 SE but I am unable to control it.

How did you end up solving this?
I have created an add-on for this purpose:Home Assistant Add-on: SMA Energy Meter emulator

I have a sunnyboy inverter and read all data with integration + modbus.
I can even set a limit that seems to work.
but I cannot read the current limit that is set. what do i wrong?

my code:

# SMA inverter logging modbus TCP/IP
#
# Revision: v1.01 18/5/2024

modbus:
  - name: SMA1
    type: tcp 
    host: 192.168.0.80 ## or create !secret inverter_ip with ip adress
    port: 502 
    delay: 5
    message_wait_milliseconds: 600
    timeout: 5

    sensors:
      - name: SMA Actueel
        unique_id: sma_actueel
        unit_of_measurement: W
        slave: 3
        address: 30775
        input_type: input
        data_type: int32
        min_value: 0
        device_class: power
        state_class: measurement
      - name: SMA_Grens
        unique_id: SMA_Grens
        unit_of_measurement: W
        slave: 3
        address: 31405
        input_type: input
        data_type: int32
        min_value: 0
        device_class: power
        state_class: measurement
      - name: SMA Vandaag
        unique_id: sma_vandaag
        unit_of_measurement: kWh
        scale: 0.001
        precision: 3
        slave: 3
        address: 30517
        data_type: int64
        min_value: 0
        device_class: energy
        state_class: total_increasing
      - name: SMA Totaal
        unique_id: sma_totaal
        unit_of_measurement: kWh
        slave: 3
        address: 30531
        input_type: input
        scale: 1.0
        precision: 0
        data_type: int32
        min_value: 0
        device_class: energy
        state_class: total_increasing
      - name: SMA AC Spanning
        unique_id: sma_ac_spanning
        unit_of_measurement: V
        slave: 3
        address: 30783
        input_type: input
        scale: 0.01
        precision: 2
        data_type: int32
        min_value: 0
        device_class: voltage
        state_class: measurement
      - name: SMA AC Frequentie
        unique_id: sma_ac_frequentie
        unit_of_measurement: Hz
        slave: 3
        address: 30803
        input_type: input
        scale: 0.01
        precision: 2
        data_type: int32
        min_value: 0
        device_class: frequency
        state_class: measurement
      - name: SMA DC Spanning 1
        unique_id: sma_dc_spanning_1
        unit_of_measurement: V
        slave: 3
        address: 30771
        input_type: input
        scale: 0.01
        precision: 1
        data_type: int32
        min_value: 0
        device_class: voltage
        state_class: measurement
      - name: SMA DC Stroom 1
        unique_id: sma_dc_stroom_1
        unit_of_measurement: A
        slave: 3
        address: 30769
        input_type: input
        scale: 0.001
        precision: 2
        data_type: int32
        min_value: 0
        device_class: current
        state_class: measurement
      - name: SMA DC Power 1
        unique_id: sma_dc_power_1
        unit_of_measurement: W
        slave: 3
        address: 30773
        input_type: input
        data_type: int32
        min_value: 0
        device_class: power
        state_class: measurement
      - name: SMA DC Spanning 2
        unique_id: sma_dc_spanning_2
        unit_of_measurement: V
        slave: 3
        address: 30959
        input_type: input
        scale: 0.01
        precision: 1
        data_type: int32
        min_value: 0
        device_class: voltage
        state_class: measurement
      - name: SMA DC Stroom 2
        unique_id: sma_dc_stroom_2
        unit_of_measurement: A
        slave: 3
        address: 30957
        input_type: input
        scale: 0.001
        precision: 2
        data_type: int32
        min_value: 0
        device_class: current
        state_class: measurement
      - name: SMA DC Power 2
        unique_id: sma_dc_power_2
        unit_of_measurement: W
        slave: 3
        address: 30961
        input_type: input
        data_type: int32
        min_value: 0
        device_class: power
        state_class: measurement
      - name: SMA temperatuur
        unique_id: sma_temperatuur
        unit_of_measurement: °C
        slave: 3
        address: 30953
        input_type: input
        scale: 0.1
        precision: 1
        data_type: int32
        min_value: 0
        device_class: temperature
        state_class: measurement
      - name: SMA isolatieweerstand
        unique_id: sma_isolatieweerstand
        unit_of_measurement: Ohm
        slave: 3
        address: 30225
        input_type: input
        scale: 0.001
        precision: 0
        data_type: int32
        min_value: 0
##        device_class: resistance
        state_class: measurement
      - name: SMA aardlekkage
        unique_id: sma_aardlekkage
        unit_of_measurement: A
        slave: 3
        address: 31247
        input_type: input
        scale: 0.001
        precision: 3
        data_type: int32
        min_value: 0
        device_class: current
        state_class: measurement
      - name: SMA status
        unique_id: sma_status
        slave: 3
        address: 30201
        data_type: int32
      - name: SMA grid
        unique_id: sma_grid
        slave: 3
        address: 30217
        data_type: uint32
      - name: SMA limit percent
        unique_id: sma_limit_percent
        unit_of_measurement: "%"
        slave: 3
        address: 41255
        input_type: holding
        data_type: int16
        min_value: 0
        scale: 0.01
        precision: 0
        state_class: measurement
        ##holding
      - name: SMA_limiet
        unique_id: SMA_limiet
        unit_of_measurement: "%"
        slave: 3
        address: 41255
        input_type: holding
        data_type: int16
        min_value: 0
        scale: 0.01
        precision: 0
        state_class: measurement
sensor:
  - platform: template
    sensors:
      sma_power:      
        friendly_name: 'Power'
        value_template: >-
            {% if states('sensor.sma_actueel')|float < 0 or states('sensor.sma_actueel')|float > 10000 %}
              0
            {% else %}
              {{ states('sensor.sma_actueel') }}
            {% endif %}
        unit_of_measurement: "W"
        icon_template: mdi:flash
        unique_id: sma_power

  - platform: template
    sensors:
      sma_energie_vandaag:      
        friendly_name: 'Energie vandaag'
        value_template: >-
            {% if states('sensor.sma_vandaag')|float < 0 or states('sensor.sma_vandaag')|float > 10000 %}
              0
            {% else %}
              {{ states('sensor.sma_vandaag') }}
            {% endif %}
        unit_of_measurement: "kWh"
        icon_template: mdi:weather-sunny
        unique_id: sma_energie_vandaag

      sma_inverter_status:        
        friendly_name: 'Omvormer Status'
        value_template: >-
            {% if is_state('sensor.sma_status', '307' ) %}
              OK
            {% elif is_state('sensor.sma_status', '303' ) %}
              Uit
            {% elif is_state('sensor.sma_status', '455' ) %}
              Waarschuwing
            {% elif is_state('sensor.sma_status', '35' ) %}
              Fout
            {% endif %}
        icon_template: mdi:state-machine
        unique_id: sma_inverter_status

      sma_grid_contactor:        
        friendly_name: 'Grid relais'
        value_template: >-
            {% if is_state('sensor.sma_grid', '51' ) %}
              Gesloten
            {% else %}
              Open
            {% endif %}
        icon_template: mdi:connection
        unique_id: sma_grid_connector

input_number:
  sma_power_limit_slider:
    name: SMA Power Limiet Slider
    initial: 100
    min: 0
    max: 100
    step: 1
    unit_of_measurement: "%"

### or use:
#automation:
#  alias: Power Limit
#  description: ''
#  trigger:
#    - platform: state
#      entity_id: input_number.sma_power_limit_slider
#  condition: []
#  action:
#    - service: modbus.write_register
#      data:
#        address: 40023
#        slave: 3
#        value: '{{ states("input_number.sma_power_limit_slider") |int *100 }}'
#        hub: SMA1  # unique name
#  mode: single