hass-core/homeassistant/components/velbus.py
Thomas Delaet fff269e790 Velbus (#8076)
* add Velbus changes

* update library version

* fix python-velbus version

* bug fix and update python-velbus

* change config handling

* update velbus components/platforms

* add support for Velbus switches

* fix bugs

* typo

* add velbus fan

* update velbus library

* bug fix in logic of fan handling of speed settings

* add Velbus changes

change config handling

update velbus components/platforms

add support for Velbus switches

add velbus fan

* remove duplicate entry

* fix documentation links

* fix linting error

* regen requirements_all.txt

* add support for Velbus cover

* bugfix in cover component

* bugfix in cover component

* remove unused imports

* Travis fixes

* fix style

* fix style

* Update velbus.py

* Update velbus.py

* Update velbus.py

* Update requirements_all.txt

* Update velbus.py

* Update velbus.py

* Update velbus.py

* Update velbus.py

* fix style

* Update velbus.py

* Update velbus.py

* Update velbus.py

* Update velbus.py

* Update velbus.py

* Update velbus.py
2017-07-26 14:03:29 +02:00

43 lines
1 KiB
Python

"""
Support for Velbus platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/velbus/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import EVENT_HOMEASSISTANT_STOP, CONF_PORT
REQUIREMENTS = ['python-velbus==2.0.11']
_LOGGER = logging.getLogger(__name__)
DOMAIN = 'velbus'
VELBUS_MESSAGE = 'velbus.message'
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({
vol.Required(CONF_PORT): cv.string,
})
}, extra=vol.ALLOW_EXTRA)
def setup(hass, config):
"""Set up the Velbus platform."""
import velbus
port = config[DOMAIN].get(CONF_PORT)
connection = velbus.VelbusUSBConnection(port)
controller = velbus.Controller(connection)
hass.data[DOMAIN] = controller
def stop_velbus(event):
"""Disconnect from serial port."""
_LOGGER.debug("Shutting down ")
connection.stop()
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, stop_velbus)
return True