MQTT 온습도조절기(MQTT HVAC)


mqtt climate 플랫폼을 사용하면 MQTT 지원 HVAC 장치를 제어 할 수 있습니다.

설정

설치시 이 climate 플랫폼을 활성화하려면 먼저 configuration.yaml 파일에 다음을 추가하십시오.

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

Configuration Variables

name

(string)(Optional)

The name of the HVAC.

Default value:

MQTT HVAC

unique_id

(string)(Optional)

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

qos

(integer)(Optional)

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

Default value:

0

retain

(boolean)(Optional)

Defines if published messages should have the retain flag set.

Default value:

false

send_if_off

(boolean)(Optional)

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

Default value:

true

initial

(integer)(Optional)

Set the initial target temperature.

Default value:

21

payload_on

(string)(Optional)

The payload that represents enabled state.

Default value:

ON

payload_off

(string)(Optional)

The payload that represents disabled state.

Default value:

OFF

availability_topic

(string)(Optional)

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

payload_available

(string)(Optional)

The payload that represents the available state.

Default value:

online

payload_not_available

(string)(Optional)

The payload that represents the unavailable state.

Default value:

offline

value_template

(template)(Optional)

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

current_temperature_topic

(string)(Optional)

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

current_temperature_template

(template)(Optional)

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

power_command_topic

(string)(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.

action_topic

(string)(Optional)

The MQTT topic on which to listen for the current action state of the HVAC. Expects idle, cooling, heating, drying, or off.

action_template

(template)(Optional)

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

mode_command_topic

(string)(Optional)

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

mode_state_topic

(string)(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).

mode_state_template

(template)(Optional)

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

modes

(list)(Optional)

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

Default value:

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

temperature_command_topic

(string)(Optional)

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

temperature_state_topic

(string)(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_state_template

(template)(Optional)

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

temperature_low_command_topic

(string)(Optional)

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

temperature_low_state_topic

(string)(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_low_state_template

(template)(Optional)

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

temperature_high_command_topic

(string)(Optional)

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

temperature_high_state_topic

(string)(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_high_state_template

(template)(Optional)

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

precision

(float)(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 value:

0.1 for Celsius and 1.0 for Fahrenheit.

fan_mode_command_topic

(string)(Optional)

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

fan_mode_state_topic

(string)(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_mode_state_template

(template)(Optional)

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

fan_modes

(list)(Optional)

A list of supported fan modes.

Default value:

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

swing_mode_command_topic

(string)(Optional)

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

swing_mode_state_topic

(string)(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_mode_state_template

(template)(Optional)

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

swing_modes

(list)(Optional)

A list of supported swing modes.

Default value:

[“on”, “off”]

away_mode_command_topic

(string)(Optional)

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

away_mode_state_topic

(string)(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).

away_mode_state_template

(template)(Optional)

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

hold_command_topic

(string)(Optional)

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

hold_state_topic

(string)(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_state_template

(template)(Optional)

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

hold_modes

(list)(Optional)

A list of available hold modes.

aux_command_topic

(string)(Optional)

The MQTT topic to publish commands to switch auxiliary heat.

aux_state_topic

(string)(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).

aux_state_template

(template)(Optional)

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

min_temp

(float)(Optional)

Minimum set point available.

max_temp

(float)(Optional)

Maximum set point available.

temp_step

(float)(Optional)

Step size for temperature set point.

Default value:

1

json_attributes_topic

(string)(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.

json_attributes_template

(template)(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.

device

(map)(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.

identifiers

(list | string)(Optional)

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

connections

(list)(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"]].

manufacturer

(string)(Optional)

The manufacturer of the device.

model

(string)(Optional)

The model of the device.

name

(string)(Optional)

The name of the device.

sw_version

(string)(Optional)

The firmware version of the device.

Optimistic mode

속성이 optimistic mode에서 작동하는 경우 (해당 state topic이 설정되지 않은 경우) 홈어시스턴트는 command topic에 게시된 모든 상태 변경이 작동한 것으로 가정하고 command topic에 게시한 직후 엔티티의 내부 상태를 변경합니다. optimistic mode에서 작동하지 않으면 요청된 업데이트가 state topic를 통해 장치에 의해 확인된 경우에만 엔티티의 내부 상태가 업데이트됩니다.

템플릿 사용하기

모든 *_state_topic의 경우, 이 topic에서 들어오는 페이로드를 렌더링하는데 사용될 템플릿을 지정할 수 있습니다. 또한 모든 state topic에 적용되는 기본 템플릿은 value_template으로 지정할 수 있습니다. 페이로드를 받은 경우 (예: JSON 형식)에 유용합니다. JSON에서 따옴표 붙은 문자열 (예: "foo")은 문자열 일 뿐이므로 따옴표를 없에도 사용할 수 있습니다.

mode_state_topic을 통해 operation 모드 "auto"를 받았지만 실제로 모드는 그냥 auto라고합니다. 여기서 수행할 수 있는 작업은 다음과 같습니다.

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 }}"

들어오는 "auto"를 JSON으로 파싱하여 auto가 됩니다. 분명히 이 경우 value_template: "{{ value_json }}"를 설정할 수도 있습니다.

사례

전체 설정 예는 다음과 같습니다.

# 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