Check this out, it should help you.
I already knew about the video on YouTube. Now, thanks to your help with the download link, I have discovered that my inverter does not support register 30577 (grid reference today / Netzbezug heute). Thank you very much. Then I have to build / program a counter somehow. Let’s see if I can do that
Hi, I would have needed your help, I’m trying to get reasonable values for L1, L2 and L3 for amp, watt and volt. The template sensors that I found here do not work and the normal sensors only show the correct values when the system is active.
Hello everyone, I have a question, I recently tried out a Hacs integration (Solaredge Modbus) that also works with Modbus, you couldn’t modify such an integration for SMA.
In itself it should be mainly because of which addresses will be queried.
Hello,
I start by saying that I have a synny boy model SB TL6000-21
I have configured your code, nevertheless I get the following errors:
Logger: homeassistant.helpers.template
Source: helpers/template.py:1286
First occurred: 20:14:00 (6 occurrences)
Last logged: 20:14:08
Template warning: 'int' got invalid input 'unavailable' when rendering template '{% if states('sensor.sma_tempurature') is not none %} {% if states('sensor.sma_tempurature') | int < 0 %} {{ 0 }} {% else %} {{ states('sensor.sma_tempurature') | int }} {% endif %} {% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
Template warning: 'int' got invalid input 'unavailable' when rendering template '{% if states('sensor.sma_power') is not none %} {% if states('sensor.sma_power') | int < 0 %} {{ 0 }} {% else %} {{ states('sensor.sma_power') | int }} {% endif %} {% else %} {{ 'error' }} {% endif %}' but no default was specified. Currently 'int' will return '0', however this template will fail to render in Home Assistant core 2022.1
Logger: homeassistant.components.modbus.modbus
Source: components/modbus/modbus.py:291
Integration: Modbus (documentation, issues)
First occurred: 20:13:56 (2 occurrences)
Last logged: 20:14:08
Pymodbus: sma_hub: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
would you be so kind to suggest me a solution?
finally would you explain to me how to restart the server?
thank you.
Hello, to everyone who is interested, I got the SMA inverter integrated with the SunSpec integration in HA, see link instructions. Date November 2021.
my inverter is also about 10 years old, an STP 8000TL-10.
Same here mine is almost 10 years old, all the protocols are enabled, I can see it in my SMA portal, see it on the SMA website, have the user and installer passwords, yet I can not open it in my webbrowser nor can i get it connected to my HA, it always gives an error no matter what I do or try. Manually with Modbus or via the inbuilt new option of adding a SMA device, nothing works.
Inverter is Sunnyboy 3000 TL-21
Hello, the first thing is wrong, you don’t need a user or password for a Modbus query.
Try it as suggested in the January 3rd post above.
you can copy and paste it into your configuration.yaml so you only have to adapt the host to yours.
Thank you Stefan for thinking with me, I tried that too, plus I added Modbus support in configurations, but till now I can not get it working it does not read a single value.
Hi Thorsten,
thank you very much! It works for me with a Sunny Tripower 15000TL-30
I just have to fiddle out how to implement your template in my config but I think I will get through it.
You made my day
All the best from the Rhineland
Joris
Hi all,
I have a problem that I don’t understand.
Here you can see the sensor daily yield in the middle (PV_dagopbrengst) this is exactly right.
I added this sensor to the sun energy production as you can see in the second picture.
and in the third picture you see a total different outcome.
What am I doing wrong???
Thanks
@joris.mocka How did you get it to work? I have also the same inverter.
Try everything, but nothing works.
Did you enable Modbus as an Installer on the Inverter? You need to have the access and configure it with the Windows SMA Software.
I try to get a screen shot for you during the weekend.
Normally Modbus is disabled unfortunately.
Regards
Joris
I enable Modbus again.
How does your yaml file look?
Hello,
did anyone manage to read if the Inverter is currently in performance derating mode because of the 70% feed-in-limitation in Germany?
I tried it with Register Inverter.WModCfg.WMod --> 30835
which gives me
1079: Wirkleistungsbegrenzung P durch Anlagensteuerung (WCtlCom)
However all the corresponding WCtlCom-Registers are - according to the SMA documentation - Write only registers. And trying to read them gives me wrong values.
I would like to see it the inverter is currently in Derating mode to be able to turn on unnessecary stuff in my home
Hi @rbuscher
here is my config with template, directly copied from my configuration.yaml with a big thank you to @thorsten
modbus:
- type: tcp
host: 192.168.23.78 # SMA TriPower
port: 502
name: "sma"
close_comm_on_error: true
delay: 5
timeout: 5
sensors:
- name: PV_Status
data_type: int32
unit_of_measurement: "status"
slave: 3
address: 30201
count: 2
- name: PV_Gesamtertrag
unit_of_measurement: "kWh"
slave: 3
address: 30531
input_type: input
count: 2
- name: PV_Leistung
unit_of_measurement: "W"
slave: 3
address: 30775
input_type: input
count: 2
- name: PV_Tagesertrag
unit_of_measurement: "Wh"
slave: 3
address: 30517
count: 4
data_type: int
- name: Netzverbrauch
slave: 3
address: 30865
unit_of_measurement: "W"
count: 2
data_type: uint
- name: PV_Temperatur
data_type: int32
device_class: "temperature"
unit_of_measurement: "°C"
slave: 3
address: 30953
count: 2
scale: 0.1
- name: PV_Spannung
data_type: int32
device_class: "voltage"
unit_of_measurement: "V"
slave: 3
address: 30783
count: 2
scale: 0.01
precision: 2
- name: PV_Frequenz
data_type: int32
unit_of_measurement: "Hz"
slave: 3
address: 30803
count: 2
scale: 0.01
precision: 2
template:
- sensor:
- name: "PV Status"
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') %} Okay
{% else %} Unknown Code
{% endif %}"
- name: "PV Leistung"
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 %}
{{ 'error' }}
{% endif %}"
- name: "PV Temperatur"
unit_of_measurement: "°C"
state: "{% if states('sensor.pv_temperatur') is not none %}
{% if states('sensor.pv_temperatur') | int < 0 %}
{{ 0 }}
{% else %}
{{ states('sensor.pv_temperatur') | int }}
{% endif %}
{% endif %}"
- name: "PV Spannung"
unit_of_measurement: "V"
state: "{% if states('sensor.pv_spannung') is not none %}
{% if states('sensor.pv_spannung') | float(default=0) < 0 %}
{{ 0 }}
{% else %}
{{ states('sensor.pv_spannung') | float(default=0) }}
{% endif %}
{% endif %}"
- name: "PV Frequenz"
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 %}"
Copy your configuration.yaml into my yaml file, but unfortunately no improvement. I see the entities, but with a warning
well no such luck for me, all network protocols are enabled in my sunnyboy 3000TL-21, but whatever I try or do, I always get unexpected error or unable to connect as error.
I tried putting the sma modbus code in yaml, tried the SMA integration same nothing happens.
Dead end for me, shame, I guess my sunnyboy is way too old is from 2013 and then they placed the first version of the webconnect, sure my internet site from sma works, sure my sunny explorer does too, but i can not open a webpage in a browser directly to the sunnyboy, and i think somewhere in that is the problem, a webconnect from the first batch not manageable
enough. short version it sucks big time that I am unable to integrate it in HA.
after upgrading to core-2022.4.0 i’ve started to get this error on Modbus
and all the sensor related are in status “unavailable” does anyone know how to solve the problem?
from the updating it started to log an incorrect int,float format in the configuration yaml that i’ve solved defining int32 as data_type
yes, you have to replace int or uint with int32 if you receive 4 byte else int64 for 8 bytes.
I solved with this code:
modbus:
name: sma
type: tcp
host: 192.168....
port: 502
sensors:
- name: SMA Power AC
unit_of_measurement: W
slave: 3
address: 30775
count: 2
data_type: uint32
- name: SMA Daily Yield
unit_of_measurement: Wh
slave: 3
address: 30517
count: 4
data_type: int64
- name: SMA Total
unit_of_measurement: MWh
slave: 3
address: 30513
count: 4
data_type: int64
- name: SMA Volt
unit_of_measurement: V
slave: 3
address: 30783
count: 2
data_type: int32
- name: SMA Power L1 AC
unit_of_measurement: W
slave: 3
address: 30777
count: 2
data_type: uint32
- name: SMA Power L2 AC
unit_of_measurement: W
slave: 3
address: 30779
count: 2
data_type: uint32
- name: SMA Power L3 AC
unit_of_measurement: W
slave: 3
address: 30781
count: 2
data_type: uint32