Hallo zusammen,
ich bin neu im Home Assistant und brauche mal keine KI-Hilfe ![]()
Ich habe eine neue PV-Anlage erhalten und möchte beide Wechselrichter inklusive der Erzeugungsdaten etc. in HAOS einbinden, da diese von unterschiedlichen Herstellern sind und nicht miteinander kommunizieren.
Wechselrichter 1: Kostal Plenticore 8.5
Wechselrichter 2: Sungrow SG10
Ich habe Modbus bei dem Sungrow aktiviert und versuche nun, die Werte korrekt in HA einzubinden.
Version Home Assistant:
Installationsmethode Home Assistant OS
Core 2026.4.1
Supervisor 2026.03.2
Operating System 17.1
Frontend 20260325.6
Diese Konfigs nutze ich:
configuration.yaml
frontend:
themes: !include_dir_merge_named themes
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
homeassistant:
packages:
modbus_sungrow: !include modbus_sungrow.yaml
template:
sensor:
name: “Gesamt Solar Leistung”
unique_id: gesamt_solar_leistung
unit_of_measurement: “W”
device_class: power
state_class: measurement
state: >
{{ (states(‘sensor.bas_sum_power_of_all_pv_dc_inputs’) | float(0)) +
(states(‘sensor.sungrow_ac_wirkleistung’) | float(0)) }}
name: “Kostal PV Tagesertrag”
unique_id: kostal_pv_tagesertrag
unit_of_measurement: “kWh”
device_class: energy
state_class: total_increasing
state: >
{{ (states(‘sensor.bas_energy_pv1_day’) | float(0)) +
(states(‘sensor.bas_energy_pv2_day’) | float(0)) }}
name: “Gesamt Tagesertrag”
unique_id: gesamt_tagesertrag
unit_of_measurement: “kWh”
device_class: energy
state_class: total
state: >
{{ (states(‘sensor.bas_energy_pv1_day’) | float(0)) +
(states(‘sensor.bas_energy_pv2_day’) | float(0)) +
(states(‘sensor.sungrow_tagesertrag’) | float(0)) }}
name: “Gesamt Gesamtertrag”
unique_id: gesamt_gesamtertrag
unit_of_measurement: “kWh”
device_class: energy
state_class: total_increasing
state: >
{{ (states(‘sensor.bas_energy_yield_total’) | float(0)) +
(states(‘sensor.sungrow_gesamtertrag’) | float(0)) }}
name: “Eigenverbrauch PV Heute”
unique_id: eigenverbrauch_pv_heute
unit_of_measurement: “kWh”
device_class: energy
state_class: total
state: >
{{ ([((states(‘sensor.bas_energy_pv1_day’) | float(0)) +
(states(‘sensor.bas_energy_pv2_day’) | float(0)) +
(states(‘sensor.sungrow_tagesertrag’) | float(0)) -
(states(‘sensor.bas_energy_to_grid_day’) | float(0))), 0] | max) }}
name: “Batterie Anteil Hausversorgung”
unique_id: batterie_anteil_hausversorgung
unit_of_measurement: “%”
state: >
{% set verbrauch = states(‘sensor.bas_home_consumption_day’) | float(0) %}
{% if verbrauch > 0 %}
{{ ((states(‘sensor.bas_home_consumption_from_battery_day’) | float(0)) / verbrauch * 100) | round(1) }}
{% else %}
0
{% endif %}
name: “PV Anteil Hausversorgung”
unique_id: pv_anteil_hausversorgung
unit_of_measurement: “%”
state: >
{% set verbrauch = states(‘sensor.bas_home_consumption_day’) | float(0) %}
{% if verbrauch > 0 %}
{{ (((states(‘sensor.bas_energy_pv1_day’) | float(0)) +
(states(‘sensor.bas_energy_pv2_day’) | float(0)) +
(states(‘sensor.sungrow_tagesertrag’) | float(0)) -
(states(‘sensor.bas_energy_to_grid_day’) | float(0))) / verbrauch * 100) | round(1) }}
{% else %}
0
{% endif %}
modbus_sungrow.yaml
# Release date 2026-03-09
#
# INSTALLATION GUIDE: https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/blob/main/doc/installation.md
#
# MIGRATING GUIDE from version earlier than 2026 of modbus_sungrow.yaml to this version.
# see https://github.com/mkaiser/Sungrow-SHx-Inverter-Modbus-Home-Assistant/blob/main/doc/migration_guide.md
modbus:
- name: SungrowSG10RT
type: tcp
host: !secret sungrow_modbus_host_ip
port: !secret sungrow_modbus_port
scan_interval: 60
sensors:
- name: "Sungrow PV Leistung DC"
unique_id: sungrow_pv_power_dc
slave: !secret sungrow_modbus_device_address
address: 5016
input_type: input
unit_of_measurement: "W"
device_class: power
state_class: measurement
- name: "Sungrow AC Wirkleistung"
unique_id: sungrow_ac_power
slave: !secret sungrow_modbus_device_address
address: 5030
input_type: input
unit_of_measurement: "W"
device_class: power
state_class: measurement
- name: "Sungrow Temperatur"
unique_id: sungrow_temperature
slave: !secret sungrow_modbus_device_address
address: 5007
input_type: input
unit_of_measurement: "°C"
device_class: temperature
state_class: measurement
scale: 0.1
- name: "Sungrow Netzspannung L1"
unique_id: sungrow_grid_voltage_l1
slave: !secret sungrow_modbus_device_address
address: 5018
input_type: input
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
scale: 0.1
- name: "Sungrow Netzfrequenz"
unique_id: sungrow_grid_frequency
slave: !secret sungrow_modbus_device_address
address: 5035
input_type: input
unit_of_measurement: "Hz"
device_class: frequency
state_class: measurement
scale: 0.1
- name: "Sungrow Tagesertrag"
unique_id: sungrow_daily_yield
slave: !secret sungrow_modbus_device_address
address: 5003
input_type: input
unit_of_measurement: "kWh"
device_class: energy
state_class: total
scale: 0.1
- name: "Sungrow Gesamtertrag"
unique_id: sungrow_total_yield
slave: !secret sungrow_modbus_device_address
address: 5004
input_type: input
unit_of_measurement: "kWh"
device_class: energy
state_class: total
scale: 100
Wie ihr jetzt seht, sieht die Statistik einfach falsch aus. Der Tagesertrag liegt bei 78. Dürfte aber nur bei 10,6 kWh liegen.
Die AI meint, ich solle bis morgen warten. Durch den stat_type: change werden die Werte heute Nacht um 00:00 Uhr auf 0 gesetzt. Das wurde mir aber gestern auch schon gesagt.
Die Statistik (Ausreißer) zu verändern, hat auch nichts gebracht. Langsam bin ich mit meinem Latein am Ende und frage mich, was und wo ich etwas falsch konfiguriert habe.
Könnt ihr den Fehler eingrenzen und mir helfen?
type: grid
columns: 2
cards:
- type: statistic
entity: sensor.kostal_pv_tagesertrag
name: ⚡ Kostal heute
stat_type: change
period:
calendar:
period: day
- type: statistic
entity: sensor.sungrow_tagesertrag
name: ⚡ Sungrow heute
stat_type: change
period:
calendar:
period: day
- type: statistic
entity: sensor.gesamt_tagesertrag
name: ☀️ Ertrag gesamt heute
stat_type: change
period:
calendar:
period: day
- type: statistic
entity: sensor.eigenverbrauch_pv_heute
name: 🌱 Eigenverbrauch PV
stat_type: max
period:
calendar:
period: day
- type: statistic
entity: sensor.bas_home_consumption_day
name: 🏠 Verbrauch heute
stat_type: change
period:
calendar:
period: day
- type: statistic
entity: sensor.bas_energy_to_grid_day
name: 🔌 Einspeisung heute
stat_type: change
period:
calendar:
period: day
- type: statistic
entity: sensor.bas_home_consumption_from_grid_day
name: 🛒 Netzbezug heute
stat_type: change
period:
calendar:
period: day
- type: statistic
entity: sensor.bas_battery_discharge_day
name: 🔋 Entladung heute
stat_type: change
period:
calendar:
period: day
- type: statistic
entity: sensor.bas_battery_charge_from_pv_day
name: 🔋 Ladung heute
stat_type: change
period:
calendar:
period: day
- type: statistic
entity: sensor.batterie_anteil_hausversorgung
name: 🔋 Batterie Anteil %
stat_type: max
period:
calendar:
period: day
- type: statistic
entity: sensor.pv_anteil_hausversorgung
name: ☀️ PV Anteil %
stat_type: max
period:
calendar:
period: day
Modbus liefert richtige Werte zurück:
mbpoll -a 1 -r 5003 -c 2 -t 3 192.168.1.40
Protocol configuration: Modbus TCP
Slave configuration…: address = [1]
start reference = 5003, count = 2
Communication…: 192.168.1.40, port 502, t/o 1.00 s, poll rate 1000 ms
Data type…: 16-bit register, input register table
– Polling slave 1… Ctrl-C to stop)
[5003]: 106
[5004]: 780
– Polling slave 1… Ctrl-C to stop)
Ich bedanke mich für eure Hilfe und wünsche allen ein schönes Osterfest.
VG
Bastian
