This results in is each time we try to log into Abode by instantiating the Abode class from HA, it creates an instance of AbodeEventController even if the login fails (i.e. invalid credentials). Each time AbodeEventController is instantiated, a bunch of callbacks are added:
2020-11-25 18:11:15 DEBUG (SyncWorker_6) [abodepy.socketio] Adding callback for event name: started
2020-11-25 18:11:15 DEBUG (SyncWorker_6) [abodepy.socketio] Adding callback for event name: connected
2020-11-25 18:11:15 DEBUG (SyncWorker_6) [abodepy.socketio] Adding callback for event name: disconnected
2020-11-25 18:11:15 DEBUG (SyncWorker_6) [abodepy.socketio] Adding callback for event name: com.goabode.device.update
2020-11-25 18:11:15 DEBUG (SyncWorker_6) [abodepy.socketio] Adding callback for event name: com.goabode.gateway.mode
2020-11-25 18:11:15 DEBUG (SyncWorker_6) [abodepy.socketio] Adding callback for event name: com.goabode.gateway.timeline
2020-11-25 18:11:15 DEBUG (SyncWorker_6) [abodepy.socketio] Adding callback for event name: com.goabode.automation
I'm not sure if this is really that big of an issue but it seems like this is something that should occur after a valid connection is established or confirmed. An easy solution would be to move this after the self.login() method here. However, if you were able to create an instance of Abode and pass in auto_login=False, then it would self._event_controller would never be set. That being said, I'm not even sure if that's a valid use case.
I'm working on adding the MFA config flow for the Abode integration and I noticed something that we should maybe change.
Right now,
AbodeEventController
is being instantiated towards the beginning of initializing theAbode
class.This results in is each time we try to log into Abode by instantiating the Abode class from HA, it creates an instance of
AbodeEventController
even if the login fails (i.e. invalid credentials). Each timeAbodeEventController
is instantiated, a bunch of callbacks are added:I'm not sure if this is really that big of an issue but it seems like this is something that should occur after a valid connection is established or confirmed. An easy solution would be to move this after the
self.login()
method here. However, if you were able to create an instance ofAbode
and pass inauto_login=False
, then it wouldself._event_controller
would never be set. That being said, I'm not even sure if that's a valid use case.Thoughts?