I tried without the Scan_intervals but it did not fix the issue. I have some uint32 and uint64 too but, changing them did not fix the problem either.
Thank you for answering, I hope there is another way to get this solved?
My only guess is that there is a problem with one of the items and therefore modbus configuration is failing.
I would try with a new configuration, start with one item first and see if that works. Then continue with one item per try, maybe in this way you could find and solve the problem.
I can get modbus over TCP working for a few days to weeks, but then it disappears from HA. It’s still online according to my router, just not getting modbus data.
Restarting things makes no difference.
I can get in fine through Sunny Explorer, and changing the port brings it back again…
- name: "sma"
type: tcp
host: 192.168.11.29
port: 5025
message_wait_milliseconds: 500
sensors:
- name: "SMA Energy Total"
slave: 3
data_type: uint64
address: 30513
scan_interval: 10
unit_of_measurement: "Wh"
state_class: 'total'
device_class: 'energy'
- name: "SMA Energy Today"
slave: 3
data_type: uint64
address: 30517
scan_interval: 10
unit_of_measurement: "Wh"
- name: "SMA_Power_AC"
slave: 3
data_type: int32
address: 30775
scan_interval: 10
Hello,
Are you sure that your port is right?
This is my configuration, and it runs for months now
- name: 'sma'
type: tcp
host: 192.168.1.36 # ip nummer omvormer
port: 502
delay: 5
timeout: 5
sensors:
- name: "MB_sma_aanpasbaarvermogen"
data_type: int32
device_class: 'power'
unit_of_measurement: W
slave: 3
address: 40915
- name: "MB_active_power"
data_type: int32
device_class: 'power'
unit_of_measurement: W
slave: 3
address: 30231
- name: "MB_sma_status"
data_type: int32
slave: 3
address: 30201
- name: "MB_sma_power"
data_type: int32
device_class: 'power'
unit_of_measurement: W
slave: 3
address: 30775
scan_interval: 5
Is there any possibility to get the data of the different strings connected to the inverter?
I asked cause I had trouble with one string some days before without recognizing it. By monitoring the strings I would be able to detect it much earlier that there is an issue.
Which inverter are you using?
If you are using a Tripower X, you could use my integraton.
It’s a Tripower 20000tl-30.
Any chance that your integration is working with this one?
Not sure. You can install the integration on a test basis and see if you get the values via “webconnect” or “speedwire”. If not, delete them again.
Seems to work.
Thanks for the hint!
Did you used “webconnect” or “speedwire”?
I would like to update my list of supported devices.
Speedwire as it seems to be more reliable.
Hi!
Inspired by this post, I adjusted it a bit.
I made a helper in which I can set the max power:
I can show it as a slider in Lovelace:
Linked to that helper, I made an automation which writes the helper-value to the SMA modbus:
alias: Set Max PV Power from Helper
description: ""
trigger:
- platform: state
entity_id:
- input_number.maxpvpower
condition: []
action:
- service: modbus.write_register
data:
address: 40915
slave: 3
value:
- 0
- "{{ states('input_number.maxpvpower') | int }}"
hub: sma_modbus
mode: single
then I made 2 automations which set the helper to 0 or max, depending on the current Tibber energy price:
alias: Price Negative, Max Power 0
description: ""
trigger:
- platform: state
entity_id:
- sensor.electricity_price_address
from: ">0"
to: <0
condition: []
action:
- service: input_number.set_value
target:
entity_id: input_number.maxpvpower
data:
value: 0
mode: single
alias: Price Positive, Max Power 8000
description: ""
trigger:
- platform: state
entity_id:
- sensor.electricity_price_address
from: <0
to: ">0"
condition: []
action:
- service: input_number.set_value
target:
entity_id: input_number.maxpvpower
data:
value: 8000
mode: single
So now I can adjust the max power that my SMA delivers with the slider in Lovelace. (this is not quite useful for my situation, but it works).
But when the energy-price goes negative, the max power goes to 0. Besides that, my heat-pump starts heating the DHW. In the future my batteries will load at the lowest point and my future swimming pool, jacuzzi and sauna will start heating. All up to the max power my connection allows.
Yes. I changed it to bring it back. It worked for a week on 502.
I just stopped using the Webconnect module, shame for all the effort I put in with LAN cables, buying the module, etc… It’s just completely unreliable. I now use a clamp current sensor inside the fusebox.
My modbus to my sma has been working for years. I am on some 2022 ha release. Without any updates on my network, the sma modbus stopped replying, sometime during the last 2-3 weeks. I have tried reactivating the modbus setting in the sma without any luck. Anyone seen a something simular ?
I have problems on the sma power ac sensor, if It stays under 1400 as value it’s fine when it moves over it, stops working and goes to 4000000000 and more any ideas?
I have an old SMA SunnyBoy and when it’s “off” (no PV production) the numbers make no sense.
You might check with something like SunnyExplorer and see what is displayed when off and replace those meaningless values using templates.
I have a SUNNY BOY SMART ENERGY 4.0 and the problem is that when it starts to produce more than 1100 W / 1200 W the SMA AC Grid that has the modbus register 30775 has values that makes no sense. Even when the inverter is producing and the battery discharging the value starts to goes wrong… seems like that register isn’t just the PV production.
Any idea of the register with just the PV act power?
Ok I just understood that value… I have the battery pack managed by the sunny boy that is even an inverter, that register gives me the amount of power that is being released on the internal grid that is not going in the battery, if all the power goes in the battery the value overflows is like a NaN value…
Ok now I need to find a way to build the data of the PV generation on this inverter…
Is there a way starting from DC side?
I found a solution to my issue with modbus suddenly being blocked.
I disabled the modbus in the SMA settings, and then turned off the SMA-unit over night. Started it up next day and then set the modbus to enabled again. TADA, everything works again.
I had the same issue this week after a power outage.
Your solution did the trick, but I also had to restart HA after enabling modbus again.
Thinking this over: After the outage HA was possibly restarted quicker then the inverter communication, and that is why the entities were unavailable. So perhaps a restart of HA alone would have fixed it.