Tidy / Refactor Vera (#2569)
* Add power attribute to switch. * Move device_state_attributes into base class. * Fix imports following refactor. * Bump pyvera version - should add contributed support for older (UI5) version dimmers and locks. * Refactor device lookup to be based on vera classes, push category back into library. * Add generic power attribute, fix inherited class order bug. * Tidy.
This commit is contained in:
1 parent
7c431911d1
commit
e34bfb7381
7 files changed
+73
-140
No files matched your search
@@ -8,7 +8,7 @@ import logging
|
||||
|
||||
from homeassistant.components.lock import LockDevice
|
||||
from homeassistant.const import (
|
||||
ATTR_BATTERY_LEVEL, STATE_LOCKED, STATE_UNLOCKED)
|
||||
STATE_LOCKED, STATE_UNLOCKED)
|
||||
from homeassistant.components.vera import (
|
||||
VeraDevice, VERA_DEVICES, VERA_CONTROLLER)
|
||||
|
||||
@@ -32,16 +32,6 @@ class VeraLock(VeraDevice, LockDevice):
|
||||
self._state = None
|
||||
VeraDevice.__init__(self, vera_device, controller)
|
||||
|
||||
@property
|
||||
def device_state_attributes(self):
|
||||
"""Return the state attributes of the device."""
|
||||
attr = {}
|
||||
if self.vera_device.has_battery:
|
||||
attr[ATTR_BATTERY_LEVEL] = self.vera_device.battery_level + '%'
|
||||
|
||||
attr['Vera Device Id'] = self.vera_device.vera_device_id
|
||||
return attr
|
||||
|
||||
def lock(self, **kwargs):
|
||||
"""Lock the device."""
|
||||
self.vera_device.lock()
|
||||
|
||||
Reference in new issue
Block a user