def __init__(self, domain_config, verisure): """Initialize the Verisure hub.""" self.alarm_status = {} self.lock_status = {} self.climate_status = {} self.mouse_status = {} self.smartplug_status = {} self.smartcam_status = {} self.smartcam_dict = {} self.config = domain_config self._verisure = verisure self._lock = threading.Lock() # When MyPages is brought up from maintenance it sometimes give us a # "wrong password" message. We will continue to retry after maintenance # regardless of that error. self._disable_wrong_password_error = False self._password_retries = 1 self._reconnect_timeout = time.time() self.my_pages = verisure.MyPages( domain_config[CONF_USERNAME], domain_config[CONF_PASSWORD])
def login(self, force=False): if not self.tryingToLogin or force: if "verisureUsername" not in self.pluginPrefs or "verisurePassword" not in self.pluginPrefs: self.errorLog( u"Must enter Username and Password in Plugin Config") else: self.tryingToLogin = True self.debugLog(u"Logging in") self.myPages = verisure.MyPages( self.pluginPrefs["verisureUsername"], self.pluginPrefs["verisurePassword"]) self.myPages.login() self.debugLog(u"Logging in successfully.") if self.loginErrorCount > 0: indigo.server.log( "Successfully connected to Verisure again") self.loginErrorCount = 0 self.tryingToLogin = False
def __init__(self, domain_config, verisure): self.alarm_status = {} self.lock_status = {} self.climate_status = {} self.mouse_status = {} self.smartplug_status = {} self.config = domain_config self._verisure = verisure self._lock = threading.Lock() self._password_retries = VerisureHub.MAX_PASSWORD_RETRIES self._wrong_password_given = False self._reconnect_timeout = time.time() self.my_pages = verisure.MyPages( domain_config[CONF_USERNAME], domain_config[CONF_PASSWORD])