From 8d7595c261df72dca8008696171fe3713f0f64ef Mon Sep 17 00:00:00 2001 From: "Nathan J. Williams" Date: Fri, 14 Jul 2023 16:51:28 -0400 Subject: [PATCH 1/5] Don't printf() a std::optional, that doesn't work right. --- components/mitsubishi_heatpump/espmhp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mitsubishi_heatpump/espmhp.cpp b/components/mitsubishi_heatpump/espmhp.cpp index 02223a1..e1c5bf8 100644 --- a/components/mitsubishi_heatpump/espmhp.cpp +++ b/components/mitsubishi_heatpump/espmhp.cpp @@ -328,7 +328,7 @@ void MitsubishiHeatPump::hpSettingsChanged() { } else { //case "AUTO" or default: this->fan_mode = climate::CLIMATE_FAN_AUTO; } - ESP_LOGI(TAG, "Fan mode is: %i", this->fan_mode); + ESP_LOGI(TAG, "Fan mode is: %i", this->fan_mode.value_or(-1)); /* ******** HANDLE MITSUBISHI VANE CHANGES ******** * const char* VANE_MAP[7] = {"AUTO", "1", "2", "3", "4", "5", "SWING"}; From f7e3c43a18c1b37e827f1adaccfa6a0df161c66f Mon Sep 17 00:00:00 2001 From: Will Adler Date: Sat, 15 Jul 2023 18:03:59 -0400 Subject: [PATCH 2/5] edit README note on baud rate --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 26c7b82..c11afbd 100644 --- a/README.md +++ b/README.md @@ -354,9 +354,11 @@ climate: * *hardware\_uart* (_Optional_): the hardware UART instance to use for communcation with the heatpump. On ESP8266, only `UART0` is usable. On ESP32, `UART0`, `UART1`, and `UART2` are all valid choices. Default: `UART0` -* *baud\_rate* (_Optional_): Serial BAUD rate used to communicate with the +* *baud\_rate* (_Optional_): Serial baud rate used to communicate with the HeatPump. Most systems use the default value of `4800` baud, but some use - `2400` or `9600`. Some ESP32 boards will require the baud_rate setting if + `2400` or `9600`. Check [here](https://github.com/SwiCago/HeatPump/issues/13) + to find discussion of whether your particular model requires a non-default baud rate. + Some ESP32 boards will require the baud_rate setting if hardware_uart is specified. Default: `4800`. * *rx\_pin* (_Optional_): pin number to use as RX for the specified hardware UART (ESP32 only - ESP8266 hardware UART's pins aren't configurable). From cd984667f3dfb9f2e6daab0a7a33a89012d67036 Mon Sep 17 00:00:00 2001 From: Will Adler Date: Sat, 15 Jul 2023 18:14:10 -0400 Subject: [PATCH 3/5] edit README note on external temperature sensor --- README.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c11afbd..2fc57ea 100644 --- a/README.md +++ b/README.md @@ -388,9 +388,11 @@ climate: It is possible to use an external temperature sensor to tell the heat pump what the room temperature is, rather than relying on its internal temperature -sensor. You can do this by calling `set_remote_temperature(float temp)` on the -`mitsubishi_heatpump` object in a lambda. Note that you can call -`set_remote_temperature(0)` to switch back to the internal temperature sensor. +sensor. This is helpful if you want to make sure that a particular room, or part +of the room, reaches the desired temperature—rather than just the area near the +heat pump or the thermostat. You can do this by calling `set_remote_temperature(float temp)` +on the `mitsubishi_heatpump` object in a lambda. (If needed, you can call +`set_remote_temperature(0)` to switch back to the internal temperature sensor.) There are several ways you could make use of this functionality. One is to use a sensor automation: @@ -402,7 +404,7 @@ climate: id: hp sensor: - # You could use a Bluetooth temperature sensor + # You could use a Bluetooth temperature sensor as the source... - platform: atc_mithermometer mac_address: "XX:XX:XX:XX:XX:XX" temperature: @@ -411,7 +413,7 @@ sensor: then: - lambda: 'id(hp).set_remote_temperature(x);' - # Or you could use a HomeAssistant sensor + # ...or you could use a Home Assistant sensor as the source - platform: homeassistant name: "Temperature Sensor From Home Assistant" entity_id: sensor.temperature_sensor @@ -419,10 +421,17 @@ sensor: then: - lambda: 'id(hp).set_remote_temperature(x);' ``` +One issue that you might have here is that, after some amount of time with no update from the +external temperature sensor, the heat pump will revert back to its internal temperature. +You can prevent this by [adding a `heartbeat` filter](https://github.com/geoffdavis/esphome-mitsubishiheatpump/issues/31#issuecomment-1207115352) +to the sensor, which will keep reminding the heat pump of the external sensor value. -Alternatively you could define a +Also, if your external sensor is in Fahrenheit, you will have to [convert the value to Celsius](https://github.com/geoffdavis/esphome-mitsubishiheatpump/issues/31#issuecomment-1207115352). + + +Alternatively, you could define a [service](https://www.esphome.io/components/api.html#user-defined-services) -that HomeAssistant can call: +that Home Assistant can call: ```yaml api: From b92cf5f1ff5a0499cc6a13b4c50960a950ff6288 Mon Sep 17 00:00:00 2001 From: "Nathan J. Williams" Date: Thu, 20 Jul 2023 13:04:10 -0400 Subject: [PATCH 4/5] Fan mode and swing mode are ints, don't try to debug-print them as strings. --- components/mitsubishi_heatpump/espmhp.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mitsubishi_heatpump/espmhp.cpp b/components/mitsubishi_heatpump/espmhp.cpp index e1c5bf8..f7c871d 100644 --- a/components/mitsubishi_heatpump/espmhp.cpp +++ b/components/mitsubishi_heatpump/espmhp.cpp @@ -182,7 +182,7 @@ void MitsubishiHeatPump::control(const climate::ClimateCall &call) { //const char* FAN_MAP[6] = {"AUTO", "QUIET", "1", "2", "3", "4"}; if (call.get_fan_mode().has_value()) { - ESP_LOGV("control", "Requested fan mode is %s", *call.get_fan_mode()); + ESP_LOGV("control", "Requested fan mode is %d", *call.get_fan_mode()); this->fan_mode = *call.get_fan_mode(); switch(*call.get_fan_mode()) { case climate::CLIMATE_FAN_OFF: @@ -220,7 +220,7 @@ void MitsubishiHeatPump::control(const climate::ClimateCall &call) { //const char* VANE_MAP[7] = {"AUTO", "1", "2", "3", "4", "5", "SWING"}; if (call.get_swing_mode().has_value()) { - ESP_LOGV(TAG, "control - requested swing mode is %s", + ESP_LOGD(TAG, "control - requested swing mode is %d", *call.get_swing_mode()); this->swing_mode = *call.get_swing_mode(); From 6309f9ec54b01780ec0a07ecb1c87d8a60403c78 Mon Sep 17 00:00:00 2001 From: Geoff Davis Date: Fri, 13 Oct 2023 13:59:04 -0700 Subject: [PATCH 5/5] Fix README indentation Bulleted lists were misaligned, and syntax was wrong. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8380a6d..2db7556 100644 --- a/README.md +++ b/README.md @@ -377,11 +377,11 @@ climate: component polls the heatpump hardware, in milliseconds. Maximum usable value is 9 seconds due to underlying issues with the HeatPump library. Default: 500ms * `supports` (_Optional_): Supported features for the device. - ** `mode` (_Optional_, list): Supported climate modes for the HeatPump. Default: + * `mode` (_Optional_, list): Supported climate modes for the HeatPump. Default: `['HEAT_COOL', 'COOL', 'HEAT', 'DRY', 'FAN_ONLY']` - ** `fan_mode` (_Optional_, list): Supported fan speeds for the HeatPump. + * `fan_mode` (_Optional_, list): Supported fan speeds for the HeatPump. Default: `['AUTO', 'DIFFUSE', 'LOW', 'MEDIUM', 'MIDDLE', 'HIGH']` - ** `swing_mode` (_Optional_, list): Supported fan swing modes. Most Mitsubishi + * `swing_mode` (_Optional_, list): Supported fan swing modes. Most Mitsubishi units only support the default. Default: `['OFF', 'VERTICAL']` * `remote_temperature_operating_timeout_minutes` (_Optional_): The number of minutes before a set_remote_temperature request becomes stale, while the