mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
no more duplicate sensors
This commit is contained in:
parent
a0f2f3814b
commit
e37869616b
@ -12,8 +12,6 @@ from homeassistant.const import TEMP_CELCIUS
|
|||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEPENDENCIES = ['verisure']
|
|
||||||
|
|
||||||
|
|
||||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||||
""" Sets up the Verisure platform. """
|
""" Sets up the Verisure platform. """
|
||||||
@ -79,7 +77,7 @@ class VerisureAlarmDevice(Entity):
|
|||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
""" Returns the state of the device. """
|
""" Returns the state of the device. """
|
||||||
return verisure.STATUS[self._device][self._id].status
|
return verisure.STATUS[self._device][self._id].label
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
verisure.update()
|
verisure.update()
|
||||||
|
@ -16,8 +16,6 @@ import logging
|
|||||||
import homeassistant.components.verisure as verisure
|
import homeassistant.components.verisure as verisure
|
||||||
from homeassistant.components.switch import SwitchDevice
|
from homeassistant.components.switch import SwitchDevice
|
||||||
|
|
||||||
DEPENDENCIES = ['verisure']
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ 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_off = verisure.MY_PAGES.SMARTPLUG_ON
|
self.status_on = verisure.MY_PAGES.SMARTPLUG_ON
|
||||||
self.status_off = verisure.MY_PAGES.SMARTPLUG_OFF
|
self.status_off = verisure.MY_PAGES.SMARTPLUG_OFF
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -54,7 +52,7 @@ 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_off
|
return plug_status == self.status_on
|
||||||
|
|
||||||
def turn_on(self):
|
def turn_on(self):
|
||||||
""" Set smartplug status on """
|
""" Set smartplug status on """
|
||||||
@ -63,7 +61,7 @@ class VerisureSmartplug(SwitchDevice):
|
|||||||
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user