From fceac45ddd683dca6920183108b8efe219d9ee5a Mon Sep 17 00:00:00 2001 From: jamespcole Date: Sat, 7 Mar 2015 12:59:13 +1100 Subject: [PATCH] Updated vera switch and sensor to the new architecture --- homeassistant/components/sensor/vera.py | 13 +++---------- homeassistant/components/switch/vera.py | 11 ++--------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 57ae4266ca1..681799cc7e9 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -41,6 +41,9 @@ def get_devices(hass, config): return vera_sensors +def setup_platform(hass, config, add_devices, discovery_info=None): + add_devices(get_devices(hass, config)) + def get_extra_device_data(device_data, device_id): if not device_data: return None @@ -51,10 +54,6 @@ def get_extra_device_data(device_data, device_id): return None -def get_sensors(): - return vera_sensors - - class VeraSensor(Device): """ Represents a Vera Sensor """ extra_data = None @@ -74,12 +73,6 @@ class VeraSensor(Device): def updateState(self): return self.state() - @property - def unique_id(self): - """ Returns the id of this switch """ - return "{}.{}".format( - self.__class__, self.info.get('uniqueid', self.name)) - @property def name(self): """ Get the mame of the switch. """ diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 8b5f38e324d..17847f5f83a 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -51,9 +51,8 @@ def get_extra_device_data(device_data, device_id): return None -def get_switches(): - return vera_switches - +def setup_platform(hass, config, add_devices, discovery_info=None): + add_devices(get_devices(hass, config)) class VeraSwitch(ToggleDevice): """ Represents a Vera Switch """ @@ -66,12 +65,6 @@ class VeraSwitch(ToggleDevice): self.vera_device = vera_device self.extra_data = extra_data - @property - def unique_id(self): - """ Returns the id of this switch """ - return "{}.{}".format( - self.__class__, self.info.get('uniqueid', self.name)) - @property def name(self): """ Get the mame of the switch. """