Strange. I can readout the data perfectly, but trying to write a register doesn’t do anything.
I can login and check my MODBUS settings in the inverter so you can compare.
Hey guys,
did anyone manage to controle a Sunny Island inverter? Id really like to control the desired SoC (to only fully charge just before evening) and like to start/stop the batterie charge at anytime.
There are alot of modbus registers, but which to switch?
Im also using a SHM2.0 which is supposed to do that more or less - but wont. SMA support lets me wait since months.
Reading through this I see various successes in integrating an SMA inverter into Home Assistant via MODBUS.
I asked SMA in Australia about options for my SB 5000TL-20; WebConnect is out but the RS485 piggy back module apparently is compatible which is where this thread comes in.
Before getting stuck into this a basic question re the infrastructure. The RS485 module gets installed at the inverter. How does this module connect to the LAN? There’s no Wifi and the installation guide doesn’t mention anything other than this
Secondly although I haven’t seen any reference to the SB5000TL-20 in this thread there shouldn’t be a reason this shouldn’t work for me, right?
Thanks for sharing your code. That helped me, however I can’t store the entities in the Energy Dashboard. Does this work for you?
Hallo, ich verwende zusätzlich das SMA Energy Meter Addon und die HACS SMA Speedwire Integration. Habe auch noch HAOS-SBFspot. Wenn sie die Integration oder die Addons verwenden haben sie weniger Arbeit da werden die Sensoren gleich in den Richtigen Werten dargestellt.
Um die werte ins energy Dashboard ein zu binden brauchen die Sensoren die Werte wie state_class, unit of measurement und device_class also die Sensoren dürfen nicht in watt sein.
Bin gerade am System umstellen auf Deye deshalb brauche ich das nicht mehr und werde es auch nicht mehr weiter verfolgen.
Can anyone help me, Trying to get sensors for watts on each string of solar to compare 2 sets of panels over time. My config for the modbus sensors etc is working well, just my “maths” sensors report unavailable.
Im sure it’s something simple but I cant work it out.
template:
- sensor:
- name: "PV_DC_Watts_1"
unit_of_measurement: 'W'
state: >
{% set V = state_attr('sensor.pv_dc_voltage_1', 'V') %}
{% set A = state_attr('sensor.pv_dc_current_1', 'A') %}
{{ A * V }}
- name: "PV_DC_Watts_2"
unit_of_measurement: 'W'
state: >
{% set V = state_attr('sensor.pv_dc_voltage_2', 'V') %}
{% set A = state_attr('sensor.pv_dc_current_2', 'A') %}
{{ A * V }}
modbus:
- type: tcp
host: 192.168.70.82 # SMA SB4000-TL21
port: 502
name: "sma"
close_comm_on_error: true
delay: 5
timeout: 5
sensors:
- name: PV_Total
unique_id: fa400021001
unit_of_measurement: kWh
slave: 3
address: 30531
input_type: input
count: 2
data_type: int32
min_value: 0
device_class: energy
state_class: total_increasing
- name: PV_DC_Voltage_1
unique_id: fa400021002
unit_of_measurement: V
slave: 3
address: 30771
input_type: input
count: 2
scale: 0.01
precision: 2
data_type: int32
min_value: 0
device_class: voltage
state_class: measurement
- name: PV_DC_Current_1
unique_id: fa400021003
unit_of_measurement: A
slave: 3
address: 30769
input_type: input
count: 2
scale: 0.001
precision: 3
data_type: int32
min_value: 0
device_class: current
state_class: measurement
- name: PV_DC_Voltage_2
unique_id: fa400021004
unit_of_measurement: V
slave: 3
address: 30959
input_type: input
count: 2
scale: 0.01
precision: 2
data_type: int32
min_value: 0
device_class: voltage
state_class: measurement
- name: PV_DC_Current_2
unique_id: fa400021005
unit_of_measurement: A
slave: 3
address: 30957
input_type: input
count: 2
scale: 0.001
precision: 3
data_type: int32
min_value: 0
device_class: current
state_class: measurement
- name: PV_Actual
unique_id: fa400021006
unit_of_measurement: W
slave: 3
address: 30775
input_type: input
count: 2
data_type: int32
min_value: 0
device_class: power
state_class: measurement
- name: PV_Today
unique_id: fa400021007
unit_of_measurement: Wh
slave: 3
address: 30517
count: 4
data_type: int64
min_value: 0
device_class: energy
state_class: total_increasing
Sorry can’t really help you with your issue as I’m still in the initial stages of integrating my SB5000TL-20 but have a question.
Are you using an SMA RS485 piggyback module and if so how do you get it into the LAN?
Sorry the note in the code is leftover from a copy/paste from above in this forum. My inverter is the SB3000TL with the web connect module in it (ethernet).
Does your inverter have this also? This manual suggests it should
No unfortunately mine is a SB 5000TL-20 and the WebConnect module is not compatible with this model which is why SMA pointed to the RS485 piggyback module and using this thread I thought I can go the Modbus route …
but my issue is how to interface it with HA given this is a serial interface
hey @tfmeier I have tried to do exactly the same, I’ve acquired the RS485 piggyback module, I’ve then got one of those simple modbus-wifi adapters from Amazon that look solid, [link], kept up to date with firmware and working well with a handy web interface for setup, however they report me almost no communication from the SB, same happens if I try to establish a connection with the settings above. I abandoned the thing for now but would love to go back at it, might we find a way forward…
Thanks for getting back. Have you used the official Modbus integration (Modbus - Home Assistant)? This should let you specify type=serial
to get the data into Home Assistant.
I assume the “handy web interface for setup” is for the modbus wifi adapter, right? How does this work? Does it make RS485 data available as type=tcp
?
Taking a step back, looking at installation guide of the piggyback module I’d expect a 3 wire cable between the piggyback module and the Home Assistant server
A Google search for USB to RS485 shows something like this
So the 3 wires from the piggyback module correspond with this USB to RS485 adapter. Of course this requires the inverter and HA server to be in close proximity although I read that cable length of RS483 can be up to 4000 feet so not an issue.
To further troubleshoot your setup maybe you should reach out here about steps to confirm communication between the inverter and HA. The module is not cheap so you should try to get it working. In theory looking at one of the working configurations here the only thing to change may be the modbus config section. Have you used this software referenced earlier in this post; i.e. Electronics & Automation Engineering T/A Ocean Controls > Software > ModbusView TCP Software
Hi,
I have another issue.
To make a long story short, I would love to change the following register in my SMA inverter:
“Minimale Breite des Ersatzstrombereichs”. This value is in “%”.
The register is according to the SMA table:
40723, Minimale Breite des Ersatzstrombereichs, in %, U32, FIX0, RW
I tried to create a sensor:
- platform: modbus
scan_interval: 30
registers:
- name: Minimale_Breite_des_Ersatzstrombereichs
hub: sma
unit_of_measurement: '%' # see register description in section 5.4.1 of the document
slave: 3 # use the UnitID you found in Sunny Explorer
register: 40723 # use a register from section 5.4.1 of the document
register_type: input # all registers starting with 3 need to have the type input
count: 2
But actually I do not know, what exactly I do above, as I copied and modified the code.
Can anyone help?
Thanks a lot!
Best
Andreas
Has anyone found a way to track the generator operating / run time for a Sunny Island device? I have spent hours going through the register list but I cant find it. Its available on the local web interface, so I figured its stored somewhere… but I cant find it.
For me it would be useful to track fuel re-fills intervals and also service intervals.
Hi Braxx,
long time i look for a solution for exactly the same project. Did you find a code to realize this request?
Regards,
Oberhesse
Hey everyone,
i have a SUNNY TRIPOWER X 12 and successfully integrated it via Modbus TCP. The only problem is that i have three strings and the list of the modbus registers i used only contains the IDs for two strings.
Does anyone have a clue where i can find the register IDs for the third string?
Thanks in advance.
Lexip
Hi Guys.
Firstly, let me apologize for what may seem to most of you, as a very basic question.
I have a Sunny Boy SB7.7TL inverter. Once I got it on my LAN, I tried the standard SMA integration, and while that works OK - it gives me 43 entities, it doesn’t really give me what I’d like to know about the basic health of my installation. Basically, the four things I need to know are:
- Status - is the inverter working OK. (SMA integration does provide this)
- How much power (W or KW) am I generating in real-time, so I can graph it. (Yep, I think this is provided too.)
- How much power (W or KW) is the house absorbing from the grid (No. It doesn’t provide that)
- How much power (W or KW) am I sending to the grid, if any. (Can’t figure that out too.)
I have downloaded the SMA parameter list and register IDs, but Jeez that’s a confusing list with what seems like multiple duplication.
The inverter supports Modbus and I’ve enabled the TCP server, so using the Modbus integration, I’m hoping that I should be able to get the data I need. My problem is what parameters should I be looking for?
Any help would be greatly appreciated. Thanks in advance.
Darrell
Hmmm. I tried this configuration (well, a very small subset to see if I could get it to work), and keep getting the error message that the state is unavailable. (Sample of code from configuration.yaml and screenshot of error message below.) No obvious errors in the logs.
My TCP server shows as enabled on the Sunny Boy, with an Unit ID of 3, but is there a way of verifying it’s running OK? (The Mac doesn’t support telnet, so I can’t telnet to the port to see if it ‘talks’ to me.)
I’m pretty sure I’m missing something so fundamental that I’ll feel like an idiot when it’s pointed out to me.
modbus:
- name: SMA
type: tcp
host: 192.168.86.150
port: 502
sensors:
- name: SMA_Power_AC
state_class: measurement
unit_of_measurement: W
slave: 3
address: 30775
count: 2
data_type: uint32
scan_interval: 60
sensor:
- platform: template
sensors:
mobus_sma_pv_power_kw:
friendly_name: 'Power Output KW'
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') | float / 1000 }}
{% endif %}
unit_of_measurement: "KW"
icon_template: mdi:flash-circle
Hi,
i got a SMA Hybrid Sunny Tripower 10.0 with a 10KW BYD operating since the end of last month. Currently i have the normal SMA Home Assistant Integration.
I would like to load the battery from the grid in the winter (on low tibber power prices), is this possible to control over modbus?
Best,
Tim
Hi,
I would like to say thanks to all who send their yaml codes. With this I have successfully access via modbus to my 12 years old SMA inverter via Sunny Webbox. If one of you have also a Webbox please note some values only available on the Webbox UnitID 2. Here my code in configuration.yaml:
# SMA Modbus ST10000-10 via Sunny Webbox
modbus:
- name: SMA
type: tcp
host: 192.168.xxx.xx
port: 502
sensors:
- name: "SMA_Power_AC"
state_class: measurement
device_class: energy
unit_of_measurement: W
slave: 3
address: 30775
data_type: uint32
scan_interval: 60
- name: "SMA Betriebszeit"
state_class: measurement
unit_of_measurement: h
slave: 3
address: 30541
scan_interval: 60
data_type: uint32
- name: "SMA Betriebszeit Total"
state_class: measurement
unit_of_measurement: h
slave: 3
address: 30543
scan_interval: 60
data_type: uint32
- name: "SMA_PV_Daily_Yield"
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
slave: 2
address: 30517
scan_interval: 60
scale: 0.001
precision: 3
data_type: int64
- name: "SMA_PV_Total_Production"
unit_of_measurement: MWh
device_class: energy
state_class: total_increasing
slave: 2
address: 30513
scan_interval: 60
scale: 0.000001
precision: 3
data_type: int64
- name: "SMA Grid Voltage"
unit_of_measurement: V
slave: 3
address: 30783
scan_interval: 60
scale: 0.01
precision: 2
data_type: int32
- name: "SMA Grid frequency"
unit_of_measurement: Hz
slave: 3
address: 30803
scan_interval: 60
scale: 0.01
precision: 2
data_type: uint32
- name: "SMA_temp"
unit_of_measurement: °C
slave: 3
address: 30953
scan_interval: 60
scale: 0.1
precision: 1
data_type: int32
- name: "SMA_status"
slave: 3
address: 30201
scan_interval: 60
data_type: int32
- name: "SMA_grid"
slave: 3
address: 30217
scan_interval: 60
data_type: uint32
- name: "SMA_Insulation"
slave: 3
address: 30225
scan_interval: 60
scale: 0.001
unit_of_measurement: kOhms
data_type: int32
- name: "SMA_Residual_current"
slave: 3
address: 31247
scan_interval: 60
scale: 1
unit_of_measurement: mA
data_type: int32
- name: "SMA Apparent Power"
unit_of_measurement: VA
slave: 3
address: 30813
scan_interval: 60
scale: 1
precision: 0
data_type: int32
- name: "SMA Reactive Power"
unit_of_measurement: VAr
slave: 3
address: 30805
scan_interval: 60
scale: 1
precision: 0
data_type: int32
- name: "SMA WEBBOX Serial No"
slave: 1
address: 30057
scan_interval: 60
scale: 1
precision: 0
data_type: uint32
- name: "SMA Modbus Version No"
slave: 1
address: 30001
scan_interval: 60
scale: 1
precision: 0
data_type: uint32
sensor:
- platform: template
sensors:
#Summation of generated energy from new and old inverter
pv_solar_erzeugung_summe:
friendly_name: "PV Solar Erzeugung Summe"
unit_of_measurement: 'W'
value_template: "{{ states('sensor.sma_power_ac') |float + states('sensor.inverter_pv_1_current') | float * states('sensor.inverter_pv_1_voltage') | float}}"
modbus_sma_pv_power:
friendly_name: 'SMA 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_power_kw:
friendly_name: 'Power Output kW'
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')|float / 1000 }}
{% endif %}
unit_of_measurement: "kW"
icon_template: mdi:flash-circle
modbus_sma_pv_apparent_power:
friendly_name: 'SMA Apparent Power'
value_template: >-
{% if states('sensor.sma_apparent_power')|float < 0 or states('sensor.sma_apparent_power')|float > 10000 %}
0
{% else %}
{{ states('sensor.sma_apparent_power') }}
{% endif %}
unit_of_measurement: "VA"
icon_template: mdi:flash-circle
modbus_sma_pv_reactive_power:
friendly_name: 'SMA Reactive Power'
value_template: >-
{% if states('sensor.sma_reactive_power')|float < 0 or states('sensor.sma_reactive_power')|float > 10000 %}
0
{% else %}
{{ states('sensor.sma_reactive_power') }}
{% endif %}
unit_of_measurement: "VAr"
icon_template: mdi:flash-circle
modbus_sma_pv_residual:
friendly_name: 'SMA 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:
friendly_name: 'SMA 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:
friendly_name: 'SMA Grid Frequency'
value_template: >-
{% if states('sensor.sma_grid_frequency')|float < 30 or states('sensor.sma_grid_frequency')|float > 100 %}
Not Measured
{% else %}
{{ states('sensor.sma_grid_frequency') }}
{% endif %}
unit_of_measurement: "Hz"
modbus_grid_voltage:
friendly_name: 'SMA Grid Voltage'
value_template: >-
{% if states('sensor.sma_grid_voltage')|float < 180 or states('sensor.sma_grid_voltage')|float > 300 %}
Not Measured
{% else %}
{{ states('sensor.sma_grid_voltage') }}
{% endif %}
unit_of_measurement: "V"
modbus_inverter_status:
friendly_name: 'SMA 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:
friendly_name: 'SMA Grid contactor'
value_template: >-
{% if is_state('sensor.sma_grid', '51' ) %}
Closed
{% else %}
Open
{% endif %}
br,
Stephan