Last active
December 10, 2022 17:50
-
-
Save toddq/724d66f5bffda93ef00c52ac259f3102 to your computer and use it in GitHub Desktop.
ESPHome configuration for using Ecobee thermostat with Mitsubishi 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
substitutions: | |
name: mitsubishihp | |
friendly_name: Mitsubishi Heatpump | |
esphome: | |
name: ${name} | |
platform: ESP8266 | |
board: esp01_1m | |
external_components: | |
- source: github://geoffdavis/esphome-mitsubishiheatpump | |
refresh: 365 days | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
manual_ip: | |
static_ip: 192.168.0.25 | |
gateway: 192.168.0.1 | |
subnet: 255.255.255.0 | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "${friendly_name}" | |
password: !secret fallback_password | |
captive_portal: | |
logger: | |
# ESP8266 only - disable serial port logging, as the HeatPump component | |
# needs the sole hardware UART on the ESP8266 | |
baud_rate: 0 | |
# Enable Home Assistant API | |
api: | |
ota: | |
# Enable Web server. | |
web_server: | |
port: 80 | |
# Sync time with Home Assistant. | |
time: | |
- platform: homeassistant | |
id: homeassistant_time | |
globals: | |
# if mode changed to FAN_ONLY, store previous mode for returning to | |
# Ecobee doesn't treat fan as a separate mode the same way hp does | |
- id: previous_mode | |
type: climate::ClimateMode | |
restore_value: no | |
# Text sensors with general information. | |
text_sensor: | |
# Expose ESPHome version as sensor. | |
- platform: version | |
name: ${name} ESPHome Version | |
# Expose WiFi information as sensors. | |
- platform: wifi_info | |
ip_address: | |
name: ${name} IP | |
ssid: | |
name: ${name} SSID | |
bssid: | |
name: ${name} BSSID | |
# when thermostat mode changes, update heatpump mode | |
- platform: homeassistant | |
name: "Ecobee Mode" | |
entity_id: climate.ecobee_homekit | |
on_value: | |
then: | |
- lambda: |- | |
auto call = id(${name}).make_call(); | |
if (x.compare("cool") == 0) { | |
call.set_mode(climate::CLIMATE_MODE_COOL); | |
} else if (x.compare("heat") == 0) { | |
call.set_mode(climate::CLIMATE_MODE_HEAT); | |
} else if (x.compare("heat_cool") == 0) { | |
call.set_mode(climate::CLIMATE_MODE_HEAT_COOL); | |
} else if (x.compare("off") == 0) { | |
call.set_mode(climate::CLIMATE_MODE_OFF); | |
} | |
call.perform(); | |
# Ecobee doesn't have a fan mode that's a peer to heat/cool. But you can change fan setting between on/auto. When | |
# it is changed to 'on', put heatpump in fan_only mode, then restore previous mode if changed back to 'auto'. | |
- platform: homeassistant | |
name: "Ecobee Fan Mode" | |
entity_id: climate.ecobee_homekit | |
attribute: fan_mode | |
on_value: | |
then: | |
- lambda: |- | |
auto call = id(${name}).make_call(); | |
if (x.compare("on") == 0) { | |
id(previous_mode) = id(${name}).mode; | |
call.set_mode(climate::CLIMATE_MODE_FAN_ONLY); | |
} else { | |
call.set_mode(id(previous_mode)); | |
} | |
call.perform(); | |
# logging | |
# ESP_LOGD(TAG, "%s: %d", id(my_global_string), id(my_global_int)); | |
climate: | |
- platform: mitsubishi_heatpump | |
id: "${name}" | |
name: "${friendly_name}" | |
hardware_uart: UART0 | |
supports: | |
mode: [COOL, HEAT, FAN_ONLY] | |
fan_mode: [AUTO, LOW, MEDIUM, HIGH] | |
swing_mode: ['OFF'] | |
visual: | |
min_temperature: 10 | |
max_temperature: 32 | |
temperature_step: 0.25 | |
sensor: | |
# Uptime sensor. | |
- platform: uptime | |
name: ${name} Uptime | |
# WiFi Signal sensor. | |
- platform: wifi_signal | |
name: ${name} WiFi Signal | |
update_interval: 60s | |
# track the amount the heatpump compressor is running | |
- platform: custom | |
lambda: |- | |
auto hp = id(${name}); | |
return {hp->compressorFrequency}; | |
sensors: | |
- name: "${name} Compressor Frequency" | |
# when the home temperature changes, tell the heatpump | |
- platform: homeassistant | |
name: "Home Temperature Sensor" | |
id: home_temperature | |
entity_id: sensor.home_temperature_avg | |
on_value: | |
then: | |
- lambda: id(${name}).set_remote_temperature((x - 32) / 1.8); | |
# when the thermostat setpoint changes, tell the heatpump | |
- platform: homeassistant | |
name: "Ecobee Setpoint" | |
entity_id: climate.ecobee_homekit | |
attribute: temperature | |
on_value: | |
then: | |
- lambda: |- | |
auto call = id(${name}).make_call(); | |
call.set_target_temperature((x - 32) / 1.8); | |
call.perform(); | |
# the heatpump seems to fall back on it's internal temp sensor if it doesn't get frequent | |
# enough updates from an external one, so send it more often than just on change | |
interval: | |
- interval: 20sec | |
then: | |
- lambda: id(${name}).set_remote_temperature((id(home_temperature).state - 32) / 1.8); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment