K02 WIFI USB with NetHome app

Hello everyone,
I have kaysun controllable wifi air conditioners with this application:
https://play.google.com/store/apps/details?id=com.idelan.NetHome&hl=fr
Each air conditioner is connected in wifi to my router.
Is it possible to integrate it in OH and what binding to find them?
This may interest a few people using a similar system.

2 Likes

I couldn’t do an exhaustive search but some quick looking dod not reveal a publically documented API for communicating with these devices. Thus if one were to try to build a binding they would have to reverse engineer the API by sniffing the traffic and even this will only work if the traffic is not encrypted.

Thank you for your reply. I master the network well enough to try to find some answers, I will come back with some elements that may be able to illuminate people. I have the same system on other brands of air conditioner which makes this search interesting for the community.

Dear Regis,

I also own 4 A/C units that are controllable by the Invmate application.
I tried contacting the supplier in my country for getting information about the API, but they are not willing to provide it.

I plan to contact HangZhou DeLan Technology Co., Ltd., which appears to be the company behind the wifi module.

Have you managed to get any answers on how to get it work with openhab?

Best,
mod

Also I found out that the same API is probably used on devices like:
Inventor and Midea among other air conditioner units.

The company is http://www.idelan.cn/ I guess?

I have not yet found a way to control my device with OpenHab.
I contacted a French wholesaler who distributes this product to find out if he had a solution. I wait for his answer, I discussed at length the advantage of operating his air conditioning on a centralized system rather than an application android. By snorting the signal, I was able to recover some frame but I have not pushed further. Here is what I recovered:

<?xml version="1.0" encoding="utf-8"?><message mills="1496588021877" ver="2.0" type="1" sub_type="1" dev=""sub_dev=""  ><body cmd="CMD_DEVICE_SCAN" brand="0"  type="NORMAL" action="SET"></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Regis" serial="K00DLFF2BV015506A11798" port="20088" connected="1" seq="595800" apc_type="172" apc_sn="K00DLFF2BV015506A11798"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+ch+amis" serial="K00DLFF2BV01532732E542" port="20088" connected="1" seq="16286700" apc_type="172" apc_sn="K00DLFF2BV01532732E542"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Lo%C3%AFc" serial="K00DLFF2BV0155061D1192" port="20088" connected="1" seq="10218300" apc_type="172" apc_sn="K00DLFF2BV0155061D1192"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8"?><message mills="1496588024282" ver="2.0" type="1" sub_type="1" dev=""sub_dev=""  ><body cmd="CMD_DEVICE_SCAN" brand="0"  type="NORMAL" action="SET"></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Regis" serial="K00DLFF2BV015506A11798" port="20088" connected="1" seq="597900" apc_type="172" apc_sn="K00DLFF2BV015506A11798"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+ch+amis" serial="K00DLFF2BV01532732E542" port="20088" connected="1" seq="16289100" apc_type="172" apc_sn="K00DLFF2BV01532732E542"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Lo%C3%AFc" serial="K00DLFF2BV0155061D1192" port="20088" connected="1" seq="10220700" apc_type="172" apc_sn="K00DLFF2BV0155061D1192"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8"?><message mills="1496588026684" ver="2.0" type="1" sub_type="1" dev=""sub_dev=""  ><body cmd="CMD_DEVICE_SCAN" brand="0"  type="NORMAL" action="SET"></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Salon" serial="K00DLFF2BV015506340876" port="20088" connected="1" seq="46337400" apc_type="172" apc_sn="K00DLFF2BV015506340876"  model="0" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Salon" serial="K00DLFF2BV015506340876" port="20088" connected="1" seq="46339800" apc_type="172" apc_sn="K00DLFF2BV015506340876"  model="0" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+ch+amis" serial="K00DLFF2BV01532732E542" port="20088" connected="1" seq="16291200" apc_type="172" apc_sn="K00DLFF2BV01532732E542"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Lo%C3%AFc" serial="K00DLFF2BV0155061D1192" port="20088" connected="1" seq="10223100" apc_type="172" apc_sn="K00DLFF2BV0155061D1192"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Regis" serial="K00DLFF2BV015506A11798" port="20088" connected="1" seq="600300" apc_type="172" apc_sn="K00DLFF2BV015506A11798"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8"?><message mills="1496588029083" ver="2.0" type="1" sub_type="1" dev=""sub_dev=""  ><body cmd="CMD_DEVICE_SCAN" brand="0"  type="NORMAL" action="SET"></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Regis" serial="K00DLFF2BV015506A11798" port="20088" connected="1" seq="602700" apc_type="172" apc_sn="K00DLFF2BV015506A11798"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Salon" serial="K00DLFF2BV015506340876" port="20088" connected="1" seq="46342200" apc_type="172" apc_sn="K00DLFF2BV015506340876"  model="0" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+ch+amis" serial="K00DLFF2BV01532732E542" port="20088" connected="1" seq="16293900" apc_type="172" apc_sn="K00DLFF2BV01532732E542"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Lo%C3%AFc" serial="K00DLFF2BV0155061D1192" port="20088" connected="1" seq="10225800" apc_type="172" apc_sn="K00DLFF2BV0155061D1192"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8"?><message mills="1496588031482" ver="2.0" type="1" sub_type="1" dev=""sub_dev=""  ><body cmd="CMD_DEVICE_SCAN" brand="0"  type="NORMAL" action="SET"></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Lo%C3%AFc" serial="K00DLFF2BV0155061D1192" port="20088" connected="1" seq="10227900" apc_type="172" apc_sn="K00DLFF2BV0155061D1192"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+ch+amis" serial="K00DLFF2BV01532732E542" port="20088" connected="1" seq="16296000" apc_type="172" apc_sn="K00DLFF2BV01532732E542"  model="1" brand="0"  pro_ver="0" apc_ver="0"/></body></message><?xml version="1.0" encoding="utf-8" ?><message ver="2.0" type="1" sub_type="2" dev="1" sub_dev="1.0" support="2" sw="2.1.10" hw="2.0.0" pv="2" outid="1417407377"><body cmd="CMD_DEVICE_SCAN" type="NORMAL" action="ACK"><device name="Clim+Salon" serial="K00DLFF2BV015506340876" port="20088" connected="1" seq="46344600" apc_type="172" apc_sn="K00DLFF2BV015506340876"  model="0" brand="0"  pro_ver="0" apc_ver="0"/></body></message>

Wish we had some idea on this. Nice system, but really hate I can’t use OpenHAB to control it based on outside temps and stuff.

For your information, the K02 wifi keys work well with Midea applications:
https://play.google.com/store/apps/details?id=com.midea.ac.iotappen&rdid=com.midea.ac.iotappen
It’s pretty cool, you can program and add rules but it will be even better to link to OpenHab especially if it already controls your store or shutter as it does it at home.

Salut RĂ©gis,
Did you have any luck with the Midea / Openhab interfacing? I’ve got a Kaysun/Midea mini-split system on the way so will also look into it when it arrives.
Cheers

Just have also a Midea installation. Next week, they will fire it up.
I’m not able to check out the wifi dongles or applications. But certainly very intrested to get it running with OpenHAB
 :wink:

Many brands of air conditioners use the application Midea and unfortunately I have not yet found a tip to integrate orders by openhab.
I discovered this a few days ago :
https://assistant.google.com/services/a/uid/0000001b43c52605?hl=en-US
But I have not yet tried to run my air conditioners with my google assistant.

Cool, thanks!

Not sure if this can help, but found something with SDK info.
Can we use this to try to connect to the Midea app (usb dongles)?

ps I don’t have real program skills. But can certainly help out to test/lookukp/
 things


Hey guys,
I’m actually not (yet) using openhab but I’ve found a really useful way to control the Midea devices using Ruby. I’ve already tested it and it really works (at least using a Ruby script). So it’s up to use to integrate this into openhab :wink:

API client for Midea AC systems

1 Like

I found that, work fine with this

It does not hurt and one of Home Assistant’s developer has released a pyton code to run these wifi keys that come with a lot of air conditioner brands. The question is, how to integrate this script in openhab.
Here is the page of his script:

I found this adaptation of the script, someone to help to use it? How to make it work under openhab? there is no instructions for use.

1 Like

Sample configuration:
https://github.com/JacekDob/midea-openhab

1 Like

I’m trying to get this working. Sadly I couldn’t find directly what I just need to do/install.
For the moment, i’ve got 2 questions.

  1. How do you get the APPKEY? Can’t find this in the official midea android app. :blush:
APPKEY = '3742e9e5842d4ad59c2db887e12449f9'  # from android application or any other working
  1. When I run ‘python main.py’, I’m getting following error:
raceback (most recent call last):
  File "main.py", line 16, in <module>
    from midea.client import client as midea_client
  File "/usr/local/lib/python2.7/dist-packages/midea/client.py", line 21
    def build_device(cloud_service: cloud, device_detail: dict):
                                  ^
SyntaxError: invalid syntax

Any idea?

Hi,
Install requests and crypto :
sudo apt-get install python3-requests
sudo apt-get install python3-crypto

Now, i have this :
Traceback (most recent call last):
File “main.py”, line 356, in
should_quit = main_loop()
File “main.py”, line 328, in main_loop
midea_init()
File “main.py”, line 35, in midea_init
devices = client_inst.devices()
File “/etc/openhab2/scripts/midea/client.py”, line 43, in devices
self.setup()
File “/etc/openhab2/scripts/midea/client.py”, line 40, in setup
self._cloud.login()
File “/etc/openhab2/scripts/midea/cloud.py”, line 117, in login
self.get_login_id()
File “/etc/openhab2/scripts/midea/cloud.py”, line 108, in get_login_id
‘loginAccount’: self.login_account
File “/etc/openhab2/scripts/midea/cloud.py”, line 79, in api_request
r = requests.post(url=url, data=data)
NameError: name ‘requests’ is not defined