mirror of
https://github.com/home-assistant/core.git
synced 2025-08-24 15:01:36 +02:00
fixed flak8
This commit is contained in:
@@ -42,8 +42,8 @@ class VerisureSmartplug(SwitchDevice):
|
||||
""" Represents a Verisure smartplug. """
|
||||
def __init__(self, smartplug_status):
|
||||
self._id = smartplug_status.id
|
||||
self.STATUS_ON = verisure.MY_PAGES.SMARTPLUG_ON
|
||||
self.STATUS_OFF = verisure.MY_PAGES.SMARTPLUG_OFF
|
||||
self.status_off = verisure.MY_PAGES.SMARTPLUG_ON
|
||||
self.status_off = verisure.MY_PAGES.SMARTPLUG_OFF
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@@ -54,19 +54,19 @@ class VerisureSmartplug(SwitchDevice):
|
||||
def is_on(self):
|
||||
""" Returns True if on """
|
||||
plug_status = verisure.get_smartplug_status()[self._id].status
|
||||
return plug_status == self.STATUS_ON
|
||||
return plug_status == self.status_off
|
||||
|
||||
def turn_on(self):
|
||||
""" Set smartplug status on """
|
||||
verisure.MY_PAGES.set_smartplug_status(
|
||||
self._id,
|
||||
self.STATUS_ON)
|
||||
self.status_on)
|
||||
|
||||
def turn_off(self):
|
||||
""" Set smartplug status off. """
|
||||
verisure.MY_PAGES.set_smartplug_status(
|
||||
self._id,
|
||||
self.STATUS_OFF)
|
||||
self.status_off)
|
||||
|
||||
def update(self):
|
||||
verisure.update()
|
||||
|
@@ -64,7 +64,7 @@ def setup(hass, config):
|
||||
try:
|
||||
MY_PAGES.login()
|
||||
except (ConnectionError, Error) as ex:
|
||||
_LOGGER.error('Could not log in to verisure mypages, %s', ex.message)
|
||||
_LOGGER.error('Could not log in to verisure mypages, %s', ex)
|
||||
return False
|
||||
|
||||
update()
|
||||
@@ -102,11 +102,11 @@ def reconnect():
|
||||
try:
|
||||
MY_PAGES.login()
|
||||
except VERISURE_LOGIN_ERROR as ex:
|
||||
_LOGGER.error("Could not login to Verisure mypages, %s", ex.message)
|
||||
_LOGGER.error("Could not login to Verisure mypages, %s", ex)
|
||||
global WRONG_PASSWORD_GIVEN
|
||||
WRONG_PASSWORD_GIVEN = True
|
||||
except (ConnectionError, VERISURE_ERROR) as ex:
|
||||
_LOGGER.error("Could not login to Verisure mypages, %s", ex.message)
|
||||
_LOGGER.error("Could not login to Verisure mypages, %s", ex)
|
||||
|
||||
|
||||
@Throttle(MIN_TIME_BETWEEN_REQUESTS)
|
||||
|
Reference in New Issue
Block a user