SmartIR - Control your Climate, TV and Fan devices via IR/RF controllers

Made any progress @Tranquilizer? Bit the bullet & manually added all the codes to my json & only “off” works for me. Such a PITA

How to create a proper fan json file?

I can’t figure out how to create a proper json file for the fan codes. I have my IR codes working, but how to create a correct file? I tried to peek into the files of the other codes and create a similar one with another numbering of my choice (for example 2000), but it seems that using this last one the smartir integration is not loaded correctly; therefore I assume that some steps are missing.

{
  "manufacturer": "Brandson",
  "supportedModels": [
    "Unknown"
  ],
  "supportedController": "Broadlink",
  "commandsEncoding": "Base64",
  "speed": "toggle"
  ],
  "commands": {
    "power": "JgAsAScOKA4NKCgNKQ0NKA4oDSkNKA4oDSko4ikNKA0OKCgOKA0OKA0pDSgNKQwqDCkoAAEGJw4oDgwpKA4oDQ0oDigNKA4oDSkNKCjkKAwoDg0oKA4oDgwpDSkNKA4oDCoMKSgAAQYoDSgODSgoDigOCyoNKAwpDigOKA0oKOQoDSgNDCkpDSgODSgOKA0oDigNKQ0oJwABBygNKA4NKScOJw8MKQ0pDCgOKA0pDSgo5CgNKA4MKCkNKQ0NKA0pDSgOKA0pDSgoAAEGKA0oDg0pJw4oDg0oDCoMKgwoDigNKCjkKA0oDgwqJw4oDQ0pDSgNKQ0oDigNKSgAAQUnDygNDigoDigNDigNKQsqDSkLKg0oKeMnDigOCyooDigODCgNKQ0pDSgNKQ0pJwANBQ==",
    "speed": "JgAsAScOJw4OKCgNKQ0MKgwpDSgNKQ0oKQ0N/igOKA4MKScOKQwOKA0pDSgOKA0pKA0OAAEgKA4oDQ4oJw4oDg0pCyoNKQwqDCgpDQ3/Jw4oDg0oKA4oDgwoDigNKQ0oDigoDQ4AASEoDSgNDigoDigNDigNKQ0oDCoMKicODP8oDSgODSknDigODCoMKQ0oDSkNKCgODQABIicOJw4NKCkNKA4NKA4oDSkNKA4oKA4M/igOJw4OKCgOJw4NKQ0oDSkNKQwoKQ0NAAEiJw4oDgwpKA0pDQ0oDigNKA4oDSkoDQ3+KA0pDQ0pJw4oDgwpDSkNKQwpDSknDg0AASEoDigNDSkoDicODSgNKA4oDSkNKCgODf4oDicODSgpDSgNDigNKQwpDigNKScODAANBQ==",
	"Oscillate":"JgAsASgNJw8MKicOKA0NKA4oKA0OKA0pDSgO/SkMKQ0NKSgNKA4NKA4oKA4NKA0pDCoMAAEhKA4oDQ4oKA4nDg0oDSgpDQ0pDSgOKA3+KA0pDQ0oKQ0oDQ0pDSkoDQ4oDSgNKQ0AASEoDSgODSknDigODCkNKSgNDSgNKQ0oDv4oDSgODCkoDSgODSgOKCgODCkOKA0pDAABIScPJw4OKCgOJw4OKAsqKA4MKQ0oDigN/ycOJw8MKScPKAwOKA0pJw4NKQ0oDigNAAEhKQwoDg0oKA4oDg0oDigoDQ0pDCoMKA7+KA0oDg0pKA0nDwwoDigpDQ0oDigNKQwAASIoDSkMDignDycODSkNKCgODSkLKg0pDP4oDigODSgoDicODSkMKicNDSkNKQ0oDgANBQ==",
	"Led":"JgAsASgNKA0OKCgOJw4NKSgNDSkMKgwpDSgN/igOKA0NKScPJw4NKCkMDigNKQ0oDigNAAEhKA0pDQwpKA4oDQ4oKA4NKAwqDCoMKQ3+KA8mDg0oKA4oDgwpJw4NKA0pDSkNKA4AASEoDSgNDSkoDSgODSgoDg0pDSgOKAwpDf4oDicODSkoDSgODConDgwqDCgOKA0pDAABIigOKA0NKCkNKA0NKSgNDSkNKQ0oDigN/SkNKA4NKCgOKA0OKCgODCkMKgwoDigNAAEiJw4oDgwpKA4oDQ0oKQ0MKQ4oDSkNKA3+KQwpDQ0pJw4nDw0oKA4NKQwpDSkMKgwAASEnDygNDSkoDicODCkpDA4oDSkNKA0pDf8nDigNDCkpDScODigoDg0oDSkNKQsqDAANBQ==",
	"Timer":"JgAsASgNJw8NKScOKA4MKA4oDignDg4oDSgN/ygOJw0OKCkMKA4NKQ0oDigoDQ4oDCoLAAEjKA0oDg0pJw4nDwwpDSkMKSgNDigNKA7+KA4nDgwpKQwpDQ0pDSgNKSgODSgOKAwAASIoDSgODSknDigODSgNKQwqKA0NKA0pDf4nDygNDSknDycODCkMKQ0pKA4NKA4oDQABISkMKA4NKScOKA4NKA0pDSknDgwqDCoM/igOJw4NKScPJw4MKgwoDigpDQ0oDigMAAEjJw4oDQ0pJw4oDg0pDCkNKSgNDCoMKgv/Jw8nDg4oJw8nDg0pCyoNKScODCkNKQwAASMoDSgODCooDCgODSgOKA0pKA0OKA0pDf0oDigNDSkoDicODSkMKQwqJw8MKQ0oDQANBQ==",
	"Mode":"JgAsAScOKA0NKSgOJw4NKA0pDSgOKCgNDigN/ygNKA4MKCkNKQ0NKA4oDSkMKSgODSkNAAEgKA4pDQ0oJw8nDg0pDSkMKQ4oKA4MKQ3+Jw4oDg0pJw4oDg0pDSgOKAwqJw4MKQ0AASInDigODSgoDicPDCkMKgwoDSkoDg0oDv4oDicODSknDigODCkNKA0pDSknDg0pDQABIicOKA0NKCkNKQ0MKQ4oDSgOKCgODSgO/SkMKQ0NKSgNKA4NKA4oDSkMKSgODCoMAAEhKA4nDg4oKA4nDg4oDCoMKQ0pKAwOKA3/Jw4oDg0oKA4oDgwpDSgNKQ0oKQ0NKA4AASEoDigNDSkoDSgNDSkNKA0pDSknDg4oDf4oDSkNDSgpDSgNDSkNKQ0oDigoDgwpDAANBQ=="	
  }
}

Use this website to check your JSON file.

Your file has a mistake:

Error: Parse error on line 8:
...	"speed": "toggle"],"commands": {	"p
---------------------^
Expecting '}', ',', got ']'

Has anyone set up a Mitsubishi MSZ-WR09NA or MSZ-WR12NA? I’ve been using the 1124.json and it does most of what I need, except fan direction/angle.

1 Like

Hi friends,
I’ve been using the RM4 Pro with OpenHAB for the past two years to send commands to several RF controlled ceiling fans and it’s been running great.
However, due to several reasons I’m thinking of migrating away from OpenHAB to Home Assistant.
I’ve gone over the docs of this integration on the github page, but being a non developer and a noob to the Home Assistant platform, I’m still not sure how to set it up.
Before I go through the migration process that will require recreating my whole system, can anyone tell me if there is a full tutorial to setting up the SmartIR integration?
Hope someone can help :pray:

The SmartIR integration is quite a multi-step process, but don’t be too worried, it’s only tedious for the initial setup and when learning new device codes. After that, it’s pretty easy to use, just like any other Home Assistant device entity.

Disclaimer: I’m not the maintainer, so I will not provide any form of support. This is just a post to help people get started.

Best to go through the GitHub documentation first, but in general here are the steps.

Environmental assumptions:

  • You are totally new to Home Assistant but have gone through basic setup procedures already
  • You are using HAOS
    • Setup may differ for other Home Assistant installation methods
  • You have already setup HACS
  • You have already setup your RM4 Pro and integrated it to Home Assistant.
  • You have a method to modify your home assistant configuration files (pick one):

Setup Steps:

  • Install SmartIR via HACS - You may need to restart Home Assistant.

  • Obtain device IR/RF codes (Link to documentation for climate type devices)

    • If your device model can be found in SmartIR GitHub codes repository, download the code file and put it in config/custom_components/smartir/codes/<type>/<id>.json>
    • Otherwise, learn IR/RF codes if required using HA service call remote.learn_command, learnt commands can be found in config/.storage/broadlink_remote_<mac-addr>_flags.json.
    • If you already have them in openHAB, you can use those as long as they are in the Broadlink base64 format.
  • Setup codes json file for your device. This JSON file tells SmartIR how to manage your device and which codes it should use.

  • Add device configuration to Home Assistant’s configuration.yaml

  • Restart Home Assistant

If you’ve done this correctly, you should see your device entity listed if you search “SmartIR” in the Entities page. Click below to go to the entities page.
Open your Home Assistant instance and show your entities.

3 Likes

Thank you very much for the detailed explanation :pray::pray::pray:
I think I took most of the steps you mention before, but I guess I did a mistake somewhere along the way.
I’ll try again with your explanation and hopefully this time everything will work properly :slight_smile:

Update:
Hi @samuelthng I followed your steps to the point of learning my remote codes.
However, when I am running HA’s Remote: Learn Command service I can’t get my rf codes to be properly recorded and saved in neither the config/.storage/broadlink_remote_<mac-addr>_flags.json or config/.storage/broadlink_remote_<mac-addr>_codes.json files.
When I run the learn service my broadlink RM4 Pro enters into learn mode, and after pressing a button on my remote the learn service captures my remote’s frequency and I’m getting an HA notification I should now press the button I want to learn, but when I press the remote button a second time it seems that nothing is happening and the codes are not saved to the proper file.

As you mentioned I do have my remote codes that I learned for OpenHAB and I also have them in base64 format. Can you please explain how I can use those codes to create json files to control my devices?

You can take a look at the codes folder in the repository for some examples for the json files. The tool in the previous message I sent also helps to generate the shape of the json.

From there, you just need to put the file in the right directory, and ensure the codes you have are placed in the right keys.

As yours is a RF command, I’m not very familiar if there is any differences in the process. I’m using IR commands for all my devices. Maybe the RF codes are stored in a separate location. :thinking:

Is Tuya IR blaster also compatible?

Hello, I’m looking for some help when it comes to putting together commands for a device that’s not yet listed, both so that I can use my device myself and so that I can add some codes I recorded to the github repo for other users.

I pulled down 1460.json which is for Edifier R1280DB, shown here:

{
  "manufacturer": "Edifier",
  "supportedModels": [
    "R1280DB"
  ],
  "supportedController": "Broadlink",
  "commandsEncoding": "Base64",
  "commands": {
    "off": "JgBQAAABMJUSExMSExMSExM4EhMTExITEzgSOBM4EhMTEhM4EzgSOBM4EhMTEhMTEhMTExITExITExM4EjgTOBI4EzgSOBM4EwAFOwABMEoSAA0F",
    "on": "JgBQAAABMJUSExMSExMSExM4EhMTExITEzgSOBM4EhMTEhM4EzgSOBM4EhMTEhMTEhMTExITExITExM4EjgTOBI4EzgSOBM4EwAFOwABMEoSAA0F",
    "volumeDown": "JgBQAAABKJQTEhMTEhMTEhM4EhMTEhMTEjgTOBI4ExMSExI4EzgTNxMTEhMTOBI4ExITExITExITOBM3ExMSExI4EzgTOBI4EwAFOwABKEsSAA0F",
    "volumeUp": "JgBQAAABKJQTEhMTEhMTEhM4EhMTExITEjgTOBI4ExMSExM3EzgTOBI4ExITExI4ExITExITExITExI4EzgSExI4EzgTOBI4EwAFOwABKUoSAA0F",
    "mute": "JgBQAAABL5USExMSExMSExM4EhMTExITEzgSOBM4EhMTExI4EzgSOBMTExITExITExITExMSExMSOBM4EzgSOBM4EjgTOBI4EwAFOwABLkoTAA0F",
    "sources": {
      "Stereo 1": "JgBoAAABKZUTEhMTEhMSExM4EhMTEhMTEjgTOBI4ExITExI4EzgSOBMTEjgTEhM4ExITExITEhMTOBITEzcTExI4EzgSOBM4EgAFOwABKkoTAAxdAAEpShMADFwAASlKEgAMXQABKUoSAA0F",
      "Stereo 2": "JgBoAAABJ5QTExITExITExI4ExITExITEjgTOBI4ExMSExI4EzgTNxM4ExITOBITEzgSExITExITExI4ExITOBMSEzgSOBM4EgAFPAABKEoTAAxcAAEoSxIADF4AASdLEgAMXgABKEoTAA0F",
      "Optical": "JgBQAAABLZUSExMTEhMTEhM4ExITExITEzgSOBM4EhMTEhM4EzgSOBM4EhMTOBI4ExMSExMSExMSExM4EhMTEhM4EzgSOBM4EgAFPAABMUoTAA0F",
      "Coaxial": "JgBQAAABMJUTEhMTEhMTExI4ExMSExMSEzgTOBI4ExITExI4EzgTOBITEjgTOBMSEzgTEhMTEhMTOBITExITOBITEzgTQQk4EgAFPAABLEoTAA0F",
      "Bluetooth":"JgBQAAABJ5USExMSExMSExM4EhMSExMSEzgTOBI4ExITExI4EzgSOBMTEjgTOBI4ExITExITExITOBITExITExI4EzgSOBM4EgAFPQABKEoTAA0F"
    }
  }
}

I then recorded my own remote codes for the Edifier R1280DBs, which is nearly the same product but with a subwoofer out option. Despite this, only two of the R1280DB commands worked for the R1280DBs, hence me having to record.

My problem is, as you can see below, that the commands I recorded via the included remote are not discrete commands; there is one button for both the stereo inputs and the digital inputs that must be pressed twice in order to get to the second input (Stereo 2/Coaxial). This works fine for something with a button like Power On and Off, but I’m not sure how to send source commands in the same way using the default Media Player card’s dropdown source menu.

I’m also not sure what to do for commands like Play/Pause or Soundfield Spatializer in order to have them show up on the media player card.

I named my own remote code “1461.json” but just saw that the file name has been assigned to the R2000DB, so I’ll call it “1462.json” for now. I’ve been playing around with it to see what I can get working.

{
  "manufacturer": "Edifier",
  "supportedModels": [
    "R1280DBs"
  ],
  "supportedController": "Broadlink",
  "commandsEncoding": "Base64",
  "commands": {
    "off": "JgA+AAABIZASERITEhISEhM2EhESExISEjYTNRM1ExESExI2EjYTNRITEjUTNRMSEhISExE3ExERNxITERIKAA0F",
    "on": "JgA+AAABIZASERITEhISEhM2EhESExISEjYTNRM1ExESExI2EjYTNRITEjUTNRMSEhISExE3ExERNxITERIKAA0F",
    "volumeDown": "JgBQAAABHpAUERMRFBATERM1ExEUERMREjYTNBQ1ExETERM1EzUTNRQ0EzYSNhMRExAUERM1ExETERQQExEUNBM2EzQUERM1EwAFFQABHkkSAA0F",
    "volumeUp": "JgBQAAABII8RFBETEBQRExE3ERMRExETETcSNhE3ERMRFBE2EjYROBISEDgRNxETERQQExESExMQOBETERISNxE3ETcRNxI2EQAFJgABH0kRAA0F",
    "mute": "JgBQAAABI44UEBQRFBATERQ0ExEUEBQRFDQUNBQ0FBAUEBQ1EzUUNBQ0FBAUERQQFBAUEBQ0FBAVEBQ0FDUTNBQzFTUTEBQ1EwAFKAABIkcVAA0F",
    "Soundfield Spatializer On": "JgBQAAABIY8TEhITERISExI1ExISEhMREjcSNRM1EhMSEhI2EjYSNxIREjcSERM2EjYSEhMSERMSNhETEjcREhITEjUTNhE3EgAFKQABIEkRAA0F",
    "Soundfield Spatializer Off": "JgBQAAABIo8TERQQFBETEBQ1ExAUERQQFDQUNBQ1FA8UERQzFDUUNBQ1EzQVEBM1FDMVEBQRExAUERQQFDQUEBQQFDUUMxUzFAAFKAABIkYUAA0F",
    "play": "JgBQAAABIZATERETEhITEhE3EhIRExISEjYSNxI2ExERExI3EjUSNhM2EzUTNRM1EzUSExI1ExITERISEhMTEBITEjYSEhI3EgAFKAABIkcTAA0F",
    "pause": "JgBQAAABIZATERETEhITEhE3EhIRExISEjYSNxI2ExERExI3EjUSNhM2EzUTNRM1EzUSExI1ExITERISEhMTEBITEjYSEhI3EgAFKAABIkcTAA0F",
    "previousTrack": "JgBQAAABIo4VEBQRExAUERQzFBEUEBQQFDUTNBUzFBEUEBQ0FDQUNRQPFBEUMxUQFBEUDxQ1FA8VNBQ0FBEUMxU0EzUUEBQ0FAAFJwABIkgSAA0F",
    "nextTrack": "JgBQAAABIo4UERQQFBAUEBM1FBEUEBQQFDUUMxQ1ExEUEBQ0FDUUNBQzFRAUNBQ1FDMUERQ0FBASExM1FBATERQQFDQUEBUzFAAFKQABIkcTAA0F",
    "sources": {
      "Stereo 1/2": "JgBoAAABJ5QTExITExITExI4ExITExITEjgTOBI4ExMSExI4EzgTNxM4ExITOBITEzgSExITExITExI4ExITOBMSEzgSOBM4EgAFPAABKEoTAAxcAAEoSxIADF4AASdLEgAMXgABKEoTAA0F",
      "Optical/Coaxial": "JgBQAAABHZETEhAUERQREhE4ERMSEhITEDgRNxE2EhQQEhI4EjUTNRI3ERMRNxI2ERUQExISERQSEhA5ERQOExI4EDgRNxI2EQAFKgABIEoQAA0F",
      "Bluetooth":"JgBQAAABIo8TEhISERMSEhI2EhITEhETEzUSNhM1EhISExI2EjUTNhISEhISNxE3EjYSEhI2EhMSNRI3EhISEhITEjYSEhI2EwAFKAABIUgTAA0F"
    }
  }
}

So, do I need a different method of recording codes so that I can get them as discrete commands instead of primary switch followed by toggle, or is there another way of properly formatting the commands in this case? I looked through a few other devices to see if I found some examples but didn’t come up with anything.

Also, the configuration input just in case it’s relevant:

- platform: smartir
    name: "Edifier Speakers"
    unique_id: edifier_speakers
    device_code: 1462
    controller_data: remote.b1_b_broadlink_rm4_mini_remote

Thank you.

When i open .storage folder then i cant find broadlink codes.
Do i need to do something to generate this file? So far all almost works, but few codes seems to be wrong.

Good afternoon. Faced with anxiety. There is a zigbee Tuya IR remote control TuYa ZS06 control via MQTT | Zigbee2MQTT, connected via a stick.
I send commands through HA like this:
subject: zigbee2mqtt/0x70ac08fffe9db45f/set
payload: >
{ “ir_code_to_send”: “command”}

in the configuration file are used

smartir:
climate:
    - platform: smartir
      name: conder alm
      unique_id: conder_alm
      device_id: 1700
      controller_data: zigbee2mqtt/0x70ac08fffe9db45f/set
      Temperature_sensor: sensor.sredniaia_temperatura_v_dome
      humidity_sensor: sensor.sredniaia_vlazhnost_v_dome
      power_sensor: switch.socket_air conditioner
      power_sensor_restore_state: true

Nothing happens. The remote control does not blink, the command does not destroy it.

There is a topic in the console: homeassistant/sensor/0x70ac08fffe9db45f/learned_ir_code/config
To send a command, you must use ir_code_to_send.

It seems to me that somewhere in the collection of the file or where the line “ir_code_to_send” : “command” is missing

Who faced what to do?

1 Like

Good afternoon, I have a Whirlpool air conditioner ir remote control DG11J1-91 and re-flashed to ESPHome ir remote S08. Please tell me the correct ESPHome configuration so that my air conditioner can work.
image



I configured ESPHome firmware like this but it doesn’t work.

This is an example of what your json should look like:

Or

We’re both using Moes UFO R-11s which are very similar to your Tuya device

Getting a weird issue with MQTT raw commands through Z2M for my UFO R-11. Here is my full json as a reference but I’ll focus on the problematic section below. FYI, the command sequence is exactly the same for my broadlink device only using json instead of mqtt raw and that works pretty much flawlessly.

Here’s the MQTT raw code for my Daikin AC

  "operationModes": [
    "cool"
  ],
  "fanModes": [
    "Auto",
    "Quiet",
    "Low",
    "Medium",
    "High",
    "Turbo"
  ],
  "commands": {
    "on": {"ir_code_to_send": "AVsmgAELxxH1CSYBxwEmAfkDgAMD/QEBAUALA/0BJgFAFwPHAQEBQAuAEwEBAUAPQANAD0AHQBNAC4ADAwEBxwGAC0AXwANAEwPHAQEBQANAE+ADBwPHASYBwBNACwXHAQEB+QOAB8AXgAeAEwPHAQEBQB/gCRMJAQH5AyYBxwEmAUAH4AMfQA8DxwEBAUAHwAMBxwFAAwkBAfkDUwENUMcR"},
    "off": {"ir_code_to_send": "AVsmgAELxxH1CSYBxwEmAfkDgAMD/QEBAUALA/0BJgFAFwPHAQEBQAuAEwEBAUAPQANAD0AHQBNAC4ADAwEBxwGAC0AXwANAEwPHAQEBQANAE+ADBwPHASYBwBNACwXHAQEB+QOAB8AXgAeAEwPHAQEBQB/gCRMJAQH5AyYBxwEmAUAH4AMfQA8DxwEBAUAHwAMBxwFAAwkBAfkDUwENUMcR"},

When sending the “on” command using Climate controls in HA, it doesn’t register on the AC. I get a confirmation beep that it has received the command but won’t turn on. Sending the “off” command will turn the AC on AND off (this also means that the climate controls won’t work because it’s “off”).

I’ve tried a 2 other on commands: “on_once” and “power on”. Same result. I’ve also tried removing the “on” command entirely and it’s still the same result.

I’m not sure this is related but here’s the error from HA’s log

Logger: homeassistant.helpers.template
Source: helpers/template.py:735
First occurred: 09:40:37 (50 occurrences)
Last logged: 09:41:00

Template variable warning: 'dict object' has no attribute 'ir_code_to_send' when rendering '{{ value_json.ir_code_to_send }}'

and the Z2M log

debug 2023-07-07 18:03:41Received MQTT message on 'zigbee2mqtt/Dining_Hall_IR_Remote/set' with data '{"ir_code_to_send": "AVsmgAELxxH1CSYBxwEmAfkDgAMD/QEBAUALA/0BJgFAFwPHAQEBQAuAEwEBAUAPQANAD0AHQBNAC4ADAwEBxwGAC0AXwANAEwPHAQEBQANAE+ADBwPHASYBwBNACwXHAQEB+QOAB8AXgAeAEwPHAQEBQB/gCRMJAQH5AyYBxwEmAUAH4AMfQA8DxwEBAUAHwAMBxwFAAwkBAfkDUwENUMcR"}'
debug 2023-07-07 18:03:41Publishing 'set' 'ir_code_to_send' to 'Dining_Hall_IR_Remote'
debug 2023-07-07 18:03:41Sending IR code: "AVsmgAELxxH1CSYBxwEmAfkDgAMD/QEBAUALA/0BJgFAFwPHAQEBQAuAEwEBAUAPQANAD0AHQBNAC4ADAwEBxwGAC0AXwANAEwPHAQEBQANAE+ADBwPHASYBwBNACwXHAQEB+QOAB8AXgAeAEwPHAQEBQB/gCRMJAQH5AyYBxwEmAUAH4AMfQA8DxwEBAUAHwAMBxwFAAwkBAfkDUwENUMcR"
debug 2023-07-07 18:03:41Sending IR code initiated.
debug 2023-07-07 18:03:41Received Zigbee message from 'Dining_Hall_IR_Remote', type 'commandZosungSendIRCode01', cluster 'zosungIRTransmit', data '{"cmd":2,"length":294,"seq":0,"unk1":0,"unk2":57348,"unk3":1,"unk4":0,"zero":0}' from endpoint 1 with groupID 0
debug 2023-07-07 18:03:41"IR-Message-Code01" received (msg:{"zero":0,"seq":0,"length":294,"unk1":0,"unk2":57348,"unk3":1,"cmd":2,"unk4":0})
debug 2023-07-07 18:03:41IRCode to send: "{\"key_num\":1,\"delay\":300,\"key1\":{\"num\":1,\"freq\":38000,\"type\":1,\"key_code\":\"AVsmgAELxxH1CSYBxwEmAfkDgAMD/QEBAUALA/0BJgFAFwPHAQEBQAuAEwEBAUAPQANAD0AHQBNAC4ADAwEBxwGAC0AXwANAEwPHAQEBQANAE+ADBwPHASYBwBNACwXHAQEB+QOAB8AXgAeAEwPHAQEBQB/gCRMJAQH5AyYBxwEmAUAH4AMfQA8DxwEBAUAHwAMBxwFAAwkBAfkDUwENUMcR\"}}" (seq:0)

Or could all of this simply be a result of Z2M or the device not being able to send the commands fast enough to get a result?

Maybe the Breaking Changes for MQTT with HA 2023.7 help to solve the problem? Take a look here.

1 Like

Currently I writing a python script to make custom json creation easier.

There is an example to start:

import paho.mqtt.client as mqtt
import json

# Variable to hold the last value of learned_ir_code
last_learned_ir_code = None

# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
    print(f"Connected with result code {str(rc)}")

    # Subscribing in on_connect() means that if we lose the connection and
    # reconnect then subscriptions will be renewed.
    client.subscribe("zigbee2mqtt/0x70ac08fffeadb14b")

# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
    global last_learned_ir_code  # we need to declare the variable as global to modify it

    message = json.loads(msg.payload.decode('utf-8'))  # Convert the JSON string to a Python dictionary
    learned_ir_code = message.get('learned_ir_code')  # Get the value of 'learned_ir_code'

    # Check if the learned_ir_code has changed
    if learned_ir_code != last_learned_ir_code:
        print(f"{msg.topic} {learned_ir_code}")
        # Change learned_ir_code to 'on' and publish it
        client.publish("zigbee2mqtt/0x70ac08fffeadb14b/set", '{ "learn_ir_code":"ON" }')

    last_learned_ir_code = learned_ir_code  # store the current learned_ir_code for next comparison

client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message

# Set the MQTT server details
client.username_pw_set("addons", "neiY6aikieba0keiwahlah9omaic4seileevoongoaZeth9Dohphothairi2ooch") # replace with your MQTT username and password
client.connect("10.10.10.254", 1883, 60)  # replace with your MQTT broker IP and port

#message['learn_ir_code'] = 'ON'
client.publish("zigbee2mqtt/0x70ac08fffeadb14b/set", '{ "learn_ir_code":"ON" }')  # Convert the dictionary back to JSON

# Blocking call that processes network traffic, dispatches callbacks and
# handles reconnecting.
# Other loop*() functions are available that give a threaded interface and a
# manual interface.
client.loop_forever()

Hello together,
i just found this project and try to set it up. I search, but my climate is not yet listet in the github. Therefore i have to create my own file. I also started reading the codes.
What i dont understand is: Why do they always define codes from 16 to 30 for every command?

Each code represents the temperature in Celsius that the remote sends out; 16-30 represents the min and max range of the remote. You can define them in Fahrenheit too if you desire, with each key being a temperature used. If you edit climate.py in the custom component with the changes listed here, it’ll automatically convert C to F and F to C.

I currently have a sonoff rf bridge that is flashed with tasmota and Portisch Firmware. Im wondering if its possible to implement it with smartir for my fans?