Add discovery support to mqtt climate component. (#15085)
* Add discovery support to mqtt climate component. * - Fix flake8 error (./homeassistant/components/climate/mqtt.py:130:1: D202 No blank lines allowed after function docstring) - Fix test error (since climate component was expected not to work - changed it to "lock" component, which also does not have MQTT discovery support yet) * Fix old assert statement to reflect new lock component usage * Change invalid MQTT discovery component type from 'lock' to 'timer', since contrary to the documentation the lock component is properly supported when using MQTT discovery. * Make configuration of invalid MQTT config component a single point of entry to prevent missing the assertion later in the code when changing. * Add new testcases to cover not-yet-covered code paths in https://github.com/home-assistant/home-assistant/blob/dev/homeassistant/components/climate/mqtt.py
This commit is contained in:
1 parent
d3ceb9080c
commit
73034c933e
4 files changed
+118
-4
No files matched your search
@@ -129,6 +129,9 @@ PLATFORM_SCHEMA = SCHEMA_BASE.extend({
|
||||
@asyncio.coroutine
|
||||
def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
||||
"""Set up the MQTT climate devices."""
|
||||
if discovery_info is not None:
|
||||
config = PLATFORM_SCHEMA(discovery_info)
|
||||
|
||||
template_keys = (
|
||||
CONF_POWER_STATE_TEMPLATE,
|
||||
CONF_MODE_STATE_TEMPLATE,
|
||||
|
||||
@@ -21,7 +21,7 @@ TOPIC_MATCHER = re.compile(
|
||||
|
||||
SUPPORTED_COMPONENTS = [
|
||||
'binary_sensor', 'camera', 'cover', 'fan',
|
||||
'light', 'sensor', 'switch', 'lock']
|
||||
'light', 'sensor', 'switch', 'lock', 'climate']
|
||||
|
||||
ALLOWED_PLATFORMS = {
|
||||
'binary_sensor': ['mqtt'],
|
||||
@@ -32,6 +32,7 @@ ALLOWED_PLATFORMS = {
|
||||
'lock': ['mqtt'],
|
||||
'sensor': ['mqtt'],
|
||||
'switch': ['mqtt'],
|
||||
'climate': ['mqtt'],
|
||||
}
|
||||
|
||||
ALREADY_DISCOVERED = 'mqtt_discovered_components'
|
||||
|
||||
Reference in new issue
Block a user