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