Last active
July 10, 2024 12:55
-
-
Save kmdm/29f740e5f36036fb23daba8f2109c359 to your computer and use it in GitHub Desktop.
Home assistant and Mitsubishi via https://github.com/SwiCago/HeatPump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 %} |
Am i mistaken in that current HASS versions don’t allow wildcards in MQTT triggers anymore? For a single AC, it’s feasible to add triggers for the precise individual heatpump/<device>/_set/<parameter>
topics, but for larger deployments this will likely be too arduous. Does anyone have a nicer idea for a fix?
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.
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
Thanks for this. I've got it going again which is great. Haven't had it working since compatibility broke last year sometime. Seems to be a lot of lag that wasn't there with the custom component. Not sure where that's coming from, but not a big issue. I also made some slight modifications to remove the "room" part of the topic so I didn't have to update my sketch.
I know this was a while back, but I'd say that you might need to adjust the "max_temp" config option in the MQTT HVAC integration. The default seems to be 35 which you can check in the developers -> states section.