My initial best guess explanation is that the switches aren’t receiving the commands, not that they’re receiving and ignoring them. The next step is to try to confirm/refute that, and figure out why.
Are your switches using S2 or unsecured? What version of home assistant/zwavejs are you using? And which “flavor” of zwavejs?
I’d start your troubleshooting by looking at the zwavejs logs. Set the log level to debug, wait for the issue to happen, then look through the logs around that time to see what messages were sent. There may be some hints there as to what messages are being sent, especially with respect to whether the supervision command class is being used, and if so, with what results.
It could be a z-wave mesh issue. Are the two switches where this happens farther away from your other mains-powered z-wave devices than usual, or perhaps they only have one path back to the hub?
Some background on z-wave that might be helpful:
How z-wave supervision works
Z-Wave is a mesh network. That means it works best when there are multiple, diverse routes to each node (a route is a series of hops from the source to the destination, which may pass through other mains-powered nodes in the network). This adds resilience in the face of interference, but also introduces the possibility of a message being received more than once (if it was transmitted along multiple routes), or being dropped. The supervision command class is designed to solve this. The way it works is something like this:
The controller sends a command to turn on, and wraps the command in a supervision command, which says “this is command number 12. Let me know when you receive it”. The number (12) is typically incremented for each command being sent, and then resets to zero periodically.
When the switch gets the supervision-encapsulated command, it sends back a response to the sender which says “I received command 12”. This helps the sender know the message was actually received. It then checks if it’s received command number 12 recently. If so, it assumes the new command is a duplicate and ignores it. This helps with the issue of commands being processed more than once.
The sender (in this case, the hub), waits a short while for that “I received command 12” response, and if it doesn’t get it, it knows that either the original command was not received, or the response was lost. I believe it’s supposed to retransmit the message, still calling it number 12. This gives the receiver another chance to process the message, (in case the problem was with the original message) while avoiding double-processing in case the problem was with the response (because it’s reusing number 12).
Supervision works pretty well, most of the time, as long as everyone sticks to the z-wave spec and doesn’t have any bugs. My guess is that something, somewhere in this process isn’t working right in your case, some of the time.