mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
moved setting name to constructor
This commit is contained in:
parent
a2f438c6ef
commit
7772d5af62
@ -125,13 +125,14 @@ class VeraLight(ToggleDevice):
|
|||||||
def __init__(self, vera_device, extra_data=None):
|
def __init__(self, vera_device, extra_data=None):
|
||||||
self.vera_device = vera_device
|
self.vera_device = vera_device
|
||||||
self.extra_data = extra_data
|
self.extra_data = extra_data
|
||||||
|
if self.extra_data and self.extra_data.get('name'):
|
||||||
|
self._name = self.extra_data.get('name')
|
||||||
|
self._name = self.vera_device.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
""" Get the mame of the light. """
|
""" Get the mame of the light. """
|
||||||
if self.extra_data and self.extra_data.get('name'):
|
return self._name
|
||||||
return self.extra_data.get('name')
|
|
||||||
return self.vera_device.name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state_attributes(self):
|
def state_attributes(self):
|
||||||
|
@ -125,6 +125,9 @@ class VeraSensor(Device):
|
|||||||
def __init__(self, vera_device, extra_data=None):
|
def __init__(self, vera_device, extra_data=None):
|
||||||
self.vera_device = vera_device
|
self.vera_device = vera_device
|
||||||
self.extra_data = extra_data
|
self.extra_data = extra_data
|
||||||
|
if self.extra_data and self.extra_data.get('name'):
|
||||||
|
self._name = self.extra_data.get('name')
|
||||||
|
self._name = self.vera_device.name
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s %s %s" % (self.name, self.vera_device.deviceId, self.state)
|
return "%s %s %s" % (self.name, self.vera_device.deviceId, self.state)
|
||||||
@ -136,9 +139,7 @@ class VeraSensor(Device):
|
|||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
""" Get the mame of the sensor. """
|
""" Get the mame of the sensor. """
|
||||||
if self.extra_data and self.extra_data.get('name'):
|
return self._name
|
||||||
return self.extra_data.get('name')
|
|
||||||
return self.vera_device.name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state_attributes(self):
|
def state_attributes(self):
|
||||||
|
@ -126,13 +126,14 @@ class VeraSwitch(ToggleDevice):
|
|||||||
def __init__(self, vera_device, extra_data=None):
|
def __init__(self, vera_device, extra_data=None):
|
||||||
self.vera_device = vera_device
|
self.vera_device = vera_device
|
||||||
self.extra_data = extra_data
|
self.extra_data = extra_data
|
||||||
|
if self.extra_data and self.extra_data.get('name'):
|
||||||
|
self._name = self.extra_data.get('name')
|
||||||
|
self._name = self.vera_device.name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
""" Get the mame of the switch. """
|
""" Get the mame of the switch. """
|
||||||
if self.extra_data and self.extra_data.get('name'):
|
return self._name
|
||||||
return self.extra_data.get('name')
|
|
||||||
return self.vera_device.name
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state_attributes(self):
|
def state_attributes(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user