Class structure overview¶
main.py initially creates an instance of DoorOpenerPico which then instantiates one of three types of instance —
DoorOpenerPicoBase(button functionality only) ifcredentials.conf(login credentials) ordiscovery.conf(Home Assistant discovery payload) can’t be found.DoorOpenerPicoWeb(web server) if the control panel button is held on startup.DoorOpenerPicoNetwork(Home Assistant/MQTT) otherwise.
These three classes have an inheritance relationship in terms of progressive enhancement as such —

i.e. The majority of base functionality is implemented in DoorOpenerPicoBase, DoorOpenerPicoNetwork inherits from that and implements network/MQTT functionality, and DoorOpenerPicoWeb inherits from that and implements web server functionality.
Aside from this, there are two utility classes —
Confwhich is used to retrieve and validate.conffiles.Print_debugwhich is used to print debug messages to the console with an optional timestamp.