Merge branch 'current' into next

This commit is contained in:
Fabian Affolter 2016-09-11 00:04:13 +02:00
commit 484562dc50
No known key found for this signature in database
GPG key ID: DDF3D6F44AAB1336
23 changed files with 121 additions and 108 deletions

View file

@ -24,3 +24,5 @@ On Windows you can use `python setup.py develop` instead of the setup script.
After following these steps, running `hass` will invoke your local installation.
If you are using Windows as a development platform ensure you have the correct Microsoft Visual C++ build tools installed. Please check [the Windows Compilers](https://wiki.python.org/moin/WindowsCompilers) section on the [Python website](https://www.python.org/) for details. Validation using `tox` will fail if this is not done correctly.

View file

@ -11,7 +11,7 @@ footer: true
This example is for adding support for the imaginary Awesome Lights. It shows the different best practices for developing a platform.
Similar to Example Sensor Platform, Copy the code below and create it as a file in `<config_dir>/custom_components/light/awesomelights.py`.
Similar to Example Sensor Platform, copy the code below, and create it as a file in `<config_dir>/custom_components/light/awesomelights.py`.
Add the following to your configuration.yaml:
@ -28,34 +28,40 @@ Note the `platform` name matches the filename for the source code.
```python
import logging
import voluptuous as vol
# Import the device class from the component that you want to support
from homeassistant.components.light import ATTR_BRIGHTNESS, Light
from homeassistant.components.light import ATTR_BRIGHTNESS, Light, PLATFORM_SCHEMA
from homeassistant.const import CONF_HOST, CONF_USERNAME, CONF_PASSWORD
import homeassistant.helpers.config_validation as cv
# Home Assistant depends on 3rd party packages for API specific code.
REQUIREMENTS = ['awesome_lights==1.2.3']
_LOGGER = logging.getLogger(__name__)
# Validation of the user's configuration
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_HOST): cv.string,
vol.Optional(CONF_USERNAME, default='admin'): cv.string,
vol.Optional(CONF_PASSWORD): cv.string,
})
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the Awesome Light platform."""
import awesomelights
# Validate passed in config
# Assign configuration variables. The configuration check takes care they are
# present.
host = config.get(CONF_HOST)
username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)
if host is None or username is None or password is None:
_LOGGER.error('Invalid config. Expected %s, %s and %s',
CONF_HOST, CONF_USERNAME, CONF_PASSWORD)
return False
# Setup connection with devices/cloud
hub = awesomelights.Hub(host, username, password)
# Verify that passed in config works
# Verify that passed in configuration works
if not hub.is_valid_login():
_LOGGER.error('Could not connect to AwesomeLight hub')
return False

View file

@ -9,7 +9,7 @@ sharing: true
footer: true
---
The website you're reading now is the home of Home Assistant: [https://home-assistant.io](https://home-assistant.io). This is the place where we provide documentation and additional details about Home Assistant for end users and developers.
The website you are reading now is the home of Home Assistant: [https://home-assistant.io](https://home-assistant.io). This is the place where we provide documentation and additional details about Home Assistant for end users and developers.
home-assistant.io is built using [Jekyll](http://github.com/mojombo/jekyll) and [those available dependencies](https://pages.github.com/versions/). The pages are written in [markdown](http://daringfireball.net/projects/markdown/); to add a page you don't need to know about HTML or the like.
@ -31,6 +31,9 @@ Then you can work on the documentation:
- Create a Pull Request (PR) against the **next** branch of home-assistant.github.io if your documentation is for a new feature, platform, or component.
- Create a Pull Request (PR) against the **current** branch of home-assistant.github.io if you fix stuff, create Cookbook entries, or expand existing documentation.
<p class='note'>
It could be necessary that you run `rake generate` prior to `rake preview` for the very first preview.
</p>
### {% linkable_title Create a page %}