no more duplicate sensors

This commit is contained in:
Per Sandstrom 2015-08-16 08:03:19 +02:00
parent a0f2f3814b
commit e37869616b
2 changed files with 4 additions and 8 deletions

View File

@ -12,8 +12,6 @@ from homeassistant.const import TEMP_CELCIUS
_LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['verisure']
def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the Verisure platform. """
@ -79,7 +77,7 @@ class VerisureAlarmDevice(Entity):
@property
def state(self):
""" 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):
verisure.update()

View File

@ -16,8 +16,6 @@ import logging
import homeassistant.components.verisure as verisure
from homeassistant.components.switch import SwitchDevice
DEPENDENCIES = ['verisure']
_LOGGER = logging.getLogger(__name__)
@ -42,7 +40,7 @@ class VerisureSmartplug(SwitchDevice):
""" Represents a Verisure smartplug. """
def __init__(self, smartplug_status):
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
@property
@ -54,7 +52,7 @@ 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_off
return plug_status == self.status_on
def turn_on(self):
""" Set smartplug status on """
@ -63,7 +61,7 @@ class VerisureSmartplug(SwitchDevice):
self.status_on)
def turn_off(self):
""" Set smartplug status off. """
""" Set smartplug status off """
verisure.MY_PAGES.set_smartplug_status(
self._id,
self.status_off)