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

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, I haven't had that issue. It's been running for about a week now, with three units connected, and the only thing I see happening is that the room and outside temperatures sometimes (simultaneously) return 0°C. Apart from that, no issues as yet. the unit's measured outside temperatures apparently don't refresh too often either. Looking in the logs, the outside temperature stays the same for hours at a time.

On one of the units I've also created a blockly script to automatically turn the unit off if the power is "On" at midnight. That works too.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
User avatar
LouiS22
Posts: 433
Joined: Friday 27 February 2015 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Budapest, Hungary
Contact:

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

Post by LouiS22 »

Alain wrote: Sunday 12 July 2020 19:25 No, I haven't had that issue. It's been running for about a week now, with three units connected, and the only thing I see happening is that the room and outside temperatures sometimes (simultaneously) return 0°C. Apart from that, no issues as yet. the unit's measured outside temperatures apparently don't refresh too often either. Looking in the logs, the outside temperature stays the same for hours at a time.

On one of the units I've also created a blockly script to automatically turn the unit off if the power is "On" at midnight. That works too.
Interesting, mine's doing this issue and haven't been able to find what triggers it.
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 »

Does it always do that with "Eco" and the temperature setting? Or is it random and will sometimes change the fan speed or on/off etc also?
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 »

Any errors showing up? Or strange "OnCommands"?
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
User avatar
LouiS22
Posts: 433
Joined: Friday 27 February 2015 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Budapest, Hungary
Contact:

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

Post by LouiS22 »

Alain wrote: Sunday 12 July 2020 19:59 Any errors showing up? Or strange "OnCommands"?
I tested it now, and the obvious change is the following:

20-07-20 10:53:39.493 Status: User: Admin initiated a switch command (11990/Klíma - Mode/Set Level)
2020-07-20 10:53:43.143 Error: (Klíma) Level is: 50

Sure I won't switch it anything, but the AC finished the ECO mode and started to heat.
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 »

LouiS22 wrote: Monday 20 July 2020 10:57
Alain wrote: Sunday 12 July 2020 19:59 Any errors showing up? Or strange "OnCommands"?
I tested it now, and the obvious change is the following:

20-07-20 10:53:39.493 Status: User: Admin initiated a switch command (11990/Klíma - Mode/Set Level)
2020-07-20 10:53:43.143 Error: (Klíma) Level is: 50

Sure I won't switch it anything, but the AC finished the ECO mode and started to heat.
I'm getting the error after a switch command too, but after that it still performs the command that I wanted. I'm not sure why it is giving that error. I haven't looked into it very much to be honest, because after all, it's still doing what I want it to do.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
User avatar
waltervl
Posts: 5721
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 »

LouiS22 wrote: Monday 06 July 2020 12:21
Alain wrote: Saturday 04 July 2020 23:50 I created a repository, but but it's all a bit messy. Not quite sure how to properly go about it as I have used parts from Mac_Zhou (msmart repo) and from NeoArcheron (to obtain device id).

Here's a link to my plugin: https://github.com/awalsum/Qlima
During your tests have you noticed an issue where the AC somehow changes its state (ie from 24 celsius and ECO to ECO OFF and 27celsius) without any interaction?
I had these issue too (BTW thanks Alain for this plugin!).
I fixed it by outcommenting lines 284, 299, 311 as they where trying to update the the Domoticz device with an invalid value like:

Devices[5].Update(nValue=device.power_state, sValue=str(device.operational_mode))
device.operational_mode is auto, heat, cool etc but the Device[5] sValue is expecting 10, 20 30 etc
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
LouiS22
Posts: 433
Joined: Friday 27 February 2015 13:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Budapest, Hungary
Contact:

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

Post by LouiS22 »

waltervl wrote: Sunday 27 September 2020 22:03
LouiS22 wrote: Monday 06 July 2020 12:21
Alain wrote: Saturday 04 July 2020 23:50 I created a repository, but but it's all a bit messy. Not quite sure how to properly go about it as I have used parts from Mac_Zhou (msmart repo) and from NeoArcheron (to obtain device id).

Here's a link to my plugin: https://github.com/awalsum/Qlima
During your tests have you noticed an issue where the AC somehow changes its state (ie from 24 celsius and ECO to ECO OFF and 27celsius) without any interaction?
I had these issue too (BTW thanks Alain for this plugin!).
I fixed it by outcommenting lines 284, 299, 311 as they where trying to update the the Domoticz device with an invalid value like:

Devices[5].Update(nValue=device.power_state, sValue=str(device.operational_mode))
device.operational_mode is auto, heat, cool etc but the Device[5] sValue is expecting 10, 20 30 etc
nice fix! :)
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 »

waltervl wrote: Sunday 27 September 2020 22:03
I had these issue too (BTW thanks Alain for this plugin!).
I fixed it by outcommenting lines 284, 299, 311 as they where trying to update the the Domoticz device with an invalid value like:

Devices[5].Update(nValue=device.power_state, sValue=str(device.operational_mode))
device.operational_mode is auto, heat, cool etc but the Device[5] sValue is expecting 10, 20 30 etc
Thanks waltervl. I had another look at the code and outcommented some lines. I updated the repository on Github.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
User avatar
waltervl
Posts: 5721
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 »

Thanks Alain.
I have another issue that is related to internet connection issues. It seems that when the device cannot be reached, midea refresh() gives back the values in _init_.
So I get sometimes values of 0.0 or 20 for values of indoor, outdoor and target temperatures.
I made an issue for this at the original mmac-zhou/midea-ac-py author because I think it cannot be solved easily in Domoticz plugin. But I am not a Python expert.
https://github.com/mac-zhou/midea-ac-py/issues/38
Last edited by waltervl on Wednesday 28 October 2020 19:41, edited 1 time in total.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
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 »

waltervl wrote: Sunday 18 October 2020 17:59 Thanks Alain.
I have another issue that is related to internet connection issues. It seems that when the device cannot be reached, midea refresh() gives back the values in _init_.
So I get sometimes values of 0.0 or 20 for values of indoor, outdoor and target temperatures.
I made an issue for this at the original mmac-zhou/midea-ac-py author because I think it cannot be solved easily in Domoticz plugin. But I am not a Python expert.
https://github.co/mmac-zhou/midea-ac-py/issues/38
Without having looked into a solution in depth, I'm not sure that there is an easy solution. The units themselves are very unstable in keeping an internet connection. Long before I had even looked into implementing them into Domoticz, I had already connected smart switches in the wall outlets for the power to the devices because often they would appear offline in the Nethome app. The only way to get them online again was to power them down, wait a few seconds and them power them up again. Although the devices cannot be reached in Domoticz intermittently and after a few heartbeats they can again, I do believe this is related.

The only fix I can think of, just quickly, is to verify if the newly obtained value is not equal to zero, then update the Domoticz device, else retain the old value, but that wouldn't work for the power function. When the connection drops, it's default is "False"which is "Off" and that would mean that a genuine "Off" command would never be allowed and therefore be processed.

I have come to just accept this for now.
Hue | Zigbee2Mqtt | MQTT | P1 | Xiaomi | RFXCom | Modbus | Qlima | Solaredge
TP-Link | Plugwise | Thermosmart | Node-Red | Grafana | Master and 5 remote servers
User avatar
waltervl
Posts: 5721
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 did not accept ;-)

I followed your suggestion and checked for the init values and raise an ConnectionError exception when they do. This will skip the updating of Domoticz values so no more 0 degree spikes in temp logging. In the end when the connection fails to many times (eg due to failing Wifi dongle in the device) Domoticz will see the non responsiveness and make the devices color red if it reaches the sensor timeout (default 90 minutes).
I will let it run now for a couple of days, see how it works out.

Code: Select all

    def DataUpdate(self):
        device_ip = Parameters["Address"]
        device_id = Parameters["Mode3"]
        client = midea_device(device_ip, int(device_id),6444)
        device = client.setup()
        
        try:
            device.refresh()
            if device.indoor_temperature == 0.0 and device.indoor_temperature == 0.0 and device.target_temperature == 20.0:
               raise ConnectionError('Could not connect with device',)

            ******* Device updates *************

        except ConnectionError as error:
            Domoticz.Error(repr(error))
            return
        except:
            Domoticz.Error("Qlima (" + Parameters["Address"] + ") unavailable")
            return   
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: 5721
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 »

After a couple of days running with the previous solution no more irregularities! Everything works fine.
A couple of times a day I see the connection error. I have the refresh time of the plugin set to 120 seconds.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
daemonshome
Posts: 19
Joined: Saturday 30 May 2020 15:30
Target OS: -
Domoticz version:
Contact:

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

Post by daemonshome »

Hi all,

Iam trying to setup mudea ac in domoticz, without success.
Anything I am doing wrong?, any hints would be appreciated :).

So far:

Code: Select all

# midea-discover                                                    
INFO:msmart.cli:msmart version: 0.1.23                                                               
INFO:msmart.cli:Sending Device Scan Broadcast...                                                     
INFO:msmart.cli:Midea Local Data 192.168.1.102 xyz
INFO:msmart.cli:Decrypt Reply: 192.168.1.102 xyz                                               
INFO:msmart.lan:Couldn't connect with Device 192.168.1.102:6444                                      
INFO:msmart.cli:*** Found a unsupported device - type: '0xac' - version: V3 - ip: 192.168.1.102 - por
t: 6444 - id: xyz - sn: xyz - ssid: net_ac_A755              
xyz-removed characters
So from here it is visible that the AC is in local network. midea app works as expected, no issues here.


qlima plugn installed into domoticz.
So I have the ip address and port, which I put into qlima plugin inside domoticz. Done.

Log below:

Code: Select all

2020-10-25 14:05:41.363 Status: (qlimaAC) Stop directive received.
2020-10-25 14:05:41.629 Status: (qlimaAC) Exiting work loop.
2020-10-25 14:05:41.663 Status: (qlimaAC) Stopping threads.
2020-10-25 14:05:41.663 Status: (qlimaAC) Stopped.
2020-10-25 14:05:41.663 Status: (qlimaAC) Started.
2020-10-25 14:05:41.779 Status: (qlimaAC) Entering work loop.
2020-10-25 14:05:41.779 Status: (qlimaAC) Initialized version 1.0.0, author 'Alain'
2020-10-25 12:16:06.545 Status: New sensors allowed for 5 minutes...
2020-10-25 14:05:41.363 Status: (qlimaAC) Stop directive received.
2020-10-25 14:05:41.629 Status: (qlimaAC) Exiting work loop.
2020-10-25 14:05:41.663 Status: (qlimaAC) Stopping threads.
2020-10-25 14:05:41.663 Status: (qlimaAC) Stopped.
2020-10-25 14:05:41.663 Status: (qlimaAC) Started.
2020-10-25 14:05:41.779 Status: (qlimaAC) Entering work loop.
2020-10-25 14:05:41.779 Status: (qlimaAC) Initialized version 1.0.0, author 'Alain'
2020-10-25 14:10:15.711 Status: Receiving of new sensors disabled!...
Sensors are available trough domoticz, but values are not updating.

Any addvice?
User avatar
waltervl
Posts: 5721
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 »

Looks like your device is not supported by the midea library that works as the core of the plugin.
What brand and type is your Airconditioning?
Can you controll it through the Nethome plus app on your phone? Or do you use another app?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
daemonshome
Posts: 19
Joined: Saturday 30 May 2020 15:30
Target OS: -
Domoticz version:
Contact:

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

Post by daemonshome »

Midea MBT-12N8D6-O Mission II 3,5 kw

App: Midea Air - working good

As per the forum discussions, midea should work...
User avatar
waltervl
Posts: 5721
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 »

What happens if you fill in your device in the example.py of the midea library? You will have to add to port address 6444 in the device declaration in line 9:
c = midea_device('YOUR_AC_IP', YOUR_AC_ID, 6444)

https://github.com/mac-zhou/midea-msmar ... example.py

If you run this with "python example.py" do you see communication?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
daemonshome
Posts: 19
Joined: Saturday 30 May 2020 15:30
Target OS: -
Domoticz version:
Contact:

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

Post by daemonshome »

Code: Select all

[b]# python example.py[/b]                                  
Traceback (most recent call last):
  from msmart.device import device as midea_device
File "/home/test/midea-msmart-master/msmart/device.py", line 17
  def convert_device_id_hex(device_id: int):
             ^
SyntaxError: invalid syntax
[b]# python3 example.py[/b]
{'id': 'xy', 'name': '192.168.1.102', 'power_state': False, 'prompt_tone': False, 'target_temperature': 17.0,'operational_mode': <operational_mode_enum.auto: 1>, 'fan_speed': <fan_speed_enum.Auto: 102>, 'swing_mode': <swing_mode_enum.Off: 0>, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': 0.0, 'outdoor_temperature': 0.0}{'id': 'xy', 'name': '192.168.1.102', 'power_state': True, 'prompt_tone': False, 'target_temperature': 25, 'operational_mode': <operational_mode_enum.cool: 2>, 'fan_speed': <fan_speed_enum.Auto:102>, 'swing_mode': <swing_mode_enum.Off: 0>, 'eco_mode': False, 'turbo_mode': False, 'indoor_temperature': 0.0, 'outdoor_temperature': 0.0} 
# 
so it seems no , :(

other ideas, libs?
User avatar
waltervl
Posts: 5721
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 »

Looks like it is not connecting to your Midea on python 3. In- and outdoor temperature are reported as 0.0 which is indicating there is no connection.
I read somewhere that there is a difference in wifi dongle version OSK102 and OSK103. 102 is working with this lib, version 103 seems not to be.

Edit: I just checked my wifi dongle manual and it states I have a OSK102.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
daemonshome
Posts: 19
Joined: Saturday 30 May 2020 15:30
Target OS: -
Domoticz version:
Contact:

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

Post by daemonshome »

Correct.
mine is OSK103.
If any addvice would come, what to try, I am in to investigate/develop the solution.

Thanks for the hints and help so far.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest