Modbus configuration broken after update to 2024.4.1

Good day,

My HA was working perfectly fine and using all my modbus sensors daily. I then updated to 2024.4.1 and then all my modbus sensors stopped working.

If I check the debug menu, I get this:

Here is my modbus.yaml file (I haven not edited this in months):

# cat modbus.yaml
# configuration entry for a TCP connection
# com.victronenergy.grid    slave: 30
# com.victronenergy.system  slave: 100
# com.victronenergy.battery slave: 225

# system :
- name: victron
  retry_on_empty: true
  retries: 5
  type: tcp
  host: 192.168.1.9
  port: 502
  # REMARK: scan_interval: <5 can cause troubles
  sensors:
    # Upstream AC Consumption
    # - name: "AC Consumption L1"
    #   unit_of_measurement: "W"
    #   slave: 100
    #   address: 817
    #   data_type: uint16
    #   scan_interval: 3
    #   device_class: power

    # L1 Grid power
    - name: "Multiplus Grid power"
      unit_of_measurement: "W"
      slave: 100
      address: 820
      data_type: int16
      scan_interval: 5
      device_class: power

any ideas what could be causing these issues?

3 Likes

Hi,

What was the last working HA release?
Anything in the log?
Did you check the documentation?

Retry_on_empty is not a valid configuration. Remove it and retry.

I have the same issue with type: tcp as an invalid value.
Especially line 4 and line 9 is weird and seems very broken.

Invalid config for 'modbus' at modbus.yaml, line 3: required key 'bytesize' not provided, please check the docs at https://www.home-assistant.io/integrations/modbus
Invalid config for 'modbus' at modbus.yaml, line 3: required key 'method' not provided, please check the docs at https://www.home-assistant.io/integrations/modbus
Invalid config for 'modbus' at modbus.yaml, line 3: required key 'parity' not provided, please check the docs at https://www.home-assistant.io/integrations/modbus
Invalid config for 'modbus' at modbus.yaml, line 3: required key 'stopbits' not provided, please check the docs at https://www.home-assistant.io/integrations/modbus
Invalid config for 'modbus' at modbus.yaml, line 4: not a valid value for dictionary value 'modbus->0->type', got 'tcp', please check the docs at https://www.home-assistant.io/integrations/modbus
Invalid config for 'modbus' at modbus.yaml, line 5: 'close_comm_on_error' is an invalid option for 'modbus', check: modbus->0->close_comm_on_error, please check the docs at https://www.home-assistant.io/integrations/modbus
Invalid config for 'modbus' at modbus.yaml, line 9: 'host' is an invalid option for 'modbus', check: modbus->0->host, please check the docs at https://www.home-assistant.io/integrations/modbus
2024-04-12 15:15:58.725 ERROR (MainThread) [homeassistant.setup] Setup failed for 'modbus': Invalid config.

Has anyone upgraded to 2024.4.3 and can confirm if it was fixed?

Not fixed. I saw that it should be fixed in 2024.4.5 at best, so hold off for now.

1 Like

Okay thanks for the info

I just tied 2024.5.0 just now and the problem still persists!

Is there any reference to git that would indicate that it gets fixed in a future release?

There has been a new issue opened in git related to this:

But there is also this older issue:

1 Like

Yep. And still not solved on my end. Sometimes it works for a few days, sometimes a few hours. But the connection will always break.
I have been repeating this at length on GitHub, my connection via Modbus had been working rock solid for years. With upgrade to 2024.4 things broke. No Hardware change, no firmware change on the SMA, no network change. The only thing was the upgrade to 2024.4, hence why I’m looking for the issue there.

Was thinking to bring this to SMA as well, but it seems there are issues with other devices too.

1 Like

Hello exactly the same problem and error reports appear with Weishaupt heat pump. Even with version 2024.4.5 not fix as yet. Anybody know if a problem report has been raised?

For testing purposes I now have I just created a test ha deplyoment and tested there.

I have just removed the config retry_on_empty from my modbus.yaml and it is working with 2024.5.4

I can also confirm that on my production instance as well: removing retry_on_empty from my nibe heatpump config, then upgrading HA and it now works!

(@dj-bauer: as a side-note: I had removed: close_comm_on_error from my config earlier as well, so that may be your issue - at least when looking at your pasted output, which states: line 5: 'close_comm_on_error' is an invalid option for 'modbus' would be a good hint… You find a similar pattern in the post by @Zapnologica as well, so in hindsight it is obvious…)

1 Like

Thank you!
This seems to have fixed the problem on update.
I am dissapointed though in the dev, for being so non-constructive in the issues instead of pointing out, that he forgot to note this in the breaking changes :frowning:
Happy, that it works though :slight_smile:

Unfortunately I didn’t even have these items in my configuration. After reviewing with the current documentation, my config is correct. But the connection still drops. Sometimes after a week, sometimes after a single day. The only resolution is restarting the inverter and then home assistant.

But that sounds like a different issue not related to “removed” configs from the modbus integration (which was the root cause for the original post).

@SonnyBBQ : maybe open a new topic with your error/warning message?

Yeah, should have had my coffee first. I meant to ask if these changes really fixed the issue? Or if the issue came back after some time. If this is fixed for you guys, then my issue is different indeed.

yes, for me it is stable now that i have removed the config.
Sounds to me more like a network/DNS issue.
You may want to gather a tcpdump to see if there is communication at the time you experience the issue.
Also look in more depth at the home-assistent.log.

I want to share my setup modbus issue(s)

Configuration:

  • SMA STP10.0-3AV-40
  • SMA STP10.0-3SE-40
  • SMA STP 9000TL-20 (modbus)

Network is with ASUS Airmesh network

HomeAssistant is running on Hyper-V VM

AirMesh Wi-Fi in not always stable but most of time it’s good enough. Modbus has been stable but now 2~3 weeks ago STP 9000TL was not anymore reporting, tried normal reboot everything but no help. Next thing was to check has HA updates changed something, just standard connection error on logs.

That was odd since STP 9000TL was replying to ping. Then I tested from HA console… no reply. So something weird on my flat 192.168.1.0 / 24 network? Or in VM or STP 9000TL nic? Inverter networking is weird since it just a moment visible on Asus network list of connected machines. I used to have static ip but I thought that can there be another client with same ip. Switched SMA to dynamic and now new ip is replying from HA console and modbus based monitoring is working. For now it remains unknow for me that what was “stuck” HAVm, HyperV Host, network, SMA “os”, SMA Nic or something else. Log explanation to tell that don’t trust that if your laptop can ping inverter ip.

Any other progress on this subject? I’ve waited a half year to upgrade in the hope the issue would be resolved in 24.10, but the issue still remains so I’m back on 2023.12.