Fix style issues, update pyvera version.

This commit is contained in:
pavoni 2015-10-27 23:43:06 +00:00 committed by pavoni
parent 6ef0d089ea
commit 031d5ce255
3 changed files with 13 additions and 11 deletions

View File

@ -12,11 +12,11 @@ import time
from requests.exceptions import RequestException from requests.exceptions import RequestException
from homeassistant.components.switch.vera import VeraSwitch from homeassistant.components.switch.vera import VeraSwitch
from homeassistant.components.light import Light, ATTR_BRIGHTNESS from homeassistant.components.light import ATTR_BRIGHTNESS
REQUIREMENTS = ['https://github.com/balloob/home-assistant-vera-api/archive/' REQUIREMENTS = ['https://github.com/pavoni/home-assistant-vera-api/archive/'
'a8f823066ead6c7da6fb5e7abaf16fef62e63364.zip' '90e203b58c5897930a9567252943b7c96c39652b.zip'
'#python-vera==0.1'] '#python-vera==0.1.1']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -39,7 +39,10 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
controller = veraApi.VeraController(base_url) controller = veraApi.VeraController(base_url)
devices = [] devices = []
try: try:
devices = controller.get_devices(['Switch', 'On/Off Switch', 'Dimmable Switch']) devices = controller.get_devices([
'Switch',
'On/Off Switch',
'Dimmable Switch'])
except RequestException: except RequestException:
# There was a network related error connecting to the vera controller # There was a network related error connecting to the vera controller
_LOGGER.exception("Error communicating with Vera API") _LOGGER.exception("Error communicating with Vera API")
@ -55,6 +58,7 @@ def setup_platform(hass, config, add_devices_callback, discovery_info=None):
add_devices_callback(lights) add_devices_callback(lights)
class VeraLight(VeraSwitch): class VeraLight(VeraSwitch):
""" Represents a Vera Light, including dimmable. """ """ Represents a Vera Light, including dimmable. """
@ -67,7 +71,6 @@ class VeraLight(VeraSwitch):
return attr return attr
def turn_on(self, **kwargs): def turn_on(self, **kwargs):
if ATTR_BRIGHTNESS in kwargs and self.vera_device.is_dimmable: if ATTR_BRIGHTNESS in kwargs and self.vera_device.is_dimmable:
self.vera_device.set_brightness(kwargs[ATTR_BRIGHTNESS]) self.vera_device.set_brightness(kwargs[ATTR_BRIGHTNESS])
@ -76,4 +79,3 @@ class VeraLight(VeraSwitch):
self.last_command_send = time.time() self.last_command_send = time.time()
self.is_on_status = True self.is_on_status = True

View File

@ -15,9 +15,9 @@ from homeassistant.helpers.entity import ToggleEntity
from homeassistant.const import ( from homeassistant.const import (
ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME) ATTR_BATTERY_LEVEL, ATTR_TRIPPED, ATTR_ARMED, ATTR_LAST_TRIP_TIME)
REQUIREMENTS = ['https://github.com/balloob/home-assistant-vera-api/archive/' REQUIREMENTS = ['https://github.com/pavoni/home-assistant-vera-api/archive/'
'a8f823066ead6c7da6fb5e7abaf16fef62e63364.zip' '90e203b58c5897930a9567252943b7c96c39652b.zip'
'#python-vera==0.1'] '#python-vera==0.1.1']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -128,7 +128,7 @@ pyfttt==0.3
https://github.com/balloob/home-assistant-nzb-clients/archive/616cad59154092599278661af17e2a9f2cf5e2a9.zip#python-sabnzbd==0.1 https://github.com/balloob/home-assistant-nzb-clients/archive/616cad59154092599278661af17e2a9f2cf5e2a9.zip#python-sabnzbd==0.1
# Vera (*.vera) # Vera (*.vera)
https://github.com/balloob/home-assistant-vera-api/archive/a8f823066ead6c7da6fb5e7abaf16fef62e63364.zip#python-vera==0.1 https://github.com/pavoni/home-assistant-vera-api/archive/90e203b58c5897930a9567252943b7c96c39652b.zip#python-vera==0.1.1
# Sonos (media_player.sonos) # Sonos (media_player.sonos)
SoCo==0.11.1 SoCo==0.11.1