Adds MQTT Fan Discovery (#9463)

This commit is contained in:
Walter Huf authored and Pascal Vizeli committed 2017-09-17 11:32:22 +02:00
1 parent bda6d2c696
commit 8a3f8457e8
3 files changed
+22 -1

No files matched your search

+3
View File
@@ -78,6 +78,9 @@ PLATFORM_SCHEMA = mqtt.MQTT_RW_PLATFORM_SCHEMA.extend({
@asyncio.coroutine
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
"""Set up the MQTT fan platform."""
if discovery_info is not None:
config = PLATFORM_SCHEMA(discovery_info)
async_add_devices([MqttFan(
config.get(CONF_NAME),
{
+2 -1
View File
@@ -20,10 +20,11 @@ TOPIC_MATCHER = re.compile(
r'(?P<prefix_topic>\w+)/(?P<component>\w+)/'
r'(?:(?P<node_id>[a-zA-Z0-9_-]+)/)?(?P<object_id>[a-zA-Z0-9_-]+)/config')
SUPPORTED_COMPONENTS = ['binary_sensor', 'light', 'sensor', 'switch']
SUPPORTED_COMPONENTS = ['binary_sensor', 'fan', 'light', 'sensor', 'switch']
ALLOWED_PLATFORMS = {
'binary_sensor': ['mqtt'],
'fan': ['mqtt'],
'light': ['mqtt', 'mqtt_json', 'mqtt_template'],
'sensor': ['mqtt'],
'switch': ['mqtt'],