Mitsubishi AC with Wemos D1 Mini Pro

interesting thanks for explaining that. Can I ask you to post your config please?
I have a separate sensor in the room and want it displayed in Celsius which I have added to the code but not sure if its even remotely correct.

sensor.garage_aq_temperature

Sure, i have a tiny bit more complicated setup, though: i added a switch which allows me to choose from HA either internal or external sensor to be used. So first you must create this switch:

switch:   
  - platform: template
    name: "Used extrenal sensor in garage"     
    id: external_sensor_garage
    optimistic: true
    restore_mode: RESTORE_DEFAULT_ON

Then you import your temperature sensor into esphome and configure so it will send temperature reading into climate:

  - platform: homeassistant
    name: "Garage temperature"
    id: garage_temperature
    internal: true
    device_class: temperature
    unit_of_measurement: "°C"
    entity_id:  sensor.garage_aq_temperature
    on_value:
      then:
        - if:
            condition:
              - switch.is_on:
                  id: external_sensor_garage
            then:
              - lambda: |-
                    if(id(garage_temperature).has_state()) {
                      id(climate_garage).set_remote_temperature(x);
                      ESP_LOGW("temperature", "using XIAOMI sensor %.2f", x);
                    } else {
                      id(climate_garage).set_remote_temperature(0);
                      ESP_LOGW("temperature", "using internal sensor, external not available");
                    }
            else: 
              - lambda: |-
                      id(climate_garage).set_remote_temperature(0);
                      ESP_LOGW("temperature", "using internal sensor");      

It’s a good idea to add “remote_temperature_timeout: 30min” to your climate section. This will ensure that internal sensor will be used after 30 minutes if external is unavailable.

climate:
  - platform: cn105
    id: climate_garage
    name: "Climate garage"
    icon: mdi:heat-pump
    hp_uptime_connection_sensor:
      name: Climate garage HP Uptime
      update_interval: 30s
    visual:
      min_temperature: 15
      max_temperature: 31
      temperature_step:
        target_temperature: 0.5
        current_temperature: 0.1
    vertical_vane_select: # not all climates support this!
      name: Climate garage vertical vane
    horizontal_vane_select: # not all climates support this!
      name: Climate garage horizintal vane
    remote_temperature_timeout: 30min
    debounce_delay : 500ms
    update_interval: 1500ms

Wow thanks for that but I am having trouble understanding it. So I cracked open the Mitsu after flashing the previous config. I have this installed it

So the Mitsu shows 22.5 deg currently in the above pic while the external sensor I added had this in developer tools.
image

So is this the Mitsu showing me its internal temp sensor?

I definitely added it in the config as you can see per my previous post and I dont see it anywhere. Can you see any issues with my previous post? Asking as not sure what the Mitsu did with that one…

Also if I add your code I assume I can see this switch in the config but is this what the Mitsu will use as the target naturally?

You can temporarily set “internal: false” for your homeassistant sensor, so you’ll see if temperautre value will show up (it should show same value as your external temperature sensor). If it does, then climate should use external temperature, which is set with lambda command “id(climate_garage).set_remote_temperature(x);”. If you want to go back to internal just send zero value with this command: “id(climate_garage).set_remote_temperature(0)”.

Note that this command is only executed when temperature sensor changes value, so it may take time.

Since there are two options for using remote temperature (one is explained above, other one is to use services via HA) perhaps you read original Geoff Davis’s page, where it’s a bit better explained: https://github.com/geoffdavis/esphome-mitsubishiheatpump
search under “Remote temperature”.

Hmm I think I understand what you are saying but unsure where everything is meant to be shown.

For eg this is my current state

current config

esphome:
  name: garage-ac
  friendly_name: Garage AC

esp8266:
  board: esp01_1m

# Enable logging
logger:
  hardware_uart: UART1
  level: INFO
  logs:
    EVT_SETS : INFO
    WIFI : INFO
    MQTT : INFO
    WRITE_SETTINGS : INFO
    SETTINGS : INFO
    STATUS : INFO
    CN105Climate: WARN
    CN105: INFO
    climate: WARN
    sensor: WARN
    chkSum : INFO
    WRITE : WARN
    READ : WARN
    Header: INFO
    Decoder : INFO
    CONTROL_WANTED_SETTINGS: INFO
#  level: DEBUG
#  logs:
#    EVT_SETS : DEBUG
#    WIFI : INFO
#    MQTT : INFO
#    WRITE_SETTINGS : DEBUG
#    SETTINGS : DEBUG
#    STATUS : INFO
#    CN105Climate: WARN
#    CN105: DEBUG
#    climate: WARN
#    sensor: WARN
#    chkSum : INFO
#    WRITE : WARN
#    READ : WARN
#    Header: INFO
#    Decoder : DEBUG
#    CONTROL_WANTED_SETTINGS: DEBUG

# Enable Home Assistant API
api:
  encryption:
    key: "removed"
  services:
    - service: set_remote_temperature
      variables:
        temperature: float
      then:
# Select between the C version and the F version
# Uncomment just ONE of the below lines. The top receives the temperature value in C,
# the bottom receives the value in F, converting to C here.
        - lambda: 'id(hp).set_remote_temperature(temperature);'
#        - lambda: 'id(hp).set_remote_temperature((temperature - 32.0) * (5.0 / 9.0));'
    - service: use_internal_temperature
      then:
        - lambda: 'id(hp).set_remote_temperature(0);'

ota:
  - platform: esphome
    password: "removed"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Garage-Ac Fallback Hotspot"
    password: "removed"

captive_portal:

# Enable Web server.
web_server:
  port: 80

  # Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time
    
text_sensor:
  - platform: wifi_info
    ip_address:
      name: "garage-ac IP Address"
 
binary_sensor:
  - platform: status
    name: "garage-ac Connect"

uart:
  id: HP_UART
  baud_rate: 2400
  tx_pin: 1
  rx_pin: 3

# external_components:
#   - source: github://geoffdavis/esphome-mitsubishiheatpump

# External component reference
external_components:
  - source: github://echavet/MitsubishiCN105ESPHome

# Climate entity configuration
climate:
  - platform: cn105
    id: hp
    name: Garage AC
    icon: mdi:heat-pump
    visual:
      min_temperature: 15
      max_temperature: 31
      temperature_step:
        target_temperature: 1
        current_temperature: 0.1
    outside_air_temperature_sensor:
      name: garage-ac Outside Air Temperature
    vertical_vane_select:
      name: garage-ac Vertical Vane
    horizontal_vane_select:
      name: garage-ac Horizontal Vane
    isee_sensor:
      name: garage-ac ISEE Sensor
    remote_temperature_timeout: 30min
    debounce_delay : 500ms
    update_interval: 4s       # update interval can be ajusted after a first run and logs monitoring* 


    stage_sensor:
      name: Stage Sensor
    sub_mode_sensor:
      name: Sub Mode Sensor
    auto_sub_mode_sensor:
      name: Auto Sub Mode Sensor
      
sensor:
  - platform: homeassistant
    name: "garage-ac-Temp"
    id: current_temp
    internal: false
    device_class: temperature
    unit_of_measurement: "°C"
    entity_id: sensor.garage_aq_temperature
    on_value:
      then:
        - lambda: |-
            id(hp).set_remote_temperature(0);

 
  - platform: wifi_signal
    name: "garage-ac WiFi Strength"
    update_interval: 60s
 
  - platform: uptime
    name:  "garage-ac Uptime"

      
switch:
  - platform: restart
    name: "garage-ac reboot"    

# stage_sensor:
#   name: Stage Sensor
# sub_mode_sensor:
#   name: Sub Mode Sensor
# auto_sub_mode_sensor:
#   name: Auto Sub Mode Sensor

So couple of questions
Does it reflect the sensor it is relying on in the climate control?
The 20°C is that the internal temp?
The 15°C outside air temp what is that?
The 22.5°C seems to be sensor.garage_aq_temperature?
Also how do I know which one its taking into account currently if I assume its showing the internal one?

thanks

Your error is here:

    on_value:
      then:
        - lambda: |-
            id(hp).set_remote_temperature(0);

id(hp).set_remote_temperature(0) means command to use internal sensor. For external one you must enter

    on_value:
      then:
        - lambda: |-
            id(hp).set_remote_temperature(x);

note that X instead of zero, which means that you’re sending external temperature value. Entering zero means going back to internal - this is what you’re doing right now.

When current temperature of climate will show the same as your external sensor then you’ll know that climate is using external sensor. Note that it can take time for external temperature to show in HA, since “on_value” part is only executed when temperature in external sensor changes. So, quick test would be to warm it with your hand to force temperature change.

If external sensor will be unavailable for 30 minutes (set by “remote_temperature_timeout” variable) system will automatically go to internal one. I modified that part in my example so system goes to internal immediately when/if sensor is offline (second if—then part of my example - if(id(garage_temperature)…)

Thanks.

I added this now, hope its correct. Wasn’t sure what the %.2f was however

    on_value:
      then:
#         - lambda: |-
#             id(hp).set_remote_temperature(0);
        - if:
            condition:
              - switch.is_on:
                  id: external_sensor_garage
            then:
              - lambda: |-
                    if(id(current_temp).has_state()) {
                      id(hp).set_remote_temperature(x);
                      ESP_LOGW("temperature", "using Aq sensor %.2f", x);
                    } else {
                      id(hp).set_remote_temperature(0);
                      ESP_LOGW("temperature", "using internal sensor, external not available");
                    }
            else: 
              - lambda: |-
                      id(hp).set_remote_temperature(0);
                      ESP_LOGW("temperature", "using internal sensor"); 

temperature resolution (2 decimals). You could change to %.1f (1 decimal). I’m not sure why i left to 2 digits; leftover from testing, i guess… it doesn’t harm, though.

1 Like