Midea/Inventor (and other brand) Air Condition API

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

User avatar
waltervl
Posts: 5875
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by waltervl »

Just a heads up for this new possibility for supporting the Midea AC's
The following fork/branch is supporting the *103 WiFi module (ex. SK-103 or OSK-103), using the new protocol called “8370”. For this protocol, you need provide your WiFi AP access data, MAC address of your AC WIFI module, install and run the fake cloud script.
https://github.com/WMP/midea-ac-py/tree/support-8370
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
janvangent2
Posts: 40
Joined: Thursday 18 October 2018 9:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by janvangent2 »

When trying to run the plugin, I receive this error (in domoticz log):
2021-04-07 14:47:43.167 Error: (Qlima) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/midea-msmart/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-04-07 14:47:43.167 Error: (Airco) Module Import failed, exception: 'ModuleNotFoundError'
2021-04-07 14:47:43.167 Error: (Airco) Module Import failed: ' Name: Crypto.Util.Padding'


Any ideas?
User avatar
waltervl
Posts: 5875
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by waltervl »

janvangent2 wrote: Wednesday 07 April 2021 14:59 When trying to run the plugin, I receive this error (in domoticz log):
2021-04-07 14:47:43.167 Error: (Qlima) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/midea-msmart/:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/usr/local/lib/python3.7/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.7/dist-packages'.
2021-04-07 14:47:43.167 Error: (Airco) Module Import failed, exception: 'ModuleNotFoundError'
2021-04-07 14:47:43.167 Error: (Airco) Module Import failed: ' Name: Crypto.Util.Padding'


Any ideas?
I struggled with this too it was something with loading the right crypto library and with sudo or not.
I will check toninght and com back.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5875
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by waltervl »

See https://domoticz.com/forum/viewtopic.php?t=32980
use sudo pip3 to instal: sudo pip3 install pycryptodome
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
janvangent2
Posts: 40
Joined: Thursday 18 October 2018 9:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by janvangent2 »

waltervl wrote: Wednesday 07 April 2021 16:45 See https://domoticz.com/forum/viewtopic.php?t=32980
use sudo pip3 to instal: sudo pip3 install pycryptodome
Thanks! that sorted it!

Now got another issue.
I have 1 Qlima airco unit which I installed 2 years ago, and now got it running with this great plugin.

However, last weekend I installed another Qlima unit, which came with the OSK103 wifi-stick.
waltervl wrote: Thursday 07 January 2021 14:26 Just a heads up for this new possibility for supporting the Midea AC's
The following fork/branch is supporting the *103 WiFi module (ex. SK-103 or OSK-103), using the new protocol called “8370”. For this protocol, you need provide your WiFi AP access data, MAC address of your AC WIFI module, install and run the fake cloud script.
https://github.com/WMP/midea-ac-py/tree/support-8370
--> would this fork work, combined with the plugin.py script from alain?
So in this case I could make 2 folders in my domoticz/plugin folder, one for the old wifi stick, and one for the new wifi stick with the new fork + plugin.py.
Or does the plugin.py needs changes to work with this new brach/fork?
User avatar
waltervl
Posts: 5875
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by waltervl »

I have doubts about that as it uses another version of the msmart Python library. So it could be that installing the special msmart library will break the old plugin.
But you can give it a try of course. Perhaps it is easier to find a 102 stick somewhere.. (Did not look for that though) Someone else in this topic did it this way.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5875
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by waltervl »

Major changes on the midea-msmart library, V3 protocol should now be supported.
https://github.com/mac-zhou/midea-msmart

So users with a 103 wifi stick should now be able to connect to Domoticz.
You can test if the example.py is working.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Deshmir
Posts: 1
Joined: Monday 30 August 2021 15:29
Target OS: -
Domoticz version:
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by Deshmir »

I recently bought a new Qlima SC5225 with wifi, and they are shipped with the a Tuya (ODZ104) wifi stick.
Took a couple of days to get it working with Domoticz, and i miserably failed. Got it connected to Homebridge instead.
So I've contacted PVG International BV and they still sell the OSK-102/103 stick: EAN: 8713508773230 for €22,50 retail price.
I got mine for € 21,27 at WarmteService.
Hopefully back to a normal situation without the annoying Tuya ****
BarryT
Posts: 369
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by BarryT »

Any news on this?
I have 2 Inventor and 1 Qlima (Midea) units over here... Should be great to use them in Domoticz!

Code: Select all

~# midea-discover
INFO:msmart.cli:msmart version: 0.1.35 Currently only supports ac devices.
INFO:msmart.cli:Sending Device Scan Broadcast...
it stays on scan broadcast..
Debugging does see the 3 units as local ips, but after some seconds in debugging, i get a lot login error:

Code: Select all

DEBUG:msmart.cloud:Retrying API call: 'user/login'
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
DEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'

Code: Select all

:~# midea-discover -d
INFO:msmart.cli:Debug mode active
INFO:msmart.cli:msmart version: 0.1.35 Currently only supports ac devices.
INFO:msmart.cli:Sending Device Scan Broadcast...
DEBUG:asyncio:Using selector: EpollSelector
DEBUG:msmart.scanner:Broadcast message sent: 0
DEBUG:msmart.scanner:Midea Local Data 192.168.1.34 83700**
DEBUG:msmart.scanner:Decrypt Reply: 192.168.1.34 2201**
DEBUG:msmart.scanner:Midea Local Data 192.168.1.35 83700**
DEBUG:msmart.scanner:Decrypt Reply: 192.168.1.35 2301**
DEBUG:msmart.scanner:Midea Local Data 192.168.1.25 5a5a**
DEBUG:msmart.scanner:Decrypt Reply: 192.168.1.25 1901**
DEBUG:msmart.scanner:Midea Local Data 192.168.1.26 9634**
DEBUG:msmart.scanner:Decrypt Reply: 192.168.1.26 2101**
Last edited by BarryT on Thursday 14 April 2022 17:36, edited 1 time in total.
BarryT
Posts: 369
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by BarryT »

My goodness, what a meanly help over here.
in the meantime i have 3 devices supported, but what is needed to import this in domoticz?

I'm getting errors, and i'm not able to find out why:

Code: Select all

python example.py
Traceback (most recent call last):
  File "example.py", line 2, in <module>
    from msmart.device import air_conditioning_device as ac
  File "/home/pi/domoticz/plugins/midea-msmart/msmart/device.py", line 16
    def convert_device_id_hex(device_id: int):
I think i'm doing something wrong or forgot something..
could someone please explain me what i need to install from start and to use it to import the units into domoticz?
many, many thanks.
Last edited by BarryT on Thursday 14 April 2022 17:36, edited 1 time in total.
Alain
Posts: 166
Joined: Sunday 26 April 2020 5:27
Target OS: Linux
Domoticz version: 2022.1
Location: Netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by Alain »

BarryT wrote: Sunday 24 October 2021 17:23 My goodness, what a meanly help over here.
The errors you are getting seem to originate from the msmart library, not my Qlima plugin which uses the msmart library. The developer of the msmart library is not an active contributor to this thread, so maybe it's the wrong place to start shouting.

Did you follow the instructions in https://github.com/mac-zhou/midea-ac-py ... /README.md and in https://github.com/NeoAcheron/midea-ac- ... asic-Usage? I'm not sure why you're not finding the ID's of the units.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
Alain
Posts: 166
Joined: Sunday 26 April 2020 5:27
Target OS: Linux
Domoticz version: 2022.1
Location: Netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by Alain »

Code: Select all

File "/home/pi/domoticz/plugins/midea-msmart/msmart/device.py", line 16
    def convert_device_id_hex(device_id: int):
points in the direction of not having the correct unit ID filled in.

When using example.py (I'm assuming that's the python script you're using in a terminal window to see if communication is there), you need to edit the python script (I'm guessing line 4) to include your found unit ID.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
BarryT
Posts: 369
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by BarryT »

Alain wrote: Sunday 24 October 2021 18:01
BarryT wrote: Sunday 24 October 2021 17:23 My goodness, what a meanly help over here.
The errors you are getting seem to originate from the msmart library, not my Qlima plugin which uses the msmart library. The developer of the msmart library is not an active contributor to this thread, so maybe it's the wrong place to start shouting.

Did you follow the instructions in https://github.com/mac-zhou/midea-ac-py ... /README.md and in https://github.com/NeoAcheron/midea-ac- ... asic-Usage? I'm not sure why you're not finding the ID's of the units.
Thanks for answering Alain, it really frustrating me... i'm trying to figure out this for 2 days now, i'm lost.. :roll:
yes i think i have readed this for 10 times or more and started again for more then 20 times..
I deleted the hole bunch, and installed again but now it left me with the login error i had before:
installed first:

Code: Select all

pip3 install msmart
(already installed 5 minutes ago)
output:

Code: Select all

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting msmart
  Using cached https://files.pythonhosted.org/packages/bd/cf/46ae20dd87a63d09c68                                                                                                                                                             984d908f88c01ee230c3c82714cae4a684e407db6/msmart-0.1.35-py3-none-any.whl
Requirement already satisfied: click in /usr/local/lib/python3.7/dist-packages (                                                                                                                                                             from msmart) (8.0.3)
Requirement already satisfied: pycryptodome in /usr/local/lib/python3.7/dist-pac                                                                                                                                                             kages (from msmart) (3.11.0)
Requirement already satisfied: ifaddr in /usr/local/lib/python3.7/dist-packages                                                                                                                                                              (from msmart) (0.1.7)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from                                                                                                                                                              msmart) (2.21.0)
Requirement already satisfied: pycryptodomex in /usr/local/lib/python3.7/dist-pa                                                                                                                                                             ckages (from msmart) (3.11.0)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in /us                                                                                                                                                             r/local/lib/python3.7/dist-packages (from click->msmart) (4.8.1)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packag                                                                                                                                                             es (from importlib-metadata; python_version < "3.8"->click->msmart) (3.6.0)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8"                                                                                                                                                              in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_versi                                                                                                                                                             on < "3.8"->click->msmart) (3.10.0.2)
Installing collected packages: msmart
Successfully installed msmart-0.1.35
then i do, midea-discover:

Code: Select all

INFO:msmart.cli:msmart version: 0.1.35 Currently only supports ac devices.
INFO:msmart.cli:Sending Device Scan Broadcast...
then it hangs till i ctrl+c 2 times... :(
then i did a debug:

Code: Select all

DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): mapp.appsmb.com:443
DEBUG:urllib3.connectionpool:https://mapp.appsmb.com:443 "POST /v1/user/login HTTP/1.1" 200 None
DEBUG:msmart.cloud:Response: {"msg":"login failed, loginId is empty, please login again.","errorCode":"3144"}
^CDEBUG:msmart.cloud:Restarting full: '3144' - 'login failed, loginId is empty, please login again.'
then i login with my credentials in const.py:
i'm getting same errors. i'm lost!
Last edited by BarryT on Sunday 24 October 2021 18:29, edited 1 time in total.
Alain
Posts: 166
Joined: Sunday 26 April 2020 5:27
Target OS: Linux
Domoticz version: 2022.1
Location: Netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by Alain »

I don't have a Domoticz instance running at the moment where I can do some testing without crashing my main instance (I have 668 devices running in that). I have noticed that the msmart library has been updated a few months ago and I don't know if the problems you're having are related to that. It would be interesting to know, if it is.

I have a fresh PC sitting idle at the moment on which I want to install a new instance of Domoticz for testing purposes (I want to get some Broadlink RM4's running). I'll be looking at getting that installed within a week or two, maybe then I can also look into your problem specifically. I'm sorry I'm not able to help you out anymore right now.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
BarryT
Posts: 369
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by BarryT »

Alain wrote: Sunday 24 October 2021 18:27 I don't have a Domoticz instance running at the moment where I can do some testing without crashing my main instance (I have 668 devices running in that). I have noticed that the msmart library has been updated a few months ago and I don't know if the problems you're having are related to that. It would be interesting to know, if it is.

I have a fresh PC sitting idle at the moment on which I want to install a new instance of Domoticz for testing purposes (I want to get some Broadlink RM4's running). I'll be looking at getting that installed within a week or two, maybe then I can also look into your problem specifically. I'm sorry I'm not able to help you out anymore right now.
It is really no problem, just thanks so far.
Glad you want to look into this.
Maybe it has something to do with the buster on rpi 4 maybe?
today i had 4 devices supported, but when using the example script it gives me that error like seen in 2 post back, so i went over again and started from start. now that login error again.. grr
i never had any issues before with other scripts this far, but this one gives me some headache, on sunday.. :lol:
thanks!
Alain
Posts: 166
Joined: Sunday 26 April 2020 5:27
Target OS: Linux
Domoticz version: 2022.1
Location: Netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by Alain »

No worries. When I have some time available, I'll look into it and post back.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
BarryT
Posts: 369
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by BarryT »

Alain wrote: Sunday 24 October 2021 18:38 No worries. When I have some time available, I'll look into it and post back.
Hero, thanks! :)
BarryT
Posts: 369
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by BarryT »

Any news maybe?
Still nothing works... :(
Alain
Posts: 166
Joined: Sunday 26 April 2020 5:27
Target OS: Linux
Domoticz version: 2022.1
Location: Netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by Alain »

I'm sorry I haven't gotten back to you sooner. Unfortunately I've had some stuff going on and haven't yet had the opportunity to setup my test system.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
Alain
Posts: 166
Joined: Sunday 26 April 2020 5:27
Target OS: Linux
Domoticz version: 2022.1
Location: Netherlands
Contact:

Re: Midea/Inventor (and other brand) Air Condition API

Post by Alain »

The error occurs within the msmart part of the deal. I see you opened an issue in my github repository about it, but you should really try to get an answer from over there. I'm willing to try when I have the opportunity to test it, but can't promise anything about it.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest