Broadlinkac2mqtt - Control your broadlink-based air conditioner with Home Assistant

Star :star: the project on github if you like it and support me!

I am pleased to present you a new version of the application for controlling air conditioners on the broadlink chipset.
The main reason for the appearance of this project is that the author of a similar project has stopped releasing updates. In addition, there were small errors in that project that did not give me peace of mind, so I decided to completely rewrite this project for myself.

  • Small application size (~10.2 Mb docker, ~8.2 Mb Windows Standalone)
  • Easy to install and use
  • Support all platforms
  • Parallel independent air conditioning support. If one air conditioner is offline, it will not affect the rest!
  • Fixed some errors.

All documentation can be found in the project repository:

Home Assistant Add-on

Install Add-On:

  • Settings > Add-ons > Plus > Repositories > Add https://github.com/ArtemVladimirov/hassio-add-ons
  • broadlinkac2mqtt > Install > Start
6 Likes

Thanks for the effort. However can you make it as addon that we can install directly to home assistant ?

3 Likes

NEW RELEASE V1.0.0

New features:

  • SSL Support #2 #1
  • Added support of Home Assistant BIRTH AND LAST WILL MESSAGES #3

Bug Fixes:

  • User and password in mqtt configuration were required.
  • Sometimes the set temperature was wrong.

I am not familiar with python and my task was to make a universal solution for various smart home systems.

Hi @Artem_Vladimirov, I’m just trying to make this work for my AC. It’s an AUX Q Smart Premium.
I configured it with the AC Freedom app and it seems to work properly.

Your app running in docker doesn’t seem to be able to communicate with the AC.

The logs say:

{"level":"error","error":"read udp 172.18.0.3:42783->192.168.0.115:80: i/o timeout","time":"2023-04-09T21:02:19Z","caller":"/go/src/broadlinkac/app/app/webClient/client.go:43","message":"Fai
led to read the response"}
{"level":"error","input":{"Command":101,"Payload":"RTRS5/ku2pWDRJMINe+abftpLcNwuQRDrFzWP7tTrfoIgUyn+M9BcQAyjlcMO4bJTQVwhEmjieKa4QRUNqBb3dwCwWGvEyXofhmw99HOBo0=","Mac":"xxxxxxxxxxx"},"device
":"xxxxxxxxxxx","time":"2023-04-09T21:02:19Z","caller":"/go/src/broadlinkac/app/app/service/service.go:691","message":"failed to send a command"}
{"level":"error","error":"read udp 172.18.0.3:42783->192.168.0.115:80: i/o timeout","input":{"Mac":"xxxxxxxxxxx"},"time":"2023-04-09T21:02:19Z","caller":"/go/src/broadlinkac/app/app/service
/service.go:140","message":"failed to send command"}
{"level":"error","error":"read udp 172.18.0.3:42783->192.168.0.115:80: i/o timeout","device":"xxxxxxxxxxx","time":"2023-04-09T21:02:19Z","caller":"/go/src/broadlinkac/app/main.go:170","mess
age":"Failed to Auth device xxxxxxxxxxx. Reconnect in 3 seconds..."}
1 Like

Same problem for me. Looks like some communication problem:

broadlinkac2mqtt    | {"level":"debug","time":"2023-04-13T19:58:06Z","caller":"/go/src/broadlinkac/app/config/config.go:47","message":"Start reading a config file"}
broadlinkac2mqtt    | {"level":"info","time":"2023-04-13T19:58:07Z","caller":"/go/src/broadlinkac/app/app/mqtt/mqtt.go:42","message":"Connected to MQTT"}
broadlinkac2mqtt    | {"level":"error","error":"read udp 172.19.0.2:44584->192.168.0.176:80: i/o timeout","time":"2023-04-13T19:58:17Z","caller":"/go/src/broadlinkac/app/app/webClient/client.go:43","message":"Failed to read the response"}
broadlinkac2mqtt    | {"level":"error","input":{"Command":101,"Payload":"RTRS5/ku2pWDRJMINe+abftpLcNwuQRDrFzWP7tTrfoIgUyn+M9BcQAyjlcMO4bJTQVwhEmjieKa4QRUNqBb3dwCwWGvEyXofhmw99HOBo0=","Mac":"ec0baeaa20cf"},"device":"ec0baeaa20cf","time":"2023-04-13T19:58:17Z","caller":"/go/src/broadlinkac/app/app/service/service.go:691","message":"failed to send a command"}
broadlinkac2mqtt    | {"level":"error","error":"read udp 172.19.0.2:44584->192.168.0.176:80: i/o timeout","input":{"Mac":"ec0baeaa20cf"},"time":"2023-04-13T19:58:17Z","caller":"/go/src/broadlinkac/app/app/service/service.go:140","message":"failed to send command"}
broadlinkac2mqtt    | {"level":"error","error":"read udp 172.19.0.2:44584->192.168.0.176:80: i/o timeout","device":"ec0baeaa20cf","time":"2023-04-13T19:58:17Z","caller":"/go/src/broadlinkac/app/main.go:170","message":"Failed to Auth device ec0baeaa20cf. Reconnect in 3 seconds..."}
1 Like

I have analyzed the logs. The problem is that the application does not receive any response. Only two reasons can lead to this:

  1. The air conditioner uses a non-standard port. Not port 80, but some other.
  2. A different protocol is used. But it is very unusual that there is no response at all.

To determine exactly what the problem may be, you can monitor the traffic between the AC Freedom app and the air conditioner using Wireshark. You can see which port is being used there. In addition, you can see the authorization payload there (the first message between AC Freedom and AC) and send it to me. I can already use it to determine if a different message format is being used.

It looks something like this

	Request

0000   34 ea 34 da da c8 e0 d5 5e 68 9e 3e 08 00 45 00
0010   00 a4 16 d4 00 00 80 11 00 00 c0 a8 01 24 c0 a8
0020   01 13 f9 a1 00 50 00 90 84 29 5a a5 aa 55 5a a5
0030   aa 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040   00 00 00 00 00 00 00 00 00 00 de f0 00 00 2a 4e
0050   65 00 63 f7 34 ea 34 da da c8 00 00 00 00 a1 c3
0060   00 00 45 34 52 e7 f9 2e da 95 83 44 93 08 35 ef
0070   9a 6d fb 69 2d c3 70 b9 04 43 ac 5c d6 3f bb 53
0080   ad fa 08 81 4c a7 f8 cf 41 71 00 32 8e 57 0c 3b
0090   86 c9 4d 05 70 84 49 a3 89 e2 9a e1 04 54 36 a0
00a0   5b dd dc 02 c1 61 af 13 25 e8 7e 19 b0 f7 d1 ce
00b0   06 8d

	Response

0000   e0 d5 5e 68 9e 3e 34 ea 34 da da c8 08 00 45 00
0010   00 74 56 1e 00 00 40 11 a0 d3 c0 a8 01 13 c0 a8
0020   01 24 00 50 f9 a1 00 60 18 82 5a a5 aa 55 5a a5
0030   aa 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040   00 00 00 00 00 00 00 00 00 00 28 dc 00 00 2a 4e
0050   e9 03 63 f7 34 ea 34 da da c8 00 00 00 00 c1 c7
0060   00 00 bb 6c bb bb 34 58 5c d4 42 b9 cf bb db 30
0070   3e ea 55 af e0 62 cd d6 38 16 4b 81 cc 38 40 84
0080   ef 9e

Hi, Artem!

I’ve faced with some checksum error. The log says:

{"level":"error","input":{"Command":106,"Payload":"FLucRpm5EV2o+VxYVGBZjg==","Mac":"ec0bae0c170a"},"time":"2023-04-24T17:21:24Z","caller":"/go/src/broadlinkac/app/app/service/service.go:332","message":"Checksum is incorrect"}
{"level":"error","error":"ErrorInvalidResultPacket","device":"ec0bae0c170a","time":"2023-04-24T17:21:24Z","caller":"/go/src/broadlinkac/app/app/service/service.go:1130","message":"Failed to get AC States"}

Any guess?
Thanks!

Thanks, for the integration. I was able to add my AC to HA.

For those who want to use the binary over docker, you can download the binary to folder inside HA (e.g. /root/broadlink), give execution permission chmod +x /path/to/the/broadlinkac2mqtt. Don’t forget to create the config.yml inside the config folder (this folder must be alongside the binary).

Folder
    ├── broadlinkac2mqtt
    └── config
        └── config.yml

Then create a service unit as /etc/systemd/system/broadlinkac2mqtt.service with the following contents (adapted from this post):

[Unit]
Description=AC connection service
After=syslog.target network.target ha.service
PartOf=ha.service

[Service]
WorkingDirectory=/path/to/the
ExecStartPre=/bin/sleep 20
ExecStart=/path/to/the/broadlinkac2mqtt
Restart=on-failure
RestartSec=60s

[Install]
WantedBy=multi-user.target

Finally, reload systemd systemctl daemon-reload and start and enable it systemctl enable --now broadlinkac2mqtt.service

Everything should be working.

Thanks again.

Same here!

If the problem is that the AC is not using port 80 for connection, you can check with the AC Freedom app which port is the AC using. Go to App -> your AC -> the three dots in the upper right -> Device info There you will be able to find the ip address and port as 192.1.1.x@port
That might help Artem.

Hi!
I have ANDE AC which as I understand is just a rebranded AUX AC for European market. I would like to add it to my Home Assistant (OS version).
I found the project: GitHub - ArtemVladimirov/hassio-add-ons but after adding the repository I get error:
Error fetching addon info: Addon e9fb2284_broadlink-ac-mqtt with version latest does not exist in the store

Looks like something is still missing for full integration?

Update: There was some conflict with the another addon. After it’s removal I was able to install this addon. Will check it out how it works in the evening.

Update2: The addon starts but after a little while stops. In the logs I see the following:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
/run.sh: line 3: /data/broadlinkac2mqtt/config/config.yaml: No such file or directory
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

How do we create that file?

You can manually create the directory with mkdir -p /data/broadlinkac2mqtt/config and then create the config.yaml and edit it with vi or nano and configure it with this config example.

Thank you for the reply!

I did as you recommended but now I am getting a different error:

/bin/ash: /broadlinkac2mqtt/broadlinkac2mqtt: not found

Looks like this directory is internal to the container not the mounted one. Does it mean that we need a new docker image?

I am trying to create Hassio Addon, but always get the same error. This mistake pisses me off.

I can’t understand why the docker container doesn’t see this binary file. I can’t execute it. At the same time, I can run a script that is located next to the executable file. If there are people with experience here, then I really ask for help. :innocent:

1 Like

Hi! I am not a big Docker specialist but perhaps you need to prepend the script with the executable like bash/sh or something?

As a side note, perhaps you need to make the file executable with chmod +x

My logs:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
/broadlinkac2mqtt/run.sh: line 6: /broadlinkac2mqtt/broadlinkac2mqtt: not found
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

I tried to do this during the build of the docker file and even during the script launch. But it has no effect.
I added this command to the current docker file and to the script run.sh. At the moment, I have added this command to the current docker file and to the script run.sh .

Do you still need to specify directory if the script is already in the working directory (/broadlinkac2mqtt/broadlinkac2mqtt)? Just wondering.

Also, if my memory serves me well, the file needs to be in the environment paths to be executed without executable. Can you try ./broadlinkac2mqtt instead of /broadlinkac2mqtt/broadlinkac2mqtt ?

I think some AC are cloud connected only😡

There is absolutely no local broadcast whatsoever when I use wireshark to monitor the AC

I tried this, also, I have tried to start it directly in dockerfile. But for some reason, it is impossible to run only the *.sh script, and the application file does not want to run in any way. I spent several days on this and didn’t understand what I was doing wrong. I think this is a feature of hassio, but I can’t find documentation on this issue. I’ve done a lot of dockerfile on regular systems, but something is clearly wrong here.