Using ZS06/UFO-R11 Zigbee/MQTT Infrared (IR) remote with SmartIR

I’m testing a TuYa ZS06 (mains powered) which is functionally the same as the Moes UFO-R11 (battery powered) and was not able to find the information I needed to get it working with the SmartIR integration to be passed through to Home Assistant as a Climate entity. I’m gathering what I found here for ease of access for others.

The below assumes you are familiar with the SmartIR integration, have some experience with IR controllers such as the Broadlink product, and are aware that you need a compatible device_code for your particular device or produce your own device_code (as below).

Generally, the steps are:

  1. Pair the ZS06 remote to zigbee2mqtt (z2m)

  2. Learn the IR codes for your climate device. In z2m, click on the Exposes tab of the remote; click ON for State; while pointing at the IR remote, press the button on the physical remote you want to collect the IR code; copy/paste the resulting code in a separate file. Build your .json climate code per SmartIR instructions and upload it to /config/custom_components/smartir/codes/climate

  3. Add the remote to Home Assistant via the SmartIR platform, specifically adding the remote to configuration.yaml

climate:
  - platform: smartir
    name: Livingroom AC
    unique_id: livingroom_ac
    device_code: 9507 #this device_code is the .json file you produced by learning IR codes for your climate device
    controller_data: zigbee2mqtt/zs06-ir/set
  1. Reboot Home Assistant, then Add a new Lovelace Climate card with entity climate.livingroom_ac and it will show up as a climate device as expected.

Essentially, you have all the information available from the smarthomescene.com review [1] and the zigbee2mqtt.io database [2] but the two details that were hard for me to come by are:

a) The climate .json code file for a Broadlink controller is Base64 whereas the code file for MQTT should be Raw:

"supportedController": "MQTT",
  "commandsEncoding": "Raw",

b) The MQTT payload used in the script of the smarthomescene.com review [1] will work in the script but in order for the payload to be executed within the device_code .json used with SmartIR, you have to escape any double quote inside the json command. See SmartIR Github Issue #873 and #1074

"{\"ir_code_to_send\": \"Learned_IR_Code\"}",

A sample of my device_code .json file:

{
  "manufacturer": "Mitsubishi Electric",
  "supportedModels": [
    "MSY-GM18VA"
  ],
  "supportedController": "MQTT",
  "commandsEncoding": "Raw",
  "minTemperature": 16.0,
  "maxTemperature": 31.0,
  "precision": 1.0,
  "operationModes": [
    "cool"
  ],
  "fanModes": [
    "low"
  ],
  "commands": {
    "off": "{\"ir_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EBwEfACwOKAeoEgANACwHRAcAXA0cB6gRAA+AFE0AXAdEBQBMBigFAG0ADQAsB0QGAF0APA+oERwGAawVHATYCRwHAC0AHQANAF+ADA0AjQANAE0AH4AMD4C0TBAwBNgJHIANAB0AD4AMLQA9AA+AfE0Ar4AMDA98ANgLAD+ADC+AHEwXfAHIF3wBAB0ADAJQgDws2At8AlAKmAHIFpgA=\"}"
      }
    }
  }
}

Resources:
[1] https://smarthomescene.com/reviews/tuya-zigbee-infrared-ir-remote-zs06-review/
[2] TuYa ZS06 control via MQTT | Zigbee2MQTT
[3] SmartIR Github Issue #1084 also has a NodeRed Flow to convert Broadlink Base64 codes to MQTT Raw codes but I have not personally tried it

4 Likes

Hello

I have a little problem.
My device is UFO-R11

When use original config of json file i can add climate card but if change to MQTT and RAW entity climate dissapear and cant add card.

If use mqq publish to test with learn code it works

Any suggestion?

EDIT: its sensible to capital letter. For now solver. Tomorow I test if that works

Thanks

ok good luck! i have presently using the same json for both the zs06 and ufo-r11 so if your code works for one model it should work the same for the other model.

1 Like

Unfortunately i still have problems
If i learn codes and use this script all work good

service: mqtt.publish
data:
  qos: "0"
  retain: false
  topic: zigbee2mqtt/acsala/set
  payload: >-
    {"ir_code_to_send":
    "B1wjkRGSAhwCgAMBgwbgAQPAE8AHwBvAD+AzB0BLQD8TgwYcAhwCkgIcApICgwaSAhwCkgI="}

If use the .json of my remote, number 1182 json, dont work. IR HUB dont blink of any commands what i use in climate card. I try other codes and HUB dont blink with several trys.

My files:

Climate yaml:

type: thermostat
entity: climate.ac_sala
features:
  - type: climate-hvac-modes
    hvac_modes:
      - 'off'
      - heat_cool
      - fan_only
      - dry
      - cool
      - heat

Configuration yaml:

smartir:

climate:
  - platform: smartir
    name: Ac sala
    unique_id: ac_sala
    device_code: 1182
    controller_data: zigbee2mqtt/acsala/set

1182 json (only add ""ir_code_to_send" code in Heat mode and OFF to test it):

Thanks for the info!
Here’s some potentially useful advanced links.

Use this python tool to help quickly create your device codes. EduardoHerreraM/SmartIR-Zigbee-Tools (github.com)

Official support for the UFO-R11 in SmartIR add UFO-R11 controller support by yoavipm · Pull Request #1137 · smartHomeHub/SmartIR (github.com)
You can simply modify the controller.py file with the changes. Then you can format the device code like any other MQTT device code. Hopefully it gets officially merged into SmartIR.

If you’re like me and use ZHA then you can use this fork that adds support for using ZHA with your Zigbee IR device. davidrpfarinha/SmartIR: Integration for Home Assistant to control climate, TV and fan devices via IR/RF controllers (Broadlink, Xiaomi, MQTT, LOOKin, ESPHome, ZHA Quirks) (github.com). I’ve tested it and it works great. There’s an example device code to use.

you can try using my template, which just requires you to learn the IR code for the respective temp/fan mode combo, then insert that code into the template by replacing the @@@

https://pastes.io/szxvgv7zev

Can verify your json by using an online code validator: https://jsonlint.com/

Just caught wind of the SmartIR official support as well, looking forward to it!

I’ve got all the IR codes I need for my use case but hopefully someone can chime in on the Zigbee Tools, that looks like it could be really helpful and save some troubleshooting time.

It works !

Need learn all codes of my remote, select correct fan mode and it works perfectly

Thanks for all

1 Like

Just wanted to pop in here to say thanks. I gave up on this months ago, because there wasn’t much documentation on a MQTT based IR device with SmartIR but it works great now. All I need to do is finish grabbing the rest of the codes (I originally skipped codes by 3 degrees (F) because I didn’t need that much detail).

1 Like

i’ve replaced 5 broadlink IR that require the cloud with 5 zigbee IR for all local control. the zigbee IR respond slower but reliably and all local so i’m happy!

Thanks! This worked well with my UFO-R11.

Just wanted to mention couple of hick-ups I encountered.

  1. Need to restart HA after installing SmartIR, before adding the climate component as above.
  2. It’s a good idea to validate the codes JSON files as mentioned by @junknstufff (I spent too long because of an additional comma).

Also if anyone looking for codes for Mitsubishi Heavy Industries SKM22ZF-S - https://pastes.io/krbzp1y7jd (Cool Mode Auto Fan only)

Just tested this thingy with an old Toshiba AC and UFO-R11 - worked like a charm. My question though is can SmartIR decode the IR and set the state in HA if someone changed something with the remote ESP Climate style ?

That’s not supported. I wish it was. Perhaps it could be programmed to. The battery powered zigbee versions I doubt would work well as it’d have to be constantly looking for IR signals and thus drain the battery.

That’s a good point for the battery drain…
It would be really nice to be able to set the state in HA for custom remotes… Anyway thanks again

Someone has created a converter to convert the SmartIR Broadlink commands to work with these Zigbee IR remotes. This means no need to manually learn the codes.
Convert SmartIR Broadlink commands to Tuya (github.com)

My config:

  - platform: smartir
    name: Living Room AC Zigbee
    unique_id: ac_living_room_zigbee
    device_code: 1121
    controller_data: zigbee2mqtt/moes_ufo_r11/set/ir_code_to_send

With a few tweaks it’d also work with ZHA.

Hello everyone, I configured correctly my new ZS06 with SmartIr but I noticed that when I change channel with Alexa to a channel with 2 digits (eg 31) the bluster stop working until I restart it (plug and unplug)

Have someone else figured this?

I temporary solved adding a sleep in the SmartIr async_play_media function.

I also opened an issue on Z2M github: TuYa ZS06 stop working · Issue #22111 · Koenkk/zigbee2mqtt · GitHub