mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Support MQTT Lock discovery (#13303)
This commit is contained in:
parent
437ffc8337
commit
1cbf9792d7
@ -44,6 +44,9 @@ PLATFORM_SCHEMA = mqtt.MQTT_RW_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 lock."""
|
"""Set up the MQTT lock."""
|
||||||
|
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,13 +20,14 @@ TOPIC_MATCHER = re.compile(
|
|||||||
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 = [
|
SUPPORTED_COMPONENTS = [
|
||||||
'binary_sensor', 'cover', 'fan', 'light', 'sensor', 'switch']
|
'binary_sensor', 'cover', 'fan', 'light', 'sensor', 'switch', 'lock']
|
||||||
|
|
||||||
ALLOWED_PLATFORMS = {
|
ALLOWED_PLATFORMS = {
|
||||||
'binary_sensor': ['mqtt'],
|
'binary_sensor': ['mqtt'],
|
||||||
'cover': ['mqtt'],
|
'cover': ['mqtt'],
|
||||||
'fan': ['mqtt'],
|
'fan': ['mqtt'],
|
||||||
'light': ['mqtt', 'mqtt_json', 'mqtt_template'],
|
'light': ['mqtt', 'mqtt_json', 'mqtt_template'],
|
||||||
|
'lock': ['mqtt'],
|
||||||
'sensor': ['mqtt'],
|
'sensor': ['mqtt'],
|
||||||
'switch': ['mqtt'],
|
'switch': ['mqtt'],
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user