Tasmota MQTT IRHVAC Controler

Hi guys! :slight_smile: I’m looking for testers for my new platform, that can control hunderds of Air Conditioners, out of the box, via Tasmota IR transceivers. It is based on the latest “tasmota-ircustom.bin” v8.1. I’m looking for testers, because I wrote it for me and I’m using 0.94.1 version of Hass.io and I want to make it work for newest versions, so everyone can use it. Currently it works fine on my version and I tried to make it universal so it can work on all versions, but I’m not sure.
The schematics to make such Tasmota IR Transceiver is shown on the picture. I recommend not to put this 100ohm resistor that is marked with light blue X. If you’re planning to power the board with microUSB and you have pin named VU connect the IRLED to it instead of VIN.

Tasmota configuration looks like this

After configuration open Tasmota console, point your AC remote to the IR receiver and press the button for turning the AC on.

If everything in the above steps is made right, you should see a line like this (example with Fujitsu Air Conditioner):
{'IrReceived': {'Protocol': 'FUJITSU_AC', 'Bits': 128, 'Data': '0x0x1463001010FE09304013003008002025', 'Repeat': 0, 'IRHVAC': {'Vendor': 'FUJITSU_AC', 'Model': 1, 'Power': 'On', 'Mode': 'fan_only', 'Celsius': 'On', 'Temp': 20, 'FanSpeed': 'Auto', 'SwingV': 'Off', 'SwingH': 'Off', 'Quiet': 'Off', 'Turbo': 'Off', 'Econo': 'Off', 'Light': 'Off', 'Filter': 'Off', 'Clean': 'Off', 'Beep': 'Off', 'Sleep': -1}}}

If protocol is no ‘Unknown’ and you see the ‘IRHVAC’ key, containing information, you can be sure that it will work for you.

Next step is to download the ‘tasmota_irhvac.zip’ file from this link:

Then unzip the tasmota_irhvac component, copy the folder tasmota_irhvac, and put it in the folder custom_components.
Reastart Hass.io!
After restart put the following config in your configuration.yaml file, but don’t save it yet, because you’ll need to replace all values with your AC values. :slight_smile:

climate:
  - platform: tasmota_irhvac
    name: Daewoo IRHvac
    command_topic: "cmnd/kitchenMultisensor/irhvac"
    state_topic: "tele/kitchenMultisensor/RESULT"
    temperature_sensor: sensor.kitchen_temperature #optional this sensor is used to display current temp on the AC card
    protocol: "FUJITSU_AC"
    min_temp: 16 #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
    away_temp: 24 #optional - default 24 int value
    precision: 1.0 #optional - default 1.0 float value
    supported_modes:
      - heat
      - cool
      - dry
      - fan_only
      - auto
      - "off" #Turns the AC off - Should be quoted and should be always included here
    supported_fan_speeds:
      #- low
      - max
      - medium
      # - high
      #- middle
      #- focus
      #- diffuse
      - min
      - auto
    supported_swing_list:
      - "off"
      - vertical #up to down
      - horizontal # Left to right - remove if your AC does not support it
      - both # remove if your AC does not support horizontal
    hvac_model: "1" # string value
    celsius_mode: "On" #optional - default "On" string value - you can remove it if you use celsius

Using your remote and the IR Transceiver do the following steps to find you AC values that you have to fill in. You can find these values by looking in the console for them. They will appear in the ‘IrReceived’ JSON line (mentioned earlier).
Cycle trough all of your AC modes and write them in supported_modes. I have left some possible values commented.

Cycle trough your fan speeds and and write them down in supported_fan_speeds

If your AC doesnt support horizontal swinging remove horizontal and both from supported_swing_list

Enter your hvac_model

Change the “min_temp” and “max_temp” values with your AC min and max temp.
target_temp is the initial target temp. 26 is default value and if you don’t want to change it, you can just remove the line.
away_temp is the temp that will be set in away mode. If you don’t want to change it or you don’t need it you can remove that line.
You can also remove all lines that doesn’t need to be changed and are marked with “optional”.
Change the name with the desired name.
After you finish with the config, save it and restart Hass.io. Once restarted you can add in LovelaceUI new thermostat card and select the newly integrated AC.

This is a pic of 2 of my Tasmota IR transceivers, that I have mounted under my ACs so when using the ACs remote they have direct visual and update the state in Hassio (yes, it can do that too).
Google Photos

As an addition you can add these 2 scripts in your scripts.yaml and use them to send all kind of HEX IR codes and RAW IR codes, by just naming your multisensors using room name (lowercase) and the word “Multisensor”. Like “kitchenMultisensor” or “livingroomMultisensor”

ir_code:
  sequence:
  - data_template:
      payload: '{"Protocol":"{{ protocol }}","Bits": {{ bits }},"Data": 0x{{ data }}}'
      topic: 'cmnd/{{ room }}Multisensor/irsend'
    service: mqtt.publish
ir_raw:
  sequence:
  - data_template:
      payload: '0, {{ data }}'
      topic: 'cmnd/{{ room }}Multisensor/irsend'
    service: mqtt.publish

You can use it like this:

ards:
  - cards:
      - action: service
        color: white
        icon: 'mdi:power'
        name: Включване на Аудио
        service:
          action: ir_code
          data:
            bits: 12
            data: A80
            protocol: SONY
            room: kitchen
          domain: script
        style:
          - color: white
          - background: green
          - '--disabled-text-color': white
        type: 'custom:button-card'
      - action: service
        color: white
        icon: 'mdi:power'
        name: Turn Off Audio
        service:
          action: ir_code
          data:
            bits: 12
            data: E85
            protocol: SONY
            room: kitchen
          domain: script
        style:
          - color: white
          - background: red
          - '--disabled-text-color': white
        type: 'custom:button-card'
      - action: service
        color: white
        icon: 'mdi:power'
        name: Test Clima
        service:
          action: ir_raw
          data:
            data: >-
              3290, 1602,  424, 390,  424, 390,  424, 1232,  398, 390,  424,
              1212,  420, 390,  424, 390,  424, 390,  424, 1232,  398, 1234, 
              398, 390,  424, 390,  426, 390,  424, 1232,  400, 1230,  398,
              392,  424, 390,  426, 390,  426, 390,  424, 390,  424, 390,  424,
              390,  424, 392,  424, 390,  424, 392,  424, 390,  424, 390,  424,
              390,  424, 1232,  398, 390,  424, 390,  426, 390,  424, 390,  424,
              392,  424, 390,  424, 392,  426, 1230,  400, 390,  424, 390,  426,
              390,  424, 390,  424, 1232,  400, 1232,  398, 1232,  398, 1232, 
              400, 1232,  398, 1232,  400, 1232,  400, 1232,  400, 390,  426,
              390,  424, 1206,  424, 390,  424, 390,  424, 392,  424, 390,  424,
              392,  424, 390,  426, 390,  424, 390,  424, 1230,  402, 1230, 
              402, 390,  424, 390,  424, 1230,  402, 390,  424, 390,  424, 390, 
              424, 390,  424, 390,  426, 390,  424, 1230,  402, 1228,  402,
              390,  424, 390,  424, 390,  426, 390,  424, 390,  426, 390,  424,
              390,  424, 390,  426, 390,  426, 390,  424, 390,  424, 390,  426,
              390,  424, 390,  424, 392,  426, 390,  424, 390,  424, 392,  424,
              390,  424, 390,  424, 390,  424, 390,  424, 390,  424, 390,  424,
              390,  424, 390,  426, 390,  426, 390,  424, 390,  424, 392,  424,
              390,  424, 390,  424, 390,  424, 390,  424, 392,  424, 390,  424,
              390,  424, 390,  426, 390,  424, 392,  424, 390,  424, 392,  424,
              390,  424, 390,  424, 1228,  404, 388,  424, 390,  424, 392,  424,
              1228,  404, 1228,  402, 1228,  402, 390,  426, 1228,  402, 390, 
              424, 390,  424
            room: bedroom
          domain: script
        style:
          - color: white
          - background: blue
          - '--disabled-text-color': white
        type: 'custom:button-card'
    type: vertical-stack
type: vertical-stack
3 Likes

Looks great. One question though, how is the reception and transmission accuracy. I know broadlink mini has many IR transmitters in a circular pattern and here you are using only one.
Is one of each sufficient or do we need more ?

Point it at the aircon

Could you share more info on your hardware setup (pictures of the insides of your cases) and maybe share the STL files. Looks like you added a PIR and light (?) sensor to your units.

This is really cool, I didn’t realize Tasmota even had the capability to recognize my window AC.

Ok, almost got everything set up, but Home Assistant isn’t adding the climate entity. I’m seeing this in the logs:

    Error doing job: Task exception was never retrieved
    Traceback (most recent call last):
      File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 
    406, in _async_add_entity
        await entity.async_added_to_hass()
      File "/home/homeassistant/.homeassistant/custom_components/tasmota_irhvac/climate.py", line 370, 
    in async_added_to_hass
        if not self._current_operation:
    AttributeError: 'TasmotaIrhvacClimate' object has no attribute '_current_operation'

Looks like it’s referring to this line in the code:

        # Set default state to off
        if not self._current_operation:
            self._current_operation = STATE_OFF
            self._enabled = False

Ok, further testing, I had set the initial_operation_mode to cool in Home Assistant config, if I set it back to default of “off” it worked. I tried with cool in quotes as well.

    initial_operation_mode: "off" # cool # optional - default "off" string value

The climate.py file. At line 370 is the line in reference that I mentioned.

While it added the entity, it doesn’t appear to let me change anything (though changing the temperature on the slider turns the unit off, it doesn’t really change the temperature). It also doesn’t seem to pick up changes to state made by the remote, despite those showing up in MQTT.

I did comment out the swing mode completely since my AC unit doesn’t have a swing mode, could that be causing an issue?

Nope, I was wrong, it does pick up the changes to the temperature and turns it off since that’s the mode Home Assistant thinks it is in. I just can’t turn it on via Home Assistant and it doesn’t reflect other modes when I use the remote. The remote was resetting all the config when I’d turn it back on.

With a single IR LED, I control 6 appliances with different positions in a room 5m long by 4m wide … :slight_smile:

I will share everything including links to the parts needed. I just finished the component at 3:30AM and I was in hurry to share it with all of you and quickly go in the bed, because I had to go to work after 6 hours. :slight_smile:

1 Like

Thank you … It is true that there is type error in

# Set default state to off
        #this expects initial_operation_mode: off # off evaluates to false
        if not self._current_operation:
#Should be
        #this one expects initial_operation_mode: "off" # as string value to compare states
        if self._current_operation == STATE_OFF:

But the logs say other kind of error … That is strange … Anyway … Will try to fix it … :slight_smile:

BTW … What version of Hassio are you using?

Home Assistant 0.103.0

Installed on Ubuntu, no Hassio.

I edited the climate.py file … replace it and try again … :slight_smile:

Still acting weird. I’m not seeing errors in the logs now though. Top is with “off” in the initial state and bottom is with cool in initial state.

I wonder if it is a difference between regular Home Assistant and Hassio?


image

I think there is a difference between Home Assistant and Hassio … I think you have to include this card, which might be called something like “Custom Thermostat Card” …

Hmm, the other custom cards I have loaded in my ui-lovelace.yaml are .js files. Not sure it’s a card issue because even in the dev tools, states section it shows up weird. It’s actually showing just heat, cool, auto and off for modes and circulate, auto, and on for fan. Despite the fact I have heat off and the standard settings for fan.
I wish I had more time to tinker with it right now, or that I knew more than very basic ideas about coding. I’m sure it’s probably some weird difference in Hassio and Home Assistant.

can you show me your config for the AC?

I know more than the basic Idea of coding … The bad thing is that Home Assistant and Hassio are constantly changing without ANY backward compatibility, this makes meaningless any coding …
I see where the problem is. You don’t see the buttons under the temperature ring, because they represent services of a climate device. In my version they was existing in the climate device integration and now they have to be registered in the component itself. This makes it impossible to make it on my version and giving it to you to use it in your version. As I don’t announce the services in the newer way, the buttons representing these services doesn’t show up. In fact all these breaking changes were making me crazy constantly fixing good working code and I stopped updating Hassio and probably about 8-9 months I wasn’t changing anything … Maybe I’ll wait until stable version 1.0.X, I’ll rewrite all my custom_components and never change it again … :smiley: Unless they promise there will be no breaking changes up to v2.X …

Here we go.

    - platform: tasmota_irhvac
      name: Office AC
      command_topic: "tasmota/office/cmnd/officeac/irhvac"
      state_topic: "tasmota/office/tele/officeac/RESULT"
      temperature_sensor: sensor.snof1_temperature #optional this sensor is used to display current temp on the AC card
      protocol: "MIDEA"
      min_temp: 68 #optional - default 16 int value
      max_temp: 78 #optional - default 32 int value
      target_temp: 74 #optional - default 26 int value
      initial_operation_mode: cool # cool # optional - default "off" string value
      away_temp: 74 #optional - default 24 int value
      precision: 1.0 #optional - default 1.0 float value
      supported_modes:
        #- heat
        - cool
        - dry
        - fan_only
        - auto
        - "off" #Turns the AC off - Should be quoted and should be always included here
      supported_fan_speeds:
        #- low
        - max
        - medium
        # - high
        #- middle
        #- focus
        #- diffuse
        - min
        - auto
      supported_swing_list:
        - "off"
        #- vertical #up to down
        #- horizontal # Left to right - remove if your AC does not support it
        #- both # remove if your AC does not support horizontal
      hvac_model: "1" # string value
      celsius_mode: "Off" #optional - default "On" string value - you can remove it if you use celsius

Hah, gotcha, yeah, hopefully at some point things will stabilize on the backend breaking changes. Could always drop on github and maybe some others would also be able to help you maintain. At least in theory then the workload would be distributed.

As I want to be brave and famous ( :smile: ), I will now install latest Hassio and in few days will make a new plugin that works for the newest Hassio … I can’t wait 10 years to become famous :smiley: :smiley: :smiley:

2 Likes