check my post, I had the same issue, the format of the configuration changed.
This is what I have right now, after your suggestion in your post.
Modbus
modbus:
- type: tcp
host: 192.168.1.22 # SMA TriPower
port: 502
name: “SMA”
close_comm_on_error: true
delay: 5
timeout: 5
sensors:- name: PV_totale_opbrengst
unit_of_measurement: kWh
slave: 3
address: 30531
input_type: input
count: 2 - name: PV_Vermogen
unit_of_measurement: W
slave: 3
address: 30775
input_type: input
count: 2 - name: PV_Dagopbrengst
unit_of_measurement: Wh
slave: 3
address: 30517
count: 4
data_type: int
But still the same error after reboot HA. I see the sensors under Entities, but with errors.
- name: PV_totale_opbrengst
If I do a Portscan for IP of my Inverter, than no ports are scanned. Maybe thats the issue? Or do I need to setup a password and username in the configuration.yaml?
No, there’s no need for a username or password using Modbus. The Modbus server is running on your inverter?
Yes I have. Thats the strange thing of it. It looks that evertything is set well.
The message: This entity (“sensor.smatoday”) does not have a unique ID, therefore its settings cannot be managed from the UI. See the documentation for more detail. Maybe the Unique ID is something for my problem?
Huge thank you Thorsten for your fixed modbus. Worked for me.
@rbusschner I have the same message but getting values.
Nice to hear that it works for you. Can you send a sample of your config.yaml? Did you make other changes as well?
If you do a port scan for the inverter ip, is than port 502 open for that?
Found the options to change the State. It’s unavailable.
Well it work only during daytime, at night time Im getting negative crazy high number. yaml was copy pasted from Thorsten. I am trying now chris_ka setup with node red but having trouble to figure out how to get current solar production out as he has there only total and daily yeild. I’m not coder so I have no idea what to do
edit: gave up on chris_ka node red setup for now, it works for yield but have no idea how to get out current production. Went back to Thorsten setup but need to figure out what to do about the negative numbers during night.
Have you figure this out? I have the same problem and going nuts from it. Thx
Does anyone has the problem with power value from invertor during night? I know some people had but havent seen solution to it. If you sort it out could you please share how?
Hi everyone,
i had from SMA solar all the registers and codes for our inverters.
There are tons of registers that are of no usage and i need someone who can help me to fin the correct registers for all the sensors on the Sma solar inverter UI.
i will share an excel file with anyone who wish to help.
Thank you!
Hello everybody,
I have my modbus sma connection running, but how do I get it to homeassistant energy solar?
Best regards,
Stefan
If you don’t have kWh values, use:
I have a Sunny Boy 5000TL-US-22, S/W Version 02.35.03.R
Here are the settings that are working for me (edited 9/12/21):
modbus:
- name: sma_hub
type: tcp
host: 192.168.1.205
port: 502
sensors:
- name: sma_status
data_type: int32
unit_of_measurement: status
slave: 3
address: 30201
count: 2
- name: sma_power
data_type: int32
device_class: 'power'
unit_of_measurement: W
slave: 3
address: 30775
count: 2
- name: sma_tempurature
data_type: int32
device_class: 'temperature'
unit_of_measurement: °C
slave: 3
address: 30953
count: 2
scale: 0.1
- name: grid_voltage
data_type: int32
device_class: 'voltage'
unit_of_measurement: V
slave: 3
address: 30783
count: 2
scale: 0.01
precision: 2
- name: grid_frequency
data_type: int32
unit_of_measurement: Hz
slave: 3
address: 30803
count: 2
scale: 0.01
precision: 2
# template to get rid of the wild numbers when the inverter is not producing:
template:
- sensor:
- name: "sma_status_template"
state: "{% if is_state('sensor.sma_status', '35') %} Fault
{% elif is_state('sensor.sma_status', '303') %} Off
{% elif is_state('sensor.sma_status', '455') %} Warning
{% elif is_state('sensor.sma_status', '307') %} OK
{% else %} Unknown Code
{% endif %}"
- name: "sma_power_template"
unit_of_measurement: "power"
state: "{% 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 %}"
- name: "sma_tempurature_template"
unit_of_measurement: "tempurature"
state: "{% if states('sensor.sma_tempurature') is not none %}
{% if states('sensor.sma_tempurature') | int < 0 %}
{{ 0 }}
{% else %}
{{ states('sensor.sma_tempurature') | int }}
{% endif %}
{% endif %}"
- name: "grid_voltage_template"
unit_of_measurement: "voltage"
state: "{% if states('sensor.grid_voltage') is not none %}
{% if states('sensor.grid_voltage') | float(default=0) < 0 %}
{{ 0 }}
{% else %}
{{ states('sensor.grid_voltage') | float(default=0) }}
{% endif %}
{% endif %}"
- name: "grid_frequency_template"
unit_of_measurement: "frequency"
state: "{% if states('sensor.grid_frequency') is not none %}
{% if states('sensor.grid_frequency') | float(default=0) < 0 %}
{{ 0 }}
{% else %}
{{ states('sensor.grid_frequency') | float(default=0) }}
{% endif %}
{% endif %}"
Whatever I do, I can’t get a connection to my sunny tripower 15000 with modbus connection. I tried you config as wel, but without succes. Any tips or idea’s?
@rbusscher Are you seeing any errors in the log? I see you have the entities, are they logging any data? PS: I made a couple tweaks to my post above, I found some mistakes.
I have a lot of erros like this:
021-09-11 18:56:05 ERROR (SyncWorker_4) [pymodbus.client.sync] Connection to (192.168.1.22, 502) failed: timed out
2021-09-11 18:56:05 ERROR (SyncWorker_4) [homeassistant.components.modbus.modbus] Pymodbus: sma_hub: Modbus Error: [Connection] Failed to connect[ModbusTcpClient(192.168.1.22:502)]
2021-09-11 18:56:08 ERROR (SyncWorker_1) [pymodbus.client.sync] Connection to (192.168.1.22, 502) failed: timed out
2021-09-11 18:56:11 ERROR (SyncWorker_3) [pymodbus.client.sync] Connection to (192.168.1.22, 502) failed: timed out
2021-09-11 18:56:14 ERROR (SyncWorker_4) [pymodbus.client.sync] Connection to (192.168.1.22, 502) failed: timed out
2021-09-11 18:56:17 ERROR (SyncWorker_2) [pymodbus.client.sync] Connection to (192.168.1.22, 502) failed: timed out
2021-09-11 18:56:20 ERROR (SyncWorker_1) [pymodbus.client.sync] Connection to (192.168.1.22, 502) failed: timed out
2021-09-11 18:56:23 ERROR (SyncWorker_3) [pymodbus.client.sync] Connection to (192.168.1.22, 502) failed: timed out
Definitely some network connectivity problem. Can you ping the inverter IP from your HA computer? Also, are both your HA device and the SMA are the same network subnet?
Yes, I can ping the Inverter from my HA. But when I do a portscan to the IP address of my inverter, port 502 or other ports aren’t recognized. HA and the inverter are in the same subnet.
No knowing what port scan tool you’re using, know that some only scan “common” ports and would not include port 502. Do you have any firewalls or hardware between your two devices? If they are connected to the same switch, then I suspect you have a problem with the network card in the inverter? Does the inverter report data to SMA? Is that working? Is your inverter a newer one or a few years old. Reason I ask is the newer ones have networking built in and have a web interface. If yours is new and you can’t reach it on port 80 then that’s a big sign somethings up with the network interface on the inverter. The older inverters, like mine, have an add-on network interface box and do not include a web interface. Sorry I’m not much help here. Maybe try powering down your system and restart it?