HA-FoxESS-Modbus icon indicating copy to clipboard operation
HA-FoxESS-Modbus copied to clipboard

Default scan_intervals overwhelm the W610, causes problems in home assistant

Open canton7 opened this issue 1 year ago • 13 comments

From work done on https://github.com/nathanmarlor/foxess_modbus, we've found what the W610 supports one read about every 700ms (sometimes it can do one quicker). It's capable of reading 8 registers at a time, but the modbus integration only reads 1 register at a time. This means that it theoretically takes 28s to read the 40 sensors in modbusUSB.yaml.

modbusUSB.yaml contains a range of scan_intervals, but they add up to more than 1 read every 700ms.

This means that the modbus integration spawns read operations more quickly than they can be completed. There's no logic to say "I want to refresh this sensor, but it's still waiting for the previous refresh to finish, so I'll hold off" -- it just keeps throwing read operations onto a queue inside home assistant. The queue gradually grows in size, which is going to slow things down, and might eventually crash home assistant. It also delays things like shutdowns and restarts. It also means that sensors aren't actually read at the interval that was requested.

However there's no indication of this unless you go and manually add logging calls to the modbus integration. I did this, and very quickly I've got to having tasks which have been sitting in the queue for 15 minutes+, and it's still rising.

To make matters worse, some people are discussing setting the scan_interval to 5 seconds, or even 1 second, without knowing the problems this causes.

You should probably increase the scan_intervals in modbusUSB.yaml so that they don't mess up home assistant for people who are using a W610 by default, and add some strong warnings not to decrease them?

canton7 avatar Apr 16 '23 11:04 canton7