diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 81f69001f82..e0fa16d7907 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -10,6 +10,7 @@ from homeassistant.const import ( TEMP_CELSIUS, TEMP_FAHRENHEIT) from homeassistant.helpers.entity import Entity from homeassistant.components.sensor import ENTITY_ID_FORMAT +from homeassistant.util import convert from homeassistant.components.vera import ( VERA_CONTROLLER, VERA_DEVICES, VeraDevice) @@ -49,6 +50,8 @@ class VeraSensor(VeraDevice, Entity): return 'lux' elif self.vera_device.category == "Humidity Sensor": return '%' + elif self.vera_device.category == "Power meter": + return 'watts' def update(self): """Update the state.""" @@ -67,6 +70,9 @@ class VeraSensor(VeraDevice, Entity): self.current_value = self.vera_device.light elif self.vera_device.category == "Humidity Sensor": self.current_value = self.vera_device.humidity + elif self.vera_device.category == "Power meter": + power = convert(self.vera_device.power, float, 0) + self.current_value = int(round(power, 0)) elif self.vera_device.category == "Sensor": tripped = self.vera_device.is_tripped self.current_value = 'Tripped' if tripped else 'Not Tripped' diff --git a/homeassistant/components/vera.py b/homeassistant/components/vera.py index 555a800708c..9d7494147e0 100644 --- a/homeassistant/components/vera.py +++ b/homeassistant/components/vera.py @@ -20,7 +20,7 @@ from homeassistant.const import ( EVENT_HOMEASSISTANT_STOP) from homeassistant.helpers.entity import Entity -REQUIREMENTS = ['pyvera==0.2.25'] +REQUIREMENTS = ['pyvera==0.2.26'] _LOGGER = logging.getLogger(__name__) @@ -35,6 +35,7 @@ CONF_LIGHTS = 'lights' VERA_ID_FORMAT = '{}_{}' ATTR_CURRENT_POWER_W = "current_power_w" +ATTR_CURRENT_ENERGY_KWH = "current_energy_kwh" VERA_DEVICES = defaultdict(list) @@ -181,6 +182,10 @@ class VeraDevice(Entity): if power: attr[ATTR_CURRENT_POWER_W] = convert(power, float, 0.0) + energy = self.vera_device.energy + if energy: + attr[ATTR_CURRENT_ENERGY_KWH] = convert(energy, float, 0.0) + attr['Vera Device Id'] = self.vera_device.vera_device_id return attr diff --git a/requirements_all.txt b/requirements_all.txt index d8a07866d2c..a509529a5f3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -665,7 +665,7 @@ pyunifi==2.0 # pyuserinput==0.1.11 # homeassistant.components.vera -pyvera==0.2.25 +pyvera==0.2.26 # homeassistant.components.notify.html5 pywebpush==0.6.1