The storm before the break – HA and Air Conditioning

Thermostat

I just had some root canal work done and it didn’t go too well (understatement – I currently look like the original Godfather). We’re off for a few days break this coming week so I planned on doing nothing at all until then – but life doesn’t work like that. My friend Antonio (Mr Shark) got me all fired up about bringing my original IR-controlled, WiFi-free inexpensive reversible air-conditioner into the 21st century.

Well, didn’t I waste 2 days with an ESP-based IR receiver and transmitter board and some ESPHOME work cobbling together the ability to control my aircon from Home Assistant – good – but hard work and not that special.

I learned how to use the ESPHOME code to read endless IR codes into the ESPHOME code – and also discovered just how complicated that can be. My up/down buttons on the IR remote actually send out a code for every degree of temperature within the device’s range (17-30 in my case) – and so much more – all needing hand-pasting into a program. It was only then that Antonio told me exactly what he’d used at home and why: Tasmota-IR and an HA thermostat plug-in…

The end result of several hours of learning was firstly to make use of a standard variation on the wonderful Tasmota package on any old Wemos ESP8266, with Tasmota’s recommended IR receiver (3 pin module, dirt cheap) and IR LED (2 pins – dirt cheap). Using the web installer for Tasmota-IR, I put the code into my board (the Wemos, IR Receiver and IR LED come to a total of less than 5 euros from AliExpress) and then started firing my original IR remote at the board IR Receiver, watching the result on the Tasmota console. Nice, clean output – or maybe I was just lucky – I don’t know.

It is easy to add in MQTT to Tasmota (client) and that’s a must as that’s how the HA integration talks to the IR board. This integration below is one you must add as a custom repo to HACS using the link below then search in HACS for it – see link…

Though my erversible aircon is not a brand most of us will recognise and definitely not up-market – having only a simple IR control, they do use one of a few standards for their IR control.

Antonio then pointed me to this integration for Home Assistant wherein the guy even tells you all about the IR setup for a generic ESP8266 board (not new info but really helpful). I added the integration to HA, created and edited a climate.yaml file before adding “climate: !include climate.yaml” (no quotes) to my Home Assistant configuration.yaml file (carefully) – I’ll include here the content of the climate.yaml file (couryesy of Antonio who did mods for his system hence the Italian sounding entities – the only editing that is needed is to give the HA entity for your Tasmota IR board, same for your room temperature sensor and a couple of other documented (in the code below) changes including which IR command code type your aircon uses.

- platform: tasmota_irhvac
  unique_id: 179911f7-50a7-4c69-9ef5-a39ff2c459f3
  name: "Condizionatore"
  command_topic: "cmnd/WemosIR/irhvac"
  # command_topic: "cmnd/INFRARED/irhvac"
  # Pick one of the following:
  # State is updated when the tasmota device receives an IR signal (includes own transmission and original remote)
  # useful when a normal remote is in use alongside the tasmota device, may be less reliable than the second option.
  state_topic: "tele/WemosIR/RESULT"
  state_topic_2: "stat/INFRARED/RESULT"
  # State is updated when the tasmota device completes IR transmissionm, should be pretty reliable.
  #state_topic: "stat/your_tasmota_device/RESULT"
  # Uncomment if your 'available topic' of Tasmota IR device are different (if device in HA is disabled)
  availability_topic: "tele/INFRARED/LWT"
  temperature_sensor: sensor.cicciottondo_temperature
  humidity_sensor: sensor.cicciottondo_humidity #optional - default None
  power_sensor: binary_sensor.shp5_condizionatore_status # binary_sensor.kitchen_ac_power #optional - default None
  vendor: "COOLIX"
  # When operating grouped devices at the same time, MQTT commands are intentionally delayed to prevent multiple devices
  # from performing the same operation at the same time. This allows the high current peaks to be shifted.
  mqtt_delay: 0.0 #optional - default 0 int or 0.0 float value in [sec].
  min_temp: 17 #optional - default 16 int value
  max_temp: 30 #optional - default 32 int value
  target_temp: 26 #optional - default 26 int value
  initial_operation_mode: "off" # optional - default "off" string value (one of the "supported_modes")
  away_temp: 24 #optional - default 24 int value
  precision: 1 #optional - default 1 int or float value. Can be set to 1, 0.5 or 0.1
  supported_modes:
    - "heat"
    - "cool"
    - "dry"
    - "fan_only" # Use "fan_only" even if Tasmota shows "Mode":"Fan"
    - "auto"
    - "off" #Turns the AC off - Should be in quotes
    # Some devices have "auto" and "fan_only" switched
    # If the following two lines are uncommented, "auto" and "fan" shoud be commented out
    #- "auto_fan_only" #if remote shows fan but tasmota says auto
    #- "fan_only_auto" #if remote shows auto but tasmota says fan
  supported_fan_speeds:
    # Some devices say max,but it is high, and auto which is max
    # If you uncomment the following two, you have to comment high and max
    # - "auto_max" #woud become max
    # - "max_high" #would become high
    #- "on"
    #- "off"
    #- "low"
    # - "high"
    #- "middle"
    #- "focus"
    #- "diffuse"
    - "min"
    - "medium"
    - "max"
    - "auto"
  supported_swing_list:
    - "off"
    - "vertical" #up to down
    # - "horizontal" # Left to right
    # - "both"
  default_quiet_mode: "Off" #optional - default "Off" string value
  default_turbo_mode: "Off" #optional - default "Off" string value
  default_econo_mode: "Off" #optional - default "Off" string value
  hvac_model: "-1" #optional - default "1" string value
  celsius_mode: "On" #optional - default "On" string value
  default_light_mode: "Off" #optional - default "Off" string value
  default_filter_mode: "Off" #optional - default "Off" string value
  default_clean_mode: "Off" #optional - default "Off" string value
  default_beep_mode: "Off" #optional - default "Off" string value
  default_sleep_mode: "-1" #optional - default "-1" string value
  default_swingv: "high" #optional - default "" string value
  default_swingh: "left" #optional - default "" string value
  keep_mode_when_off: True #optional - default False boolean value : Must be True for MITSUBISHI_AC, ECOCLIM, etc.
  toggle_list:
    # The toggled property is a setting that does not retain the On state. Optional - default []
    # Set this if your AC properties are toggle function.
    #- Beep
    #- Clean
    #- Econo
    #- Filter
    #- Light
    #- Quiet
    #- Sleep
    #- SwingH
    #- SwingV
    #- Turbo
  # When turning off some devices with their remote control they are set to the lowest temperature
  # and this is shown on the thermostat card. Setting `ignore_off_temp` value to True will keep the last target temperature displayed on the card.
  ignore_off_temp: True #optional - default False boolean value

To know if the device is turned on from HA even if using the original aircon IR remote, we added a power metering plug between the mains and the aircon, and left it always turned on (as it needs to check the aircon power consumption to report back)

The next job after restarting HA was to add a new card into the HA dashboard and enter thermostat device climate.aircon

As the integration allows for only the use of a binary sensor in HA to monitor power, and not directly a power entity, it is necessary to create a binary sensor for this: In HA settings, integrations, helpers, add a new template helper of type binary sensor, name it as required, and in the template field add this (change the sensor entity to the real one of YOUR own power metering plug as I did):

{{ states('sensor.shp5_smartplug_energy_power') | float > 20 }}

This will report ON or OFF if power consumption is above 20W… this is needed because an aircon can consume a bit of power even if turned off, so we found we could NOT put 0 in there…

With the just-created binary sensor in the above climate.yaml file, where it talks about power_sensor we were about ready to go and once again restarted HA.

Image

I left the IR receiver attached to the Tasmota-IR board (not essential but they cost almost nothing from AliExpress), so that the card could reflect the aircon status even if using the original IR remote (if you go down this route, be sure the Tasmota device is in front of your aircon, to intercept the remote blaster – AND to get a clear IR signal into the aircon to do it’s own control via HA).

And with that, now – in my HA front panel, jammed in with all my other controls, I’ve gone from simple on-off remote (via smart plug) of my aircon to full remote control via my phone and PC – fan speed, mode, desired temperature in both heating and cooling modes and much more for almost no cost (of course this all assumes having Home Assistant running 24/7 on some device, as I do – Raspberry Pi 5 in my case).

HA Aircon

Read elsewhere in the Blog about my attempts over the years to have proper remote heating control – search “thermostat” for my various attempts including writing code and building hardware from scratch – all of which are insignificant compared to THIS….

The aircon controller is that block on the left – completely re-sizeable of course. Boring looking when off – but lights up when active…

And below – the expanded on-a-click version… (after selecting COOL mode) – courtesy of the reversible aircon unit we purchased a few years ago at a local store in Spain – 550 Euros fitted and it has kept my office cool in summer and warm in winter – no problem – and now – up to date remote controls AT LAST.

HA Aircon

And another click on that graph icon top right above..

HA Aircon

This kept my mind off the toothache for hours AND IT WORKS… for the sake of it here’s a shot in heat mode..

HA Aircon

I have to hand it to Antonio, it looks like he’s selected a winner here… the front end is easily customised.

In the HA thermostat card you see on the left, the buttons are a feature you select or not in the ADD FEATURES section on the card setup.

What’s really great about setups like this as against off-the shelf remote control panels – aside from the vast difference in cost, no “phone home” to foreign servers, no cloud costs, no having dumb room sensors sitting right next to the aircon or inside a radiator etc.

I have an (accurate) DS18B20-based room temperature sensor positioned exactly where it should be – the opposite side of the room to the heat/cool source…..

And now- briefly, for my lesser-used UK residence we have oil-powered heating – and on the wall is a bog-standard, non-remote, LCD thermostat (old – and with a cover that keeps dropping off anyway). I’ll be heading back there soon, for now, I ordered and have received a cheap AliExpress (sub-20 Euros) LCD TUYA Zigbee thermostat to take with me. Using three AA batteries and claiming very low standby current, the stat looks ok… and mounts on a wall with 2 mounting holes or tape – it also has an uncommited contact pair to work with any heating system.

Here it is: a tad under 30mm thick and around 85mm square.. the unit claims to need a TUYA hub to work but as we see more and more, works perfectly with Zigbee2MQTT. The unit is sensible and has features including FROST control and an AWAY mode. ZWT198/ZWT100-BH

Importantly, when I took the same thermostat tile in HA and applied it to this unit though I’ve not fully completed integration, it basically works as my Spanish unit above… and so on my phone and PC Home Assistant, I now have TWO thermostats…

HA thermostat

Note: Early days and I’ve yet to get the FROST setting to actually DO something to the actual stat but the FROST setting along with others appeared automatically in HA as entities so I’m sure it will… give me time.. interesting that the stat manufacturer choses to make the ACTUAL room temperature large while the HA stat designer makes the SET temperature large… hmmm.

No doubt I can manupulate the latter if need be. The flexibility of recent versions of HA have become truly remarkable – colours, sizes etc. Great fun.

One thought on “The storm before the break – HA and Air Conditioning

Leave a Reply

Your email address will not be published. Required fields are marked *

Leave the field below empty!


The maximum upload file size: 512 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here