Add code to enable discovery for mqtt cover (#10580)
* Add code to enable discovery for mqtt cover * Fix pylint error
This commit is contained in:
parent
95c831d5bc
commit
309e493e76
2 changed files with 6 additions and 1 deletions
|
@ -104,6 +104,9 @@ PLATFORM_SCHEMA = mqtt.MQTT_BASE_PLATFORM_SCHEMA.extend({
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||||
"""Set up the MQTT Cover."""
|
"""Set up the MQTT Cover."""
|
||||||
|
if discovery_info is not None:
|
||||||
|
config = PLATFORM_SCHEMA(discovery_info)
|
||||||
|
|
||||||
value_template = config.get(CONF_VALUE_TEMPLATE)
|
value_template = config.get(CONF_VALUE_TEMPLATE)
|
||||||
if value_template is not None:
|
if value_template is not None:
|
||||||
value_template.hass = hass
|
value_template.hass = hass
|
||||||
|
|
|
@ -20,10 +20,12 @@ TOPIC_MATCHER = re.compile(
|
||||||
r'(?P<prefix_topic>\w+)/(?P<component>\w+)/'
|
r'(?P<prefix_topic>\w+)/(?P<component>\w+)/'
|
||||||
r'(?:(?P<node_id>[a-zA-Z0-9_-]+)/)?(?P<object_id>[a-zA-Z0-9_-]+)/config')
|
r'(?:(?P<node_id>[a-zA-Z0-9_-]+)/)?(?P<object_id>[a-zA-Z0-9_-]+)/config')
|
||||||
|
|
||||||
SUPPORTED_COMPONENTS = ['binary_sensor', 'fan', 'light', 'sensor', 'switch']
|
SUPPORTED_COMPONENTS = [
|
||||||
|
'binary_sensor', 'cover', 'fan', 'light', 'sensor', 'switch']
|
||||||
|
|
||||||
ALLOWED_PLATFORMS = {
|
ALLOWED_PLATFORMS = {
|
||||||
'binary_sensor': ['mqtt'],
|
'binary_sensor': ['mqtt'],
|
||||||
|
'cover': ['mqtt'],
|
||||||
'fan': ['mqtt'],
|
'fan': ['mqtt'],
|
||||||
'light': ['mqtt', 'mqtt_json', 'mqtt_template'],
|
'light': ['mqtt', 'mqtt_json', 'mqtt_template'],
|
||||||
'sensor': ['mqtt'],
|
'sensor': ['mqtt'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue