From c4e10356387899d25a0ad61271687294adbb7879 Mon Sep 17 00:00:00 2001 From: pavoni Date: Fri, 15 Jan 2016 09:21:48 +0000 Subject: [PATCH 1/4] Add humidity sensor, add units for humidity and light sensors. --- homeassistant/components/sensor/vera.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index b381974ab31..cef4edb036d 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -45,7 +45,10 @@ def get_devices(hass, config): hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_subscription) - categories = ['Temperature Sensor', 'Light Sensor', 'Sensor'] + categories = ['Temperature Sensor', + 'Light Sensor', + 'Humidity Sensor', + 'Sensor'] devices = [] try: devices = vera_controller.get_devices(categories) @@ -106,7 +109,12 @@ class VeraSensor(Entity): @property def unit_of_measurement(self): """ Unit of measurement of this entity, if any. """ - return self._temperature_units + if self.vera_device.category == "Temperature Sensor": + return self._temperature_units + elif self.vera_device.category == "Light Sensor": + return 'lux' + elif self.vera_device.category == "Humidity Sensor": + return '%' @property def state_attributes(self): @@ -140,7 +148,7 @@ class VeraSensor(Entity): def update(self): if self.vera_device.category == "Temperature Sensor": current_temp = self.vera_device.get_value('CurrentTemperature') - vera_temp_units = self.vera_device.veraController.temperature_units + vera_temp_units = self.vera_device.vera_controller.temperature_units if vera_temp_units == 'F': self._temperature_units = TEMP_FAHRENHEIT @@ -157,6 +165,8 @@ class VeraSensor(Entity): self.current_value = current_temp elif self.vera_device.category == "Light Sensor": self.current_value = self.vera_device.get_value('CurrentLevel') + elif self.vera_device.category == "Humidity Sensor": + self.current_value = self.vera_device.get_value('CurrentLevel') elif self.vera_device.category == "Sensor": tripped = self.vera_device.get_value('Tripped') self.current_value = 'Tripped' if tripped == '1' else 'Not Tripped' From 4bc33d03521baca23c0702900167a07760ae5902 Mon Sep 17 00:00:00 2001 From: pavoni Date: Fri, 15 Jan 2016 10:34:14 +0000 Subject: [PATCH 2/4] Bump pyvera version. --- homeassistant/components/light/vera.py | 2 +- homeassistant/components/sensor/vera.py | 2 +- homeassistant/components/switch/vera.py | 2 +- requirements_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index 42a5e7b7899..937c1ea4a4d 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -15,7 +15,7 @@ from homeassistant.components.light import ATTR_BRIGHTNESS from homeassistant.const import EVENT_HOMEASSISTANT_STOP, STATE_ON -REQUIREMENTS = ['pyvera==0.2.3'] +REQUIREMENTS = ['pyvera==0.2.4'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index cef4edb036d..7d94236a62f 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -15,7 +15,7 @@ from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME, TEMP_CELCIUS, TEMP_FAHRENHEIT, EVENT_HOMEASSISTANT_STOP) -REQUIREMENTS = ['pyvera==0.2.3'] +REQUIREMENTS = ['pyvera==0.2.4'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 4094fe61f4f..2eb1da8ceb9 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -21,7 +21,7 @@ from homeassistant.const import ( STATE_ON, STATE_OFF) -REQUIREMENTS = ['pyvera==0.2.3'] +REQUIREMENTS = ['pyvera==0.2.4'] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index 11f3873c4b1..2105f1b2763 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -62,7 +62,7 @@ tellcore-py==1.1.2 # homeassistant.components.light.vera # homeassistant.components.sensor.vera # homeassistant.components.switch.vera -pyvera==0.2.3 +pyvera==0.2.4 # homeassistant.components.wink # homeassistant.components.light.wink From 719f9a63d900d3da868ed9a809cb958f85210e03 Mon Sep 17 00:00:00 2001 From: pavoni Date: Fri, 15 Jan 2016 10:52:58 +0000 Subject: [PATCH 3/4] Fix style issue --- homeassistant/components/sensor/vera.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 7d94236a62f..3d37c457be2 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -148,7 +148,8 @@ class VeraSensor(Entity): def update(self): if self.vera_device.category == "Temperature Sensor": current_temp = self.vera_device.get_value('CurrentTemperature') - vera_temp_units = self.vera_device.vera_controller.temperature_units + vera_temp_units = ( + self.vera_device.vera_controller.temperature_units) if vera_temp_units == 'F': self._temperature_units = TEMP_FAHRENHEIT From 4fd79afa42f5c3d815d0d07449d8db6ff60fefb0 Mon Sep 17 00:00:00 2001 From: pavoni Date: Fri, 15 Jan 2016 11:45:17 +0000 Subject: [PATCH 4/4] Bump pyvera version. --- homeassistant/components/light/vera.py | 2 +- homeassistant/components/sensor/vera.py | 2 +- homeassistant/components/switch/vera.py | 2 +- requirements_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index 937c1ea4a4d..5b2e74f3ac8 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -15,7 +15,7 @@ from homeassistant.components.light import ATTR_BRIGHTNESS from homeassistant.const import EVENT_HOMEASSISTANT_STOP, STATE_ON -REQUIREMENTS = ['pyvera==0.2.4'] +REQUIREMENTS = ['pyvera==0.2.5'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index 3d37c457be2..9bf1c071450 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -15,7 +15,7 @@ from homeassistant.const import ( ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME, TEMP_CELCIUS, TEMP_FAHRENHEIT, EVENT_HOMEASSISTANT_STOP) -REQUIREMENTS = ['pyvera==0.2.4'] +REQUIREMENTS = ['pyvera==0.2.5'] _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index 2eb1da8ceb9..ec7f7395e26 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -21,7 +21,7 @@ from homeassistant.const import ( STATE_ON, STATE_OFF) -REQUIREMENTS = ['pyvera==0.2.4'] +REQUIREMENTS = ['pyvera==0.2.5'] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index 2105f1b2763..24be13da807 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -62,7 +62,7 @@ tellcore-py==1.1.2 # homeassistant.components.light.vera # homeassistant.components.sensor.vera # homeassistant.components.switch.vera -pyvera==0.2.4 +pyvera==0.2.5 # homeassistant.components.wink # homeassistant.components.light.wink