I tried to design my switch as robust and self-reliant as possible, both in terms of its operation, and in terms of safety (fireproof). For the former, the switch needs the WiFi/Internet connection only once, and very briefly (probably for 5 seconds or less) - to get the current time and date from the internet. After that it works as a smart (sunset/sunrise) switch by default, regardless whether it is connected to WiFi, MQTT, Internet, and/or OpenHab. This is great when you leave it running when you are traveling - even if your router dies, or you loose internet connection, the switch will operate correctly. It will also constantly try to reconnect to WiFi/MQTT/NTP asynchronously (in a non-blocking way), so once the services are back it will be back online. If it looses power, it goes to the default (smart) mode when the power is back. Then it will keep trying to connect to the Internet until it succeeds, and then switches to the smart mode.
So its main functionality (dark time lights on) works properly regardless of the WiFi/MQTT/OpenHab availability. The OpenHab functionality is just for convenience - to check the status, temperature, perhaps switch to the manual mode for a while. But the MQTT/OpenHab are totally non-essential for its correct operation - only the WiFi/Internet, and only briefly, is all it needs. Imagine my Windows PC (where the MQTT and OpenHab servers are running) malfunctions or freezes. The switch will operate correctly regardless, even if it is power cycled - as long as it can connect to the Internet briefly after each power cycle. And if it can’t, it goes into a safe mode (lights off), so no danger that it will do strange things (e.g. turning the lights on during the daytime).