Skip to content

Instantly share code, notes, and snippets.

@kmdm
Last active August 22, 2022 09:30
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmdm/29f740e5f36036fb23daba8f2109c359 to your computer and use it in GitHub Desktop.
Save kmdm/29f740e5f36036fb23daba8f2109c359 to your computer and use it in GitHub Desktop.
Home assistant and Mitsubishi via https://github.com/SwiCago/HeatPump
# Assumes you have a topic structure like: heatpump/<room> and heatpump/<room>/set
# E.g. heatpump/bedroom, heatpump/bedroom/set, heatpump/office, heatpump/office/set
#
# Configure the MQTT HVAC climate platforms (Example for master bedroom, office and nursery. Change to suit.):
climate:
- <<: &mitsu_platform
platform: mqtt
modes:
- "off"
- heat
- dry
- cool
- fan_only
- auto
fan_modes:
- AUTO
- QUIET
- "1"
- "2"
- "3"
- "4"
swing_modes:
- AUTO
- "1"
- "2"
- "3"
- "4"
- "5"
- SWING
current_temperature_template: "{{ value_json.roomTemperature }}"
temperature_state_template: "{{ value_json.temperature }}"
swing_mode_state_template: "{{ value_json.vane }}"
fan_mode_state_template: "{{ value_json.fan }}"
mode_state_template: >
{% if value_json.power == "OFF" %}
off
{% elif value_json.mode == "FAN" %}
fan_only
{% else %}
{{ value_json.mode|lower }}
{% endif %}
- <<: *mitsu_platform
name: "Office A/C"
current_temperature_topic: "heatpump/office/status"
temperature_command_topic: "heatpump/office/_set/temperature"
temperature_state_topic: "heatpump/office"
swing_mode_command_topic: "heatpump/office/_set/vane"
swing_mode_state_topic: "heatpump/office"
fan_mode_command_topic: "heatpump/office/_set/fan"
fan_mode_state_topic: "heatpump/office"
mode_command_topic: "heatpump/office/_set/mode"
mode_state_topic: "heatpump/office"
- <<: *mitsu_platform
name: "Master A/C"
current_temperature_topic: "heatpump/master/status"
temperature_command_topic: "heatpump/master/_set/temperature"
temperature_state_topic: "heatpump/master"
swing_mode_command_topic: "heatpump/master/_set/vane"
swing_mode_state_topic: "heatpump/master"
fan_mode_command_topic: "heatpump/master/_set/fan"
fan_mode_state_topic: "heatpump/master"
mode_command_topic: "heatpump/master/_set/mode"
mode_state_topic: "heatpump/master"
- <<: *mitsu_platform
name: "Nursery A/C"
current_temperature_topic: "heatpump/nursery/status"
temperature_command_topic: "heatpump/nursery/_set/temperature"
temperature_state_topic: "heatpump/nursery"
swing_mode_command_topic: "heatpump/nursery/_set/vane"
swing_mode_state_topic: "heatpump/nursery"
fan_mode_command_topic: "heatpump/nursery/_set/fan"
fan_mode_state_topic: "heatpump/nursery"
mode_command_topic: "heatpump/nursery/_set/mode"
mode_state_topic: "heatpump/nursery"
# MQTT HVAC uses individual command topics but HeatPump does not
# so use an automation to push the commands to the HP (only one automation needed due to wildcards):
alias: 'Redirect all MQTT HVAC set commands to the heatpumps'
trigger:
- platform: mqtt
topic: heatpump/+/_set/+
action:
- service: mqtt.publish
data_template:
topic: '{{ "heatpump/" + trigger.topic.split("/")[1] + "/set" }}'
payload: >
{% if trigger.topic.split("/")[-1] == "mode" %}
{% if trigger.payload|upper == "OFF" %}
{"power":"OFF"}
{% elif trigger.payload == "fan_only" %}
{"power":"ON","mode":"FAN"}
{% else %}
{{ "{\"power\":\"ON\",\"mode\":"|safe + trigger.payload|upper|tojson + "}" }}
{% endif %}
{% else %}
{{ "{" + trigger.topic.split("/")[-1]|tojson + ":" + trigger.payload|tojson + "}" }}
{% endif %}
@kmdm
Copy link
Author

kmdm commented May 2, 2022

I no longer have these units due to moving but if that's the case it sounds more like a regression and I'd open a bug report.

Unless you see an issue/change that says this was intentionally removed/changed.

@kmdm
Copy link
Author

kmdm commented May 2, 2022

If I was to set this up now, I would probably use one of the following which both support the MQTT climate integration natively:

https://github.com/unixko/MitsuCon

https://github.com/geoffdavis/esphome-mitsubishiheatpump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment