Platform Home Assistant "MQTT HVAC" (Heating, Ventilation and Air Conditioning)

7 minutes of reading
Proconductor: Home Assistant Community
Availability: included in thepersonale HUB Home Assistant
Category: software
Type: platform Home Assistant
Family: component "Climate” Home Assistant
Implementation difficulties: half

The "MQTT HVAC" platform (Heating, Ventilation and Air Conditioning, ie heating, ventilation and conditioningnamento), daughter of the component "Climate”, serves to define of the entity control useful, appanointed, to manage through Home Assistant heating and / or ventilation and / or conditionnamento starting from devices that can be controlled by proProtocol MQTT.

Nb This component It is not suitable for the integration of devices / actuators which, although they support proMQTT tocollo, do not have available a profirst intelligence pro-ownership for climate management (eg simple MQTT switches, such as theITEAD Sonoff Basic). In practice, this component is used ONLY to integrate on Home Assistant of MQTT thermostats.

An alternative platform - for MQTT devices connected to a thermal unit but which do NOT have one propria intelligence related to climate management - is theGeneric Thermostat" An example of this type of implementation is given by prodomotization jet of an autonomous heating through clean contact.

Devices that can be managed through the platform MQTT HVAC may be different.
For example:

  • thermostats or electronic included on board of the boiler / heat pump / air conditioner that natively support MQTT;
  • a software interface (Eg. Node-RED) That yes frapponga between the MQTT HVAC platform of Home Assistant and any object downstream, controllable differently.

The first case it is the easiest to understand. The platform configuration sends MQTT commands and receives MQTT telemetry directly from the controlled device.

The second case it is the most sophisticated: what this platform "speaks" (always unconsciously) is no longer a device (be it a thermostat, an intelligent device, an actuator) but with a software which sappia interpret the MQTT commands issued by Home Assistant via the MQTT HVAC platform and translate them into something else.
This "something else"Can be anything. Bringing the case to Node-RED, we could take the concept to extremes by imagining a flow of nodes that, intercepted the ignition command received via MQTT, prosend a text message to a person with the message "Turn on the boiler!"-"Turn off the boiler!". It might seem like a peregrine hypothesis, but it is not. Visas i hundreds of output nodes available for this powerful software, in the real field different techniques could be used to arrive to domotize something that would not be.

This platform works de default in “optimistic mode", or does not receive the states of functionnamevia MQTT topic (so it takes them) and limits you to sending them (commands), to remember the last state set by the user and to receive the temperature of the environment using telemetric topics (which can also come from sources other than the climate-controlled element, eg an ad hoc sensor). This behavior can be varied by adopting the parameters "*_state_topic", As explained below.

tado°  su  Home Assistant
example of entity "Climate"On Home Assistant
Nb To use this platform it is necessary that the "MQTT" component of Home Assistant has been previously configured (see first part of the card dedicated to the "MQTT" component). We also recommend to read carefully the guide dedicated to the theme of configuration of the MQTT components in the profirst home automation.

Configuration

To create aentity climate through this platform the block to be inserted at the configuration "configuration.yaml" di Home Assistant it is basically similar to the following:

climate:
  - platform: mqtt
    name: Salotto
    current_temperature_topic: /sensors/hvac/current_temp
    temperature_command_topic: /sensors/hvac/target_temp

Where the procustomization property I'm:

name(string, optional) - The name of the entity. Default: "MQTT HVAC"
qos(integer, optional) - The QoS level for the state_topic. Default: 0 (What is QoS?)
retain(boolean, optional) - Set the retain on published MQTT messages. Default: false
send_if_off(Boolean, optional) - If set to "false", it suspends the sending of MQTT messages when the entity is in "off" mode. Default: true
initial(decimal, optional) - Set the entity's target temperature. Default: 21 degrees Celsius, 70 fahrenheit.
payload_on(string, optional) - The payload that rappit returns the status "on". Default: "true".
payload_off(string, optional) - The payload that rappresets the status "off". Default: "false".
availability_topic(string, optional) - Topic MQTT to which register to get the status online / offline by the controlled device. Usually the topic is indicated LWT.
payload_available
(string, optional) - The payload that rappit returns the "available" status of the controlled device. Example: "online". It is used in abbinameto the variable "availability_topic". Usually a payload is indicated LWT.
payload_not_available
(string, optional) - The payload that rappit returns the status "not available" by the controlled device. Example: "offline". It is used in abbinameto the variable "availability_topic". Usually a payload is indicated LWT.
value_template
(template, optional) - Defines the template for the extraction (parsing) of data in all payloads "*_state_topic"
current_temperature_topic(string, optional) - Topic MQTT to which register to get the current temperature.
current_temperature_template(template, optional) - Defines the template for the extraction (parsing) of the temperature data from the topic indicated in the "current_temperature_template"
power_command_topic(string, optional) - Topic MQTT published against the switching on / off of the entity.
mode_command_topic(string, optional) - Topic MQTT published against a change of status of the entity.
mode_state_topic(string, optional) - Topic MQTT to which register to get the status of the controlled device. If not set, the entity works in "optimistic mode" (see the table below).
mode_state_template(template, optional) - Defines the template for the extraction (parsing) of the status data from the topic indicated in the "mode_state_topic"
fashion(list | string, optional) - List of available operating modes. Default values: ["auto", "off", "cool", "heat", "dry", "fan_only"]
temperature_command_topic(string, optional) - Topic MQTT published against a target temperature change of the entity.
temperature_state_topic(string, optional) - Topic MQTT to which register to obtain the status of changes in the target temperature of the controlled device. If not set, the entity works in "optimistic mode" (see the table below).
temperature_state_template(template, optional) - Defines the template for the extraction (parsing) of the status data from the topic indicated in the "temperature_state_topic"
fan_mode_command_topic(string, optional) - Topic MQTT published against a change in the entity's ventilation mode.
fan_mode_state_topic(string, optional) - Topic MQTT to which register to get the status of changes in ventilation mode of the controlled device. If not set, the entity works in "optimistic mode" (see the table below).
fan_mode_state_template(template, optional) - Defines the template for the extraction (parsing) of the status data from the topic indicated in the "fan_mode_state_topic"
fan_modes(list | string, optional) - List of available ventilation operating modes. Default values: ["auto", "low", "medium", "high"]
swing_mode_command_topic(string, optional) - Topic MQTT published against a change in the entity's oscillation mode.
swing_mode_state_topic(string, optional) - Topic MQTT to which register to obtain the status of changes in the oscillation mode of the controlled device. If not set, the entity works in "optimistic mode" (see the table below).
swing_mode_state_template(template, optional) - Defines the template for the extraction (parsing) of the status data from the topic indicated in the "swing_mode_state_topic"
swing_modes(list | string, optional) - List of available oscillation operating modes. Default values: [“on”, “off”]
away_mode_command_topic(string, optional) - Topic MQTT published against a change of "away" mode of the entity.
away_mode_state_topic(string, optional) - Topic MQTT to which register to get the status of the changes in the "away" mode of the controlled device. If not set, the entity works in "optimistic mode" (see the table below).
away_mode_state_template(template, optional) - Defines the template for the extraction (parsing) of the status data from the topic indicated in the "away_mode_state_topic"
hold_command_topic(string, optional) - Topic MQTT published against a change of hold mode of the entity.
hold_state_topic(string, optional) - Topic MQTT to which register to obtain the status of changes in the "hold" mode of the controlled device. If not set, the entity works in "optimistic mode" (see the table below).
hold_state_topic_template(template, optional) - Defines the template for the extraction (parsing) of the status data from the topic indicated in the "hold_mode_state_topic"
aux_command_topic(string, optional) - Topic MQTT published against the switching on / off of an auxiliary heating device at the entity.
aux_state_topic(string, optional) - Topic MQTT to which to register to obtain the status of the auxiliary device for the heating of the controlled device. If not set, the entity works in "optimistic mode" (see the table below).
aux_state_template(template, optional) - Defines the template for the extraction (parsing) of the status data from the topic indicated in the "aux_state_topic"
min_temp(decimal, optional) - Defines the minimum target temperature that can be set at the entity.
max_temp(decimal, optional) - Defines the maximum target temperature that can be set at the entity.
OPTIMISTIC MODE

If one proproperty works in "optimistic mode" (ie when the corresponding "state topic" is not set, Home Assistant takes that any change in status of theentity implemented by the user - and therefore the corresponding MQTT publication of topics and payloads related to the variation itself - has been successful at the controlled device, therefore the status of the entity at Home Assistant will take over automatically and immediately the new state.
If instead the "state topic" has been defined, the change in status of the entity it is not changed as long as this topic is relative payload have not been received.

USE OF TEMPLATES

In each "* _state_topic”Can be defined as a template for the extraction (parsing) of the status data. It can also be defined one for all, using the proproperty "value_template". This translates into a great comfort especially when there are payloads written in JSON notation.

Examples

COMPLETE CONFIGURATION

An example of a "type" configuration for an air conditioner compatible with proMQTT tocollo is the following:

climate:
  - platform: mqtt
    name: Salotto
    modes:
      - off
      - cool
      - fan_only
    swing_modes:
      - on
      - off
    fan_modes:
      - high
      - medium
      - low
    power_command_topic: "study/ac/power/set"
    mode_command_topic: "study/ac/mode/set"
    temperature_command_topic: "study/ac/temperature/set"
    fan_mode_command_topic: "study/ac/fan/set"
    swing_mode_command_topic: "study/ac/swing/set"


Home Assistant Official LogoATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Home Assistant, for any doubt, question, information on the specific merit of these components.


Please comment below