Updated vera switch and sensor to the new architecture

pull/52/head
jamespcole 2015-03-07 12:59:13 +11:00
parent ba58c080e3
commit fceac45ddd
2 changed files with 5 additions and 19 deletions

View File

@ -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. """

View File

@ -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. """