From 8dfc91a5027e51ae44fcdd4cf60da137cca7ada3 Mon Sep 17 00:00:00 2001 From: jamespcole Date: Mon, 2 Mar 2015 22:05:03 +1100 Subject: [PATCH] Added vera components and added __pycache__ to gitignore --- .gitignore | 1 + config/home-assistant.conf.example | 25 +++++++++++++++++++++++++ homeassistant/components/light/vera.py | 4 ++-- homeassistant/components/sensor/vera.py | 4 ++-- homeassistant/components/switch/vera.py | 4 ++-- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index a82763e1b6d..79bde7962fe 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ config/* !config/home-assistant.conf.default homeassistant/components/frontend/www_static/polymer/bower_components/* +__pycache__ # There is not a better solution afaik.. !config/custom_components diff --git a/config/home-assistant.conf.example b/config/home-assistant.conf.example index d71c3c0cc14..b55b91a6c55 100644 --- a/config/home-assistant.conf.example +++ b/config/home-assistant.conf.example @@ -27,6 +27,7 @@ password=PASSWORD # hosts=192.168.1.1/24 # netmask prefix notation or # hosts=192.168.1.1-255 # address range + [chromecast] [switch] @@ -97,3 +98,27 @@ time_seconds=0 execute_service=notify.notify service_data={"message":"It's 4, time for beer!"} + + +[light] +platform=vera +# The "device_data" field is not required but if you want a switch to show up as a light +# then add it in to here. If you leave out the "name" field the name configured in your +# Vera controller will be used instead. The "id" field should be the Vera id for the device. +device_data=[{"id" : 12, "name": "Lounge Light"}] +vera_controller_url=http://192.168.1.254:3480/ + +[switch] +platform=vera +# The "device_data" field is not required and if not specified all switches will still be added. +# You can use it to override the name specified in your Vera controller using the "name" variable. +# The "id" field should be the Vera id for the device. +device_data=[{"id" : 12, "name": "Lounge Light"}, {"id" : 3, "name": "Lounge Motion"}] +vera_controller_url=http://192.168.1.254:3480/ + +[sensor] +platform=vera +# The "device_data" field is not required and if not specified all sensors will still be added. +# You can use it to override the name specified in your Vera controller using the "name" variable. +device_data=[{"id" : 4, "name": "Lounge Temp"}, {"id" : 3, "name": "Lounge Motion"}, {"id" : 5, "name": "Light Level"}] +vera_controller_url=http://192.168.1.254:3480/ diff --git a/homeassistant/components/light/vera.py b/homeassistant/components/light/vera.py index be16aeba4b7..5e7bad29d56 100644 --- a/homeassistant/components/light/vera.py +++ b/homeassistant/components/light/vera.py @@ -5,7 +5,7 @@ import time import json from homeassistant.helpers import ToggleDevice -import config.custom_components.external.vera as veraApi +import homeassistant.external.vera.vera as veraApi _LOGGER = logging.getLogger('Vera_Light') @@ -78,7 +78,7 @@ class VeraLight(ToggleDevice): def unique_id(self): """ Returns the id of this light """ return "{}.{}".format( - self.__class__, self.info.get('uniqueid', 'vera-' + self.vera_device.deviceId)) + self.__class__, self.info.get('uniqueid', self.name)) @property def name(self): diff --git a/homeassistant/components/sensor/vera.py b/homeassistant/components/sensor/vera.py index da75361724d..57ae4266ca1 100644 --- a/homeassistant/components/sensor/vera.py +++ b/homeassistant/components/sensor/vera.py @@ -5,7 +5,7 @@ import time import json from homeassistant.helpers import Device -import config.custom_components.external.vera as veraApi +import homeassistant.external.vera.vera as veraApi from homeassistant.const import (STATE_OPEN, STATE_CLOSED, ATTR_FRIENDLY_NAME) _LOGGER = logging.getLogger('Vera_Sensor') @@ -78,7 +78,7 @@ class VeraSensor(Device): def unique_id(self): """ Returns the id of this switch """ return "{}.{}".format( - self.__class__, self.info.get('uniqueid', 'vera-sensor-' + self.vera_device.deviceId)) + self.__class__, self.info.get('uniqueid', self.name)) @property def name(self): diff --git a/homeassistant/components/switch/vera.py b/homeassistant/components/switch/vera.py index ccbb593e68c..8b5f38e324d 100644 --- a/homeassistant/components/switch/vera.py +++ b/homeassistant/components/switch/vera.py @@ -5,7 +5,7 @@ import time import json from homeassistant.helpers import ToggleDevice -import config.custom_components.external.vera as veraApi +import homeassistant.external.vera.vera as veraApi _LOGGER = logging.getLogger('Vera_Switch') @@ -70,7 +70,7 @@ class VeraSwitch(ToggleDevice): def unique_id(self): """ Returns the id of this switch """ return "{}.{}".format( - self.__class__, self.info.get('uniqueid', 'vera-switch-' + self.vera_device.deviceId)) + self.__class__, self.info.get('uniqueid', self.name)) @property def name(self):