MQTT HVAC


The mqtt climate platform lets you control your MQTT enabled HVAC devices.

Configuration

To enable this climate platform in your installation, first add the following to your configuration.yaml file:

# Example configuration.yaml entry
climate:
  - platform: mqtt

Configuration Variables

action_templatetemplate(Optional)

A template to render the value received on the action_topic with.

action_topicstring(Optional)

The MQTT topic to subscribe for changes of the current action. If this is set, the climate graph uses the value received as data source. Valid values: off, heating, cooling, drying, idle, fan.

aux_command_topicstring(Optional)

The MQTT topic to publish commands to switch auxiliary heat.

aux_state_templatetemplate(Optional)

A template to render the value received on the aux_state_topic with.

aux_state_topicstring(Optional)

The MQTT topic to subscribe for changes of the auxiliary heat mode. If this is not set, the auxiliary heat mode works in optimistic mode (see below).

availabilitylist(Optional)

A list of MQTT topics subscribed to receive availability (online/offline) updates. Must not be used together with availability_topic.

payload_availablestring(Optional, default: online)

The payload that represents the available state.

payload_not_availablestring(Optional, default: offline)

The payload that represents the unavailable state.

topicstringRequired

An MQTT topic subscribed to receive availability (online/offline) updates.

availability_topicstring(Optional)

The MQTT topic subscribed to receive availability (online/offline) updates. Must not be used together with availability.

away_mode_command_topicstring(Optional)

The MQTT topic to publish commands to change the away mode.

away_mode_state_templatetemplate(Optional)

A template to render the value received on the away_mode_state_topic with.

away_mode_state_topicstring(Optional)

The MQTT topic to subscribe for changes of the HVAC away mode. If this is not set, the away mode works in optimistic mode (see below).

current_temperature_templatetemplate(Optional)

A template with which the value received on current_temperature_topic will be rendered.

current_temperature_topicstring(Optional)

The MQTT topic on which to listen for the current temperature.

devicemap(Optional)

Information about the device this HVAC device is a part of to tie it into the device registry. Only works through MQTT discovery and when unique_id is set.

connectionslist(Optional)

A list of connections of the device to the outside world as a list of tuples [connection_type, connection_identifier]. For example the MAC address of a network interface: "connections": [["mac", "02:5b:26:a8:dc:12"]].

identifierslist | string(Optional)

A list of IDs that uniquely identify the device. For example a serial number.

manufacturerstring(Optional)

The manufacturer of the device.

modelstring(Optional)

The model of the device.

namestring(Optional)

The name of the device.

sw_versionstring(Optional)

The firmware version of the device.

via_devicestring(Optional)

Identifier of a device that routes messages between this device and Home Assistant. Examples of such devices are hubs, or parent devices of a sub-device. This is used to show device topology in Home Assistant.

fan_mode_command_topicstring(Optional)

The MQTT topic to publish commands to change the fan mode.

fan_mode_state_templatetemplate(Optional)

A template to render the value received on the fan_mode_state_topic with.

fan_mode_state_topicstring(Optional)

The MQTT topic to subscribe for changes of the HVAC fan mode. If this is not set, the fan mode works in optimistic mode (see below).

fan_modeslist(Optional)

A list of supported fan modes.

Default:

[“auto”, “low”, “medium”, “high”]

hold_command_topicstring(Optional)

The MQTT topic to publish commands to change the hold mode.

hold_state_templatetemplate(Optional)

A template to render the value received on the hold_state_topic with.

hold_state_topicstring(Optional)

The MQTT topic to subscribe for changes of the HVAC hold mode. If this is not set, the hold mode works in optimistic mode (see below).

hold_modeslist(Optional)

A list of available hold modes.

initialinteger(Optional, default: 21)

Set the initial target temperature.

json_attributes_templatetemplate(Optional)

Defines a template to extract the JSON dictionary from messages received on the json_attributes_topic. Usage example can be found in MQTT sensor documentation.

json_attributes_topicstring(Optional)

The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. Usage example can be found in MQTT sensor documentation.

max_tempfloat(Optional)

Maximum set point available.

min_tempfloat(Optional)

Minimum set point available.

mode_command_topicstring(Optional)

The MQTT topic to publish commands to change the HVAC operation mode.

mode_state_templatetemplate(Optional)

A template to render the value received on the mode_state_topic with.

mode_state_topicstring(Optional)

The MQTT topic to subscribe for changes of the HVAC operation mode. If this is not set, the operation mode works in optimistic mode (see below).

modeslist(Optional)

A list of supported modes. Needs to be a subset of the default values.

Default:

[“auto”, “off”, “cool”, “heat”, “dry”, “fan_only”]

namestring(Optional, default: MQTT HVAC)

The name of the HVAC.

payload_availablestring(Optional, default: online)

The payload that represents the available state.

payload_not_availablestring(Optional, default: offline)

The payload that represents the unavailable state.

payload_offstring(Optional, default: OFF)

The payload that represents disabled state.

payload_onstring(Optional, default: ON)

The payload that represents enabled state.

power_command_topicstring(Optional)

The MQTT topic to publish commands to change the power state. This is useful if your device has a separate power toggle in addition to mode.

precisionfloat(Optional)

The desired precision for this device. Can be used to match your actual thermostat’s precision. Supported values are 0.1, 0.5 and 1.0.

Default:

0.1 for Celsius and 1.0 for Fahrenheit.

qosinteger(Optional, default: 0)

The maximum QoS level to be used when receiving and publishing messages.

retainboolean(Optional, default: false)

Defines if published messages should have the retain flag set.

send_if_offboolean(Optional, default: true)

Set to false to suppress sending of all MQTT messages when the current mode is Off.

swing_mode_command_topicstring(Optional)

The MQTT topic to publish commands to change the swing mode.

swing_mode_state_templatetemplate(Optional)

A template to render the value received on the swing_mode_state_topic with.

swing_mode_state_topicstring(Optional)

The MQTT topic to subscribe for changes of the HVAC swing mode. If this is not set, the swing mode works in optimistic mode (see below).

swing_modeslist(Optional, default: [“on”, “off”])

A list of supported swing modes.

temperature_command_topicstring(Optional)

The MQTT topic to publish commands to change the target temperature.

temperature_high_command_topicstring(Optional)

The MQTT topic to publish commands to change the high target temperature.

temperature_high_state_templatetemplate(Optional)

A template to render the value received on the temperature_high_state_topic with.

temperature_high_state_topicstring(Optional)

The MQTT topic to subscribe for changes in the target high temperature. If this is not set, the target high temperature works in optimistic mode (see below).

temperature_low_command_topicstring(Optional)

The MQTT topic to publish commands to change the target low temperature.

temperature_low_state_templatetemplate(Optional)

A template to render the value received on the temperature_low_state_topic with.

temperature_low_state_topicstring(Optional)

The MQTT topic to subscribe for changes in the target low temperature. If this is not set, the target low temperature works in optimistic mode (see below).

temperature_state_templatetemplate(Optional)

A template to render the value received on the temperature_state_topic with.

temperature_state_topicstring(Optional)

The MQTT topic to subscribe for changes in the target temperature. If this is not set, the target temperature works in optimistic mode (see below).

temperature_unitstring(Optional)

Defines the temperature unit of the device, C or F. If this is not set, the temperature unit is set to the system temperature unit.

temp_stepfloat(Optional, default: 1)

Step size for temperature set point.

unique_idstring(Optional)

An ID that uniquely identifies this HVAC device. If two HVAC devices have the same unique ID, Home Assistant will raise an exception.

value_templatetemplate(Optional)

Default template to render the payloads on all *_state_topics with.

Optimistic mode

If a property works in optimistic mode (when the corresponding state topic is not set), Home Assistant will assume that any state changes published to the command topics did work and change the internal state of the entity immediately after publishing to the command topic. If it does not work in optimistic mode, the internal state of the entity is only updated when the requested update is confirmed by the device through the state topic.

Using Templates

For all *_state_topics, a template can be specified that will be used to render the incoming payloads on these topics. Also, a default template that applies to all state topis can be specified as value_template. This can be useful if you received payloads are e.g., in JSON format. Since in JSON, a quoted string (e.g., "foo") is just a string, this can also be used for unquoting.

Say you receive the operation mode "auto" via your mode_state_topic, but the mode is actually called just auto, here’s what you could do:

climate:
  - platform: mqtt
    name: Study
    modes:
      - "off"
      - "heat"
      - "auto"
    mode_command_topic: "study/ac/mode/set"
    mode_state_topic: "study/ac/mode/state"
    mode_state_template: "{{ value_json }}"

This will parse the incoming "auto" as JSON, resulting in auto. Obviously, in this case you could also just set value_template: "{{ value_json }}".

Example

A full configuration example looks like the one below.

# Full example configuration.yaml entry
climate:
  - platform: mqtt
    name: Study
    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"
    precision: 1.0