Frame challenge: There are a couple of serious problems, right off the bat.
Sonoff is not legal to use
They sell it knowing this. There are certifications they must obtain, and that would require them to vastly improve their build quality.
All work done in El NEC territory requires equipment to be approved; and that means by a competent NRTL. Sonoff didn't bother to get anything approved, and it doesn't have the marks of any competent lab -- RoHS and CE are not labs at all, and the Chinese consistently fake the CE mark; it is jokingly referred to as "China Export". In the EU, whoever imports a CE-marked device into the EU is responsible for it conforming to Conformité Européenne. So if you got it mail order (even if it came via an Amazon dropship warehouse)... you're the importer! So sadly, as useful as Sonoff devices are, they are simply Chinese dreck from a safety and regulatory view, and should not ever touch mains wiring. You need to investigate other brands that are UL-listed or regional equivalent.
The branch to the switch, and switch, need to be Class 1 wiring methods.
The device needs to be entirely inside a class 1 enclosure, and further, the "low voltage" S1 and S2 leads need to remain in class 1 wiring (i.e. THHN, Romex or twin-and-earth). Further, the switch and its enclosure needs to be mains rated; so a random $1.00 Handy-Box and 60 cent Leviton switch will suffice, but a random toggle switch off Mouser stuffed in a project box will not. S1 and S2 cannot be wired into anything else unless all that, and everything it's wired to, is also inside class 1 enclosures.
I mention all this because this may compel you to a different design method, which would moot your question.