The UnitID on my Sunny Explorer = … ? 16… ?
I’m trying to get this working with node red but keep getting errors.
Hi,
Look again on my screenshot. The UnitID is in the Modbus Section. You are looking outside the Modbus Section
Thanks Chris_ka. But i dont see something else that looks like it. For know i use 3. And its working fine
Hi.
I’m also using 0.118.5 (homeasistant installed on raspberry pi4) and modbus to read sma sunny boy 3.6 tl inverter.
Till 0.118 every thing worked fine, now I can’t see the inverter parameters.
I tried via shifting registers with +1 and also via -1 but nothing changed.
Do you have any hints?
On config.yaml
modbus:
type: tcp
name: sma
host: 192.168.1.51
port: 502
(here I also tried to put timeout: 10 without changes)
On sensor.yaml
-
platform: modbus
scan_interval: 10
registers:- name: smadevtype
hub: sma
slave: 3
register: 30052
count: 2
data_type: uint - name: smagridrelay
hub: sma
slave: 3
register: 30216
count: 2
data_type: uint - name: smatotal
hub: sma
unit_of_measurement: kWh
slave: 3
register: 30530
count: 2
data_type: uint
scale: 1
precision: 2 - name: smatoday
hub: sma
unit_of_measurement: kWh
slave: 3
register: 30536
count: 2
data_type: uint
scale: 1
precision: 2 - name: smapwr
hub: sma
unit_of_measurement: W
slave: 3
register: 30774
count: 2
data_type: int
scale: 1
precision: 2 - name: smapwrL1
hub: sma
unit_of_measurement: W
slave: 3
register: 30776
count: 2
data_type: uint
scale: 0.001
precision: 2 - name: smavoltL1
hub: sma
unit_of_measurement: V
slave: 3
register: 30782
count: 2
data_type: uint
scale: 0.01
precision: 1 - name: smanetHZ
hub: sma
unit_of_measurement: Hz
slave: 3
register: 30802
count: 2
data_type: uint
scale: 0.01
precision: 2 - name: smacurl1
hub: sma
unit_of_measurement: A
slave: 3
register: 30976
count: 2
data_type: int
scale: 0.001
precision: 3
- name: smadevtype
-
platform: template
sensors:
sma_power_l1:
value_template: “{% if states(‘sensor.smapwrl1’)|float > 10000 %}0{% else %}{{ states(‘sensor.smapwrl1’) | float | round(2)}}{% endif %}”
friendly_name: “sma power L1”
unit_of_measurement: ‘kW’
icon_template: mdi:solar-power
sma_stroom_l1:
value_template: “{% if states(‘sensor.smacurl1’)|float > 100 %}0{% else %}{{ states(‘sensor.smacurl1’) | float | round(2)}}{% endif %}”
friendly_name: “sma stroom L1”
unit_of_measurement: ‘A’
icon_template: mdi:solar-power
sma_spanning_l1:
value_template: “{% if states(‘sensor.smavoltl1’)|float > 1000 %}220{% else %}{{ states(‘sensor.smavoltl1’) | float | round(2)}}{% endif %}”
friendly_name: “sma spanning L1”
unit_of_measurement: ‘V’
icon_template: mdi:solar-power
sma_netfrequentie:
value_template: “{% if states(‘sensor.smanethz’)|float > 1000 %}50{% else %}{{ states(‘sensor.smanethz’) | float | round(2)}}{% endif %}”
friendly_name: “sma Netfrequentie”
unit_of_measurement: ‘Hz’
icon_template: mdi:solar-power
sma_power:
value_template: “{% if states(‘sensor.smapwr’)|float < 0 %}0{% else %}{{ states(‘sensor.smapwr’) | float | round(2)}}{% endif %}”
friendly_name: “sma Power”
unit_of_measurement: ‘kW’
icon_template: mdi:solar-power
sma_total:
value_template: “{% if states(‘sensor.smatotal’)|float < 0 %}0{% else %}{{ states(‘sensor.smatotal’) | float | round(3)}}{% endif %}”
friendly_name: “sma Total”
unit_of_measurement: ‘kWh’
icon_template: mdi:solar-power
sma_today:
value_template: “{% if states(‘sensor.smatoday’)|float > 1000 %}0{% else %}{{ states(‘sensor.smatoday’) | float | round(2)}}{% endif %}”
friendly_name: “sma Today”
unit_of_measurement: ‘kWh’
icon_template: mdi:solar-power
sma_device_type:
value_template: “{% if states(‘sensor.smadevtype’)|float == 9347 %}Tripower 8.0{% else %}?{% endif %}”
friendly_name: “sma device type”
icon_template: mdi:solar-power
sma_grid_relay:
value_template: “{% if states(‘sensor.smagridrelay’)|float == 51 %}closed{% elif states(‘sensor.smagridrelay’)|float == 311 %}open{% elif states(‘sensor.smagridrelay’)|float == 9165 %}Disconnesso{% else %}?{% endif %}”
friendly_name: “sma grid relay”
icon_template: mdi:solar-power
Into Logs I also still have that alarm
Logger: pymodbus.client.sync
Source: /usr/local/lib/python3.8/site-packages/pymodbus/client/sync.py:214
First occurred: 7:47:07 (198 occurrences)
Last logged: 7:58:04
- Connection to (192.168.1.51, 502) failed: timed out
- Connection to (192.168.1.22, 502) failed: [Errno 104] Connection reset by peer
Can somebody helping me?
When my SMA is off (by night) i got weird values on my Actual power and the Power Fases.
Attachment you see my printscreen and piece of the code examples.
Sensors
sensor:
- platform: modbus
scan_interval: 10
registers:
- name: SMA_Power_AC
unit_of_measurement: W
slave: 3
register: 30775
count: 2
data_type: int
- name: Grid Voltage Fase 1
unit_of_measurement: V
slave: 3
register: 30783
count: 2
scale: 0.01
precision: 2
data_type: uint
PV Power template
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 > 6000 %}
0
{% else %}
{{ states('sensor.sma_power_ac') }}
{% endif %}
unit_of_measurement: "W"
icon_template: mdi:flash-circle
Fase 1 Template
modbus_grid_voltage_Fase 1:
entity_id: sensor.grid_voltage_Fase_1
friendly_name: 'Grid Voltage l1'
value_template: >-
{% if states('sensor.grid_voltage_Fase_1')|float < 180 or states('sensor.grid_voltage_Fase_1')|float > 300 %}
Not Measured
{% else %}
{{ states('sensor.grid_voltage_Fase_1') }}
{% endif %}
unit_of_measurement: "V"
Anyone having issue with Modbus integration not showing values? For some reason I do not see any values for the last few days. When I login to portal I see data still.
Hi!
did u find a solution?
I have sunntboy 2.5 with modbus integration.
During night my HA frontend brakes because i have tons of errors generated from unreachable sunnyboy.
2021-06-02 23:09:37 ERROR (SyncWorker_58) [homeassistant.components.modbus.modbus] Pymodbus: Modbus Error: [Input/Output] Modbus Error: [Invalid Message] No response received, expected at least 8 bytes (0 received)
2021-06-02 23:09:40 ERROR (SyncWorker_45) [pymodbus.client.sync] Connection to (192.168.1.16, 502) failed: timed out
is it true that the sunnyboy doesn’t work during night and goes into night mode?
I dunno how to solve this issue, i have an error every few seconds.
Thank you for anyone can help
Hello,
I have the same issue.
I get verry sparce data over the modbus from my sma converter.
Connection broke a fiew days avo.
Logger: homeassistant.components.modbus.sensor
Source: components/modbus/sensor.py:110
Integration: Modbus (documentation, issues)
First occurred: 11 juni 2021 15:09:05 (1 occurrences)
Last logged: 11 juni 2021 15:09:05
Sensor configuration is deprecated, will be removed in a future release
Any ideas?.
Hi chris_ka,
I have tried your code for the template sensor, as my inverter shows -2,147,483,648W during night time which screws up my Grafana chart. I had no luck, it does not show up under Sensors in the Dashboard What am I doing wrong?
power_sma_filtered:
friendly_name_template: "Erzeugung aktuell"
unit_of_measurement: W
value_template: >-
{% if (states('sensor.sma_power_ac')|int >= 10000 or states('sensor.sma_power_ac')|int < 0) %}
0
Hi Stefan,
to use a template sensor you need to define it as such by using
- platform: template
section instead of - platform: modbus
Hi Chris,
thank you, stupid mistake on my side - it works now
HI
Untill now I was using Chris’s node red setup and MBolt modbus code. With current version of home assistant modbus changed and I cant see anymore my solar power. I can see power consumption from home manager but nothing from invertor. Would anyone be able to help what needs to be chnaged in the modbus code (yaml) from MBolt to get it working again? I have tried the home assistant official solar integration but getting connection error so that doesnt work.
Hello.
In my case modbus platform configured for sma reading is working well… Exept for some modbus communication dopout. Tipically one, maximum two times per day I need to restart Ha because every sensor from modbus sma gone to value 0 (zero)
After HA restart, everything is ok.
This happened only with new integration. Before Core update everything was ok.
Are there any settings to put, to avoid this behaviour.?
Below mine configuration
On config.yaml
modbus:
- name: sma
type: tcp
host: 192.168.1.51
port: 502
sensors:
# - platform: modbus
# registers:
- name: SMApwrL1
# hub: sma
unit_of_measurement: kW
slave: 3
address: 30777
count: 2
data_type: uint
scale: 0.001
precision: 2
- name: SMApwrL2
# hub: sma
unit_of_measurement: kW
slave: 3
address: 30779
count: 2
data_type: uint
scale: 0.001
precision: 2
- name: SMApwrL3
# hub: sma
unit_of_measurement: kW
slave: 3
address: 30781
count: 2
data_type: uint
scale: 0.001
precision: 2
- name: SMAcurL1
# hub: sma
unit_of_measurement: A
slave: 3
address: 30977
count: 2
data_type: uint
scale: 0.001
precision: 2
- name: SMAcurL2
# hub: sma
unit_of_measurement: A
slave: 3
address: 30979
count: 2
data_type: uint
scale: 0.001
precision: 2
- name: SMAcurL3
# hub: sma
unit_of_measurement: A
slave: 3
address: 30981
count: 2
data_type: uint
scale: 0.001
precision: 2
- name: SMAvoltL1
# hub: sma
unit_of_measurement: V
slave: 3
address: 30783
count: 2
data_type: uint
scale: 0.01
precision: 1
- name: SMAvoltL2
# hub: sma
unit_of_measurement: V
slave: 3
address: 30785
count: 2
data_type: uint
scale: 0.01
precision: 1
- name: SMAvoltL3
# hub: sma
unit_of_measurement: V
slave: 3
address: 30787
count: 2
data_type: uint
scale: 0.01
precision: 1
- name: SMAnetHZ
# hub: sma
unit_of_measurement: Hz
slave: 3
address: 30803
count: 2
data_type: uint
scale: 0.01
precision: 2
- name: SMApwr
# hub: sma
unit_of_measurement: kW
slave: 3
address: 30775
count: 2
data_type: int
scale: 0.001
precision: 2
- name: SMAtotal
# hub: sma
unit_of_measurement: kWh
slave: 3
address: 30529
count: 2
data_type: uint
scale: 0.001
precision: 2
- name: SMAtoday
# hub: sma
unit_of_measurement: kWh
slave: 3
address: 30535
count: 2
data_type: uint
scale: 0.001
precision: 2
- name: SMAdevtype
# hub: sma
slave: 3
address: 30053
count: 2
data_type: int
- name: SMAgridrelay
# hub: sma
slave: 3
address: 30217
count: 2
data_type: int
On sma.yaml into packages
- platform: template
sensors:
sma_power_l1:
value_template: "{% if states('sensor.smapwrl1')|float > 10000 %}0{% else %}{{ states('sensor.smapwrl1') | float | round(2)}}{% endif %}"
friendly_name: "sma power L1"
unit_of_measurement: 'kW'
icon_template: mdi:solar-power
sma_power_l2:
value_template: "{% if states('sensor.smapwrl2')|float > 10000 %}0{% else %}{{ states('sensor.smapwrl2') | float | round(2)}}{% endif %}"
friendly_name: "sma power L2"
unit_of_measurement: 'kW'
icon_template: mdi:solar-power
sma_power_l3:
value_template: "{% if states('sensor.smapwrl3')|float > 10000 %}0{% else %}{{ states('sensor.smapwrl3') | float | round(2)}}{% endif %}"
friendly_name: "sma power L3"
unit_of_measurement: 'kW'
icon_template: mdi:solar-power
sma_corrente_l1:
value_template: "{% if states('sensor.smacurl1')|float > 100 %}0{% else %}{{ states('sensor.smacurl1') | float | round(2)}}{% endif %}"
friendly_name: "sma ampere L1"
unit_of_measurement: 'A'
icon_template: mdi:solar-power
sma_corrente_l2:
value_template: "{% if states('sensor.smacurl2')|float > 100 %}0{% else %}{{ states('sensor.smacurl2') | float | round(2)}}{% endif %}"
friendly_name: "sma ampere L2"
unit_of_measurement: 'A'
icon_template: mdi:solar-power
sma_corrente_l3:
value_template: "{% if states('sensor.smacurl3')|float > 100 %}0{% else %}{{ states('sensor.smacurl3') | float | round(2)}}{% endif %}"
friendly_name: "sma ampere L3"
unit_of_measurement: 'A'
icon_template: mdi:solar-power
sma_tensione_l1:
value_template: "{% if states('sensor.smavoltl1')|float > 1000 %}230{% else %}{{ states('sensor.smavoltl1') | float | round(2)}}{% endif %}"
friendly_name: "sma volt L1"
unit_of_measurement: 'V'
icon_template: mdi:solar-power
sma_tensione_l2:
value_template: "{% if states('sensor.smavoltl2')|float > 1000 %}230{% else %}{{ states('sensor.smavoltl2') | float | round(2)}}{% endif %}"
friendly_name: "sma volt L2"
unit_of_measurement: 'V'
icon_template: mdi:solar-power
sma_tensione_l3:
value_template: "{% if states('sensor.smavoltl3')|float > 1000 %}230{% else %}{{ states('sensor.smavoltl3') | float | round(2)}}{% endif %}"
friendly_name: "sma volt L3"
unit_of_measurement: 'V'
icon_template: mdi:solar-power
sma_frequenza_di_rete:
value_template: "{% if states('sensor.smanethz')|float > 1000 %}50{% else %}{{ states('sensor.smanethz') | float | round(2)}}{% endif %}"
friendly_name: "sma frequenza di rete"
unit_of_measurement: 'Hz'
icon_template: mdi:solar-power
sma_power:
value_template: "{% if states('sensor.smapwr')|float < 0 %}0{% else %}{{ states('sensor.smapwr') | float | round(2)}}{% endif %}"
friendly_name: "sma Power"
unit_of_measurement: 'kW'
icon_template: mdi:solar-power
sma_total:
value_template: "{% if states('sensor.smatotal')|float < 0 %}0{% else %}{{ states('sensor.smatotal') | float | round(3)}}{% endif %}"
friendly_name: "sma Total"
unit_of_measurement: 'kWh'
icon_template: mdi:solar-power
sma_today:
value_template: "{% if states('sensor.smatoday')|float > 1000 %}0{% else %}{{ states('sensor.smatoday') | float | round(2)}}{% endif %}"
friendly_name: "sma Today"
unit_of_measurement: 'kWh'
icon_template: mdi:solar-power
sma_device_type:
value_template: "{% if states('sensor.smadevtype')|float == 9165 %}SunnyBoy3.6{% else %}?{% endif %}"
friendly_name: "sma device type"
icon_template: mdi:solar-power
sma_grid_relay:
value_template: "{% if states('sensor.smagridrelay')|float == 51 %}Chiuso{% elif states('sensor.smagridrelay')|float == 311 %}Aperto{% elif states('sensor.smagridrelay')|float == 16777213 %}Spento{% else %}?{% endif %}"
friendly_name: "sma grid relay"
icon_template: mdi:solar-power
Thank you very much
Daniele
I’m seeing this same issue on my SMA Tripower 8.0. The inverter reboots once in a while during nighttime. Afterwards the modbus intergration doesn’t start anymore unless I restart my HA instance.
I think this will be fixed in 2021.7.4.
See here: Allow pymodbus to reconnect in running system (not startup) by janiversen · Pull Request #53020 · home-assistant/core · GitHub
Hi Daniele,
Ciao.
I have inverter with modbus, original integration and SMA Energy meter addon.
With the last update the integration and the Energy meter addon doesn’t show me the current house consumption (il consumo della casa istantaneo, che esso sia da grid o da pv o aggregato)
Do you have the sensor working? Is there a way through modbus to have that sensor?
Thank you
Grazie mille!
Hi.
Unfortunately I didn’t have that meter.
I bought a shelly PM, and power from grid a da from/to batteries is measured with this.
With modbus integration I’m able to read data from sma., with last update of core, without any interruption.
I fixed my SMA Modbus configuration and it’s working again:
# Modbus
modbus:
- type: tcp
host: 192.168.2.155 # SMA TriPower
port: 502
name: "sma"
close_comm_on_error: true
delay: 5
timeout: 5
sensors:
- 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