litinoveweedle / SmartIR

⏻ Control Home Assistant climate, fan, media_player and light devices via IR/RF controllers (Broadlink, Xiaomi, MQTT, LOOKin, ESPHome, ZHA)
MIT License
109 stars 31 forks source link

How to use UFO-R11 / ZS06 / MQTT with existing codes from Broadlink? #117

Closed gofort closed 2 months ago

gofort commented 2 months ago

Is your feature request related to a problem? Please describe. I have ZS06 and have custom script to enable / disable AC. I have only 2 commands (ON / OFF) and I am trying to understand how I can use existing file with codes for Broadlink like 1293.json where tons of different codes exist with SmartIR and ZS06. I have tried various configurations, but nothing works unfortunately.

Describe the solution you'd like Clear documentation on what exactly to change in code.json file to make it work with UFO-R11 / ZS06 / MQTT.

What I have already tried:

Renamed 1293.json to 9993.json and put into custom_codes/climate, after that:

{
    "manufacturer": "Fujitsu",
...
    "commandsEncoding": "Raw",
    "supportedController": "MQTT",
2024-08-25 14:46:12.782 ERROR (MainThread) [custom_components.smartir] Invalid climate device JSON file '9993.json': missing or invalid attribute 'commandsEncoding'.
2024-08-25 14:46:12.783 ERROR (MainThread) [custom_components.smartir.climate] SmartIR climate device data init failed!

I have checked debug logs, I see device is added and I don't see any errors, but commands literally produce 0 results. I don't understand what exactly should be changed and how :(

Regarding HA configuration I tried:

climate:
  - platform: smartir
    device_code: 9993
    controller_data:
      controller_type: UFOR11
      mqtt_topic: zigbee2mqtt/Living Room AC/set

also tried this

climate:
  - platform: smartir
    device_code: 9993
    controller_data:
      controller_type: MQTT
      mqtt_topic: zigbee2mqtt/Living Room AC/set

It is also not really clear what is the difference between MQTT and UFOR11 controllers.

P.S. I have also tried to convert Broadlink json file using https://gist.github.com/svyatogor/7839d00303998a9fa37eb48494dd680f but it still didn't help

gofort commented 2 months ago

So, seems I more or less understood what to do and now it finally works

Steps to make it work for ZS06 / UFO-R11:

  1. Download json file of code you need (1287.json in my case)
  2. Using https://gist.github.com/svyatogor/7839d00303998a9fa37eb48494dd680f?permalink_comment_id=5153002#gistcomment-5153002 convert code file

example: python3 broadlink_to_tuya.py 1287.json > 9997.json (I have used 9997.json to differentiate it from original file)

  1. Change in 9997.json MQTT to UFOR11, like that

"supportedController": "UFOR11",

  1. Put it into custom_codes/climate, you can continue using 9997.json name if you wish
  2. In you HA configuration (configuration.yaml) put the following:
climate:
  - platform: smartir
    name: <Name you wish to use>
    unique_id: <id you wish to use>
    device_code: 9997
    controller_data:
      controller_type: UFOR11
      mqtt_topic: zigbee2mqtt/<Friendly name of the device>/set
    temperature_sensor: sensor.<your temperature sensor>
    humidity_sensor: sensor.<your humidity sensor>

my example:

climate:
  - platform: smartir
    name: Living Room AC SmartIR
    unique_id: living_room_ac_smart_ir
    device_code: 9997
    controller_data:
      controller_type: UFOR11
      mqtt_topic: zigbee2mqtt/Living Room AC/set
    temperature_sensor: sensor.living_room_t_h_sensor_temperature
    humidity_sensor: sensor.living_room_t_h_sensor_humidity
litinoveweedle commented 2 months ago

As you find the proper way of doing the stuff, is this opened issue still valid?

gofort commented 2 months ago

Closed issue, will try to create PR later to provide more detailed guidance for similar cases as mine.