depend on witch type of switches you use.
i have a general switch for kaku, elro, blokker and action switches.
those are cheap switches from the Netherlands. (elro also in Germany)
recently i helped someone with a set of livolo switches.
i’m sure that there are libs for almost any switchtypes to be found and rewritten.
my setup you find here: General Mysensors 433 mhz switch
but in the time since i have moved my HA automations to appdaemon https://github.com/acockburn/appdaemon
and that is to be found here AppDaemon Q&A
that works with the same sketch.
it is still in 1.5 but i have moved my gateway to 2.0 and it still works (so rewriting can wait )