Shelly switch responses a bit slow

I’m running my Openhab on a Pi 3 model B. It generally runs well.

I’ve recently added about 13 Shelly relays to my config. These are working well, however they’re sometimes pretty slow to respond (a couple of seconds). Long enough that you’ll sometimes push the button again, then end up with lights turning on then off.

I’ve watched the events log, and from the point I get a trigger on the channel to the point where the first light changes is 100ms or less usually:

2023-09-17 11:10:56.576 [INFO ] [openhab.event.ChannelTriggeredEvent ] - shelly:shellyplus2pm-relay:80646fdbe00c:relay2#button triggered SHORT_PRESSED
2023-09-17 11:10:56.783 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'swFloodMasterOutput' received command ON
2023-09-17 11:10:56.784 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'swFloodMasterOutput' predicted to become ON
2023-09-17 11:10:56.786 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'swFloodMasterOutput' updated to ON
2023-09-17 11:10:56.787 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'swFloodMasterOutput' changed from OFF to ON

I’ve turned on MQTT debugging and watched those logs, and the time from pressing the button till the time the event goes through in the log is very rapid.

shellyplus2pm-80646fdbe00c 197 1694905859.725 1|shelly_notification:208 Event from input:1: {"component":"input:1", "id":1, "event":"btn_down", "ts":1694905859.71}

{"src":"shellyplus2pm-80646fdbe00c","dst":"shellyplus2pm-80646fdbe00c/events","method":"NotifyEvent","params":{"ts":1694905859.71,"events":[{"component":"input:1", "id":1, "event":"btn_down", "ts":1694905859.71}]}}
shellyplus2pm-80646fdbe00c 198 1694905859.864 1|shelly_notification:208 Event from input:1: {"component":"input:1", "id":1, "event":"btn_up", "ts":1694905859.85}

{"src":"shellyplus2pm-80646fdbe00c","dst":"shellyplus2pm-80646fdbe00c/events","method":"NotifyEvent","params":{"ts":1694905859.85,"events":[{"component":"input:1", "id":1, "event":"btn_up", "ts":1694905859.85}]}}
shellyplus2pm-80646fdbe00c 199 1694905860.226 1|shelly_notification:208 Event from input:1: {"component":"input:1", "id":1, "event":"single_push", "ts":1694905860.21}

{"src":"shellyplus2pm-80646fdbe00c","dst":"shellyplus2pm-80646fdbe00c/events","method":"NotifyEvent","params":{"ts":1694905860.21,"events":[{"component":"input:1", "id":1, "event":"single_push", "ts":1694905860.21}]}}

I can also see this scrolling up the screen immediately after pressing the button, then there’s sometimes a noticeable delay, then the event triggers.

All that suggests to me that the delay is between the event being sent from the device to OpenHab, and OpenHab publishing that event on the internal bus - i.e. that the time is in the binding. Is this a problem that other people have noticed? In theory I could fix this by shifting to using MQTT to pick up the events instead of the binding (and I may try that to see if it gives a faster response just as a proof point), but it seems like that should be the wrong answer.

On a separate but related matter I find my Shellys losing connectivity with openhab. I’m running the switches in detached mode (so I can get the double press and long press events), and after a few days a number of them just stop publishing to Openhab. I intend to diagnose that through turning on debug, but I think have to wait for one of them to stop working, then watch the debug logs. (If I only turn on debug when it’s happening, turning on debug requires a reboot, which seems to solve the problem anyway). It looks to me like the devices in this situation are actually still running fine - I can use the app to turn them on and off - the events just aren’t propagating to OpenHab. I’d assumed that was a device problem, but arguably it could be a binding problem too. Have others seen that issue?