mill1000 / midea-msmart

Python library for local control of Midea (and associated brands) smart air conditioners.
MIT License
49 stars 2 forks source link

GIatsu air conditioning support: No supported fan modes detected #88

Closed tabascoz closed 11 months ago

tabascoz commented 11 months ago

Hi There, first of all, thanks for the fork and all updates, the integration is awesome!

I have some Giatsu Aroma2 air conditioning, shipped with eu-sk105 wifi. I installed the integration in my homeassistant and it works all good, except for two things: there's no fan mode control. in HA card, the fan mode is empty and i cannot control it. And second thing is the display LED. the card appears, but nothing happens in AC when i switch it. In HA log, it is recorded an error "Device is not capable of display control."

Could you guide-me or point me how it is possible to sniff communication from smarthome and get these commands to be implemented? Or of course any other way better suitable? thanks in advance! kind Regards, Fernando

mill1000 commented 11 months ago

Hi Fernando. Thanks for using the fork.

there's no fan mode control. in HA card, the fan mode is empty and i cannot control it.

I recently added a feature in mill1000/midea-ac-py to only show supported fan modes. These are populated according to the device capabilities. Your device might not report this capability which will require a workaround.

And second thing is the display LED. the card appears, but nothing happens in AC when i switch it. In HA log, it is recorded an error "Device is not capable of display control."

This has been reported before (https://github.com/mill1000/midea-ac-py/issues/21#issue-1871700242). In some cases, it appears there are devices that only support LED control via the remote.

  1. To start I'd like to know what your device's reported capabilities are. You can either use the msmart-ng command or enable debug logging in Home Assistant.

    msmart-ng query --capabilities --auto DEVICE_IP
  2. Can you control the display LED via the OEM application? (e.g. MSmartHome, NetHomePlus, etc)

tabascoz commented 11 months ago

Hi There Mill1000, thanks for your attention, please find below the results:

  1. note ~ # msmart-ng query --capabilities 192.168.51.36
    INFO:msmart.cli:Querying device capabilities.
    INFO:msmart.lan:Creating new connection to 192.168.51.36:6444.
    ^Cnote ~ # msmart-ng query --capabilities --auto 192.168.51.36
    INFO:msmart.cli:Discovering 192.168.51.36 on local network.
    INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
    INFO:msmart.lan:Creating new connection to 192.168.51.36:6444.
    INFO:msmart.lan:Authenticating with 192.168.51.36:6444.
    INFO:msmart.lan:Authenticating with 192.168.51.36:6444.
    INFO:msmart.lan:Authentication successful. Expiration: 2023-10-26T21:16:45, Local key: df98dbc7af44ad30c2af7475d91c43a2490095017f56a770ad208dc82437f749
    INFO:msmart.cli:Querying device capabilities.
    INFO:msmart.cli:{'supported_modes': [<OperationalMode.FAN_ONLY: 5>, <OperationalMode.DRY: 3>, <OperationalMode.COOL: >, <OperationalMode.HEAT: 4>, <OperationalMode.AUTO: 1>], 'supported_swing_modes': [<SwingMode.OFF: 0>, <SwingMode.HORIZONTAL: 3>, <SwingMode.VERTICAL: 12>, <SwingMode.BOTH: 15>], 'supported_fan_speeds': [], 'supports_custom_fan_speed': False, 'supports_eco_mode': True, 'supports_turbo_mode': True, 'supports_freeze_protection_mode': True, 'supports_display_control': False, 'supports_filter_reminder': False, 'max_target_temperature': 30, 'min_target_temperature': 16}
  2. no, i cannot control display leds, only from the remote.

mill1000 commented 11 months ago

Thanks.

  1. The supported fan modes aren't getting populated, as I suspected. Can you run the command again with debug logging?

    msmart-ng query -d --capabilities --auto 192.168.51.36
  2. Unfortunately it looks like your device's display can't be controlled via the network.

tabascoz commented 11 months ago

Hi please find below:

note ~ # msmart-ng query -d --capabilities --auto 192.168.51.106
DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.cli:Discovering 192.168.51.106 on local network.
DEBUG:msmart.discover:Discovery sent to 192.168.51.106:6445.
DEBUG:msmart.discover:Discovery sent to 192.168.51.106:20086.
DEBUG:msmart.discover:Waiting 5 seconds for responses...
DEBUG:msmart.discover:Discovery response from 192.168.51.106: 837000c8200f00005a5a0111b8007a8000000000e47213161a0a1714beaa0200008b0000000000000000018000000000057881b6c1821855bc1853aa2b14c34dc820cce3bcf8e9a84ccb3d138590a2f149abfff629d96387fd301d05d8d4bd4c1a3c2f5b742abfb1c72dcde1b96ebe64f221be7152f0bc8561f4a4c489caf1d7af07247d607980f5ea909c34540b991f4bdfb3e16e33d88768cc4c3d0658937d0bb19369bf0317b24d3a4de9e6a131060e1a3001edbc9df6c4152bcb220d0a116e0220f13f79a255407186f0e7d814fc
DEBUG:msmart.discover:Decrypted data from 192.168.51.106: 6a33a8c02c19000030303030303050303030303030305131383846324244343141333934303030300b6e65745f61635f413339340000870002000000000000000000ac00acac0000000088f2bd41a394150029092122000301000000000000000000000000000000000000000000000000000000000000000000
INFO:msmart.cloud:Using Midea cloud server: https://mp-prod.appsmb.com (China: False).
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=%2Fv1%2Fuser%2Flogin%2Fid%2Fget "HTTP/1.1 200 "
DEBUG:msmart.cloud:API response: {"code":"0","msg":"ok","data":{"loginId":"9e3dedd9-38ec-4979-886f-272925ba"}}
DEBUG:msmart.cloud:Received loginId: 9e3dedd9-38ec-4979-886f-272925ba
DEBUG:msmart.discover:Discovered 1 devices.
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=%2Fmj%2Fuser%2Flogin "HTTP/1.1 200 OK"
DEBUG:msmart.cloud:API response: {"code":0,"msg":"成功","data":{"randomData":"25b1b619aa65e137e54b9034606e1cdc6d6ef02ab9900615af7c4351098ce776","uid":"83947250d2448ffdf02e111c74bad51e","accountId":"1023665078","nickname":"midea","mdata":{"tokenPwdInfo":{"tokenPwd":"647a7f64607b4a40bd3dd6880264a70d","expiredDate":1700950798564,"createDate":1698358798564},"userInfo":{"sourceId":"mj_12345","empId":"5456771537545216","address":"","gender":"0","mobile":"midea@mailinator.com","userDeptInfoList":null,"extras":null,"nameEn":null,"employeeNumber":null,"headPhoto":null,"uid":"83947250d2448ffdf02e111c74bad51e","name":"midea@mailinator.com","email":null},"doDeviceBind":null,"accessToken":"T1iavr56yc5c59a0v","signUnlockEnabled":null},"accessToken":"1381edb46c9e7f7db01d239d3035be3a0296b252cf85a16864258d1ececf50d1","userId":"89056511576065","email":"midea@mailinator.com"}}
DEBUG:msmart.cloud:Received accessToken: T1iavr56yc5c59a0v
DEBUG:msmart.discover:Fetching token and key for udpid '4948bd1726cc71144aa52082b7f0b2a7' (little).
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=%2Fv1%2Fiot%2Fsecure%2FgetToken "HTTP/1.1 200 OK"
DEBUG:msmart.cloud:API response: {"code":"0","msg":"ok","data":{"tokenlist":[{"udpId":"4948bd1726cc71144aa52082b7f0b2a7","key":"9af58052e2b242beb631566ca716580ab11205413f3545278f634b5bb79537c8","token":"CAB5183F5D053A56745CF0572AF3FD716A7EC7A89F233E6F0AA25D1992F11C2A0B5F829B017EE86167982F9472C54EDA34B501A5C1E316B45F5A1133F7425F17"}]}}
INFO:msmart.lan:Creating new connection to 192.168.51.106:6444.
DEBUG:msmart.lan:Connected to 192.168.51.106:6444.
INFO:msmart.lan:Authenticating with 192.168.51.106:6444.
DEBUG:msmart.lan:Sending data to 192.168.51.106:6444: 8370004020000000cab5183f5d053a56745cf0572af3fd716a7ec7a89f233e6f0aa25d1992f11c2a0b5f829b017ee86167982f9472c54eda34b501a5c1e316b45f5a1133f7425f17
DEBUG:msmart.lan:Received data from 192.168.51.106:6444: 83700005200f00204552524f52
DEBUG:msmart.discover:Fetching token and key for udpid '6e0220f13f79a255407186f0e7d814fc' (big).
INFO:httpx:HTTP Request: POST https://mp-prod.appsmb.com/mas/v5/app/proxy?alias=%2Fv1%2Fiot%2Fsecure%2FgetToken "HTTP/1.1 200 OK"
DEBUG:msmart.cloud:API response: {"code":"0","msg":"ok","data":{"tokenlist":[{"udpId":"6e0220f13f79a255407186f0e7d814fc","key":"ca302e53a2094e21a7582101f86bc950096b6fc07d0e49f2a8e13bcaa42d059d","token":"2695B6427D3F25032650E289546812F8F76A7BA915FF58042CEFF6CDF51B69D373F6C7423A1B9DB52E60B30949E1AF8DC216D6DAEA5FADA03CDE741C63DFEB06"}]}}
INFO:msmart.lan:Authenticating with 192.168.51.106:6444.
DEBUG:msmart.lan:Sending data to 192.168.51.106:6444: 83700040200000012695b6427d3f25032650e289546812f8f76a7ba915ff58042ceff6cdf51b69d373f6c7423a1b9db52e60b30949e1af8dc216d6daea5fada03cde741c63dfeb06
DEBUG:msmart.lan:Received data from 192.168.51.106:6444: 837000402001214e061e9927cf711412cb731e4ee9998f72dfe5298ae460fbe9bb55385043ed6fa4e178594ab640f1ea5d3434d8411ae3ac007ad5aca89c613f3964652be3fa8983
INFO:msmart.lan:Authentication successful. Expiration: 2023-10-27T10:20:00, Local key: 8087f922b2ed1563e4117945960b1715ce9db086acac15b42dc8e78daaaed8da
DEBUG:msmart.base_device:Sending command to 192.168.51.106:6444: aa21ac8d000000000003418100ff03ff000200000000000000000000000003016971
DEBUG:msmart.lan:Sending packet to 192.168.51.106:6444: 5a5a011168002000000000003a0114161a0a1714beaa0200008b0000000000000000000000000000b8436dd15e84d5a4fc6fbf77d2b12486e10c552981b23022cb71ea0fc54dc25ecfa0ce55888ac57fc42a7eacc3285d37d30226fe721ab8b30aa4bc796aad8095
DEBUG:msmart.lan:Sending data to 192.168.51.106:6444: 8370008e2066b8529ccac2da0a607921b9f74a3baef55b08e0e28e374d7eb77ca12e657c8090c7b5d011e598089618befb7233c743b6e34e38897acc871d36d7019a2a8574f1c3abe35e264ca598e0c122af42c05e3b3be113ad9edca452a5b4aef73410a67cbd3cfd28461bd44bc33247ed945fdc0fcdf9dc6650ae5e17572997a7f50b4124a54ac43cbc44b094a1ce1639293cf6c8
DEBUG:msmart.lan:Received data from 192.168.51.106:6444: 8370008e20637fd21d0f1b5f5f81694dbef79ae1abd8e938ed69f2d8e9570ba252b4cf254cd2cf3d656b3372298d401c91ecb0beb8ea8803efd92e6ab0c3caafccfda412b48def9421168a6f8667f51a5b0dd33d58dea9a6ef329b8d03aa880b9d73cc1c61a35450ed5584c74ad8357169a61fd26ba1fc7443f2391ff439b93cb60f731c8fa7d9e138a63f8633d0634d56d6768c2e48
DEBUG:msmart.lan:Received packet from 192.168.51.106:6444: 5a5a01116800208000000000a60214161a0a1714beaa0200008b0000000000000000018000000000f8a6f811eb1c20d297e2cdead74536f390ec91f3cf08df417d5cf5aa1fe024ca302226ce7ff4dcda9aa2ed0b5ffa60e51245f211223e5257dfa928228329ea03
DEBUG:msmart.lan:Received response from 192.168.51.106:6444: aa22ac00000000000303c00187667f7f00308000005c4f00000000000000000069e5d7
DEBUG:msmart.base_device:Response from 192.168.51.106:6444 in 0.590000 seconds.
DEBUG:msmart.device.AC.command:State response payload: c00187667f7f00308000005c4f00000000000000000069
INFO:msmart.cli:Querying device capabilities.
DEBUG:msmart.base_device:Sending command to 192.168.51.106:6444: aa0faca3000000000003b50111022fa7
DEBUG:msmart.lan:Sending packet to 192.168.51.106:6444: 5a5a01115800200000000000110214161a0a1714beaa0200008b000000000000000000000000000008863383a51f6d4436ea7dd0f0c64916915c618b02ed2747fad73f2ffa0db1d39e4b73c530cb32388c4998df4898a1a4
DEBUG:msmart.lan:Sending data to 192.168.51.106:6444: 8370007e2066c990f42eac0873076ac1612a0d89a24add4aed1aab6537b31f95d81d3ae05c452e0ade7fe082ce9456331b0d90a8faee75593c5e2c5cf52eca352b7cd13fcac9bb53a1b9ccd62e2ff8bcf14ff571f6ed35032bf597c6021c93a0f06f724c45dfd000b71a984a36c6784c694139f506347712ca8adcde040365ac289a3d3a35ac
DEBUG:msmart.lan:Received data from 192.168.51.106:6444: 8370008e2063cccb72713cf98c7c5670fe939b097f21340723830350b7d240fad18b30fe6f2e2461551c37309813ce030e277fdf042da59095b565e23b839263fee1702c6cc3e216bf9e40253d7fdc34a17dd4b7308f5db0e7b211428c79b1565e1d9d606c1f1588bd391620acee5cfaf353095bfa86e33b9a265f8c779a4fc2cacd639401d29fc3ab9b761e5b8ed8460c1647b14d57
DEBUG:msmart.lan:Received packet from 192.168.51.106:6444: 5a5a01116800208000000000658214161a0a1714beaa0200008b00000000000000000180000000002ed30f7318deb2150985a069e6df704fc6c5350d624b48edff5254e941e2aad1eb8d98ade0f90bb5f67d9331fb42c16dcb78eb253c394fe87d360612e1448cd9
DEBUG:msmart.lan:Received response from 192.168.51.106:6444: aa29ac00000000000303b5071202010113020101140201011502010116020101170201001a020101dedb
DEBUG:msmart.base_device:Response from 192.168.51.106:6444 in 0.450000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b5071202010113020101140201011502010116020101170201001a020101
DEBUG:msmart.device.AC.command:Supported capabilities: {'eco_mode': True, 'eco_mode_2': False, 'freeze_protection': True, 'heat_mode': True, 'cool_mode': True, 'dry_mode': True, 'auto_mode': True, 'swing_horizontal': True, 'swing_vertical': True, 'power_stats': False, 'power_setting': False, 'power_bcd': False, 'filter_notice': False, 'filter_clean': False, 'turbo_heat': True, 'turbo_cool': True}
INFO:msmart.cli:{'supported_modes': [<OperationalMode.FAN_ONLY: 5>, <OperationalMode.DRY: 3>, <OperationalMode.COOL: 2>, <OperationalMode.HEAT: 4>, <OperationalMode.AUTO: 1>], 'supported_swing_modes': [<SwingMode.OFF: 0>, <SwingMode.HORIZONTAL: 3>, <SwingMode.VERTICAL: 12>, <SwingMode.BOTH: 15>], 'supported_fan_speeds': [], 'supports_custom_fan_speed': False, 'supports_eco_mode': True, 'supports_turbo_mode': True, 'supports_freeze_protection_mode': True, 'supports_display_control': False, 'supports_filter_reminder': False, 'max_target_temperature': 30, 'min_target_temperature': 16}

( i just changed the AC to the one i tryed Fme mode - but same model same batch)

mill1000 commented 11 months ago

Thanks.

As I suspected your device doesn't send any fan speed capabilities, so I'll need to add a workaround for this case.

What fan speeds does your device support? Low, Med, High, Auto?

mill1000 commented 11 months ago

I've got a potential fix in #90

You can test it if you like

pip install git+https://github.com/mill1000/midea-msmart@issue/no_fan_modes
franzenel commented 11 months ago

I installed it from the terminal and it looked like everything went as plan. rebooted and still nothing. do I need to do a full restart and not just home assistant? also do I need to remove the application from HACS first?

mill1000 commented 11 months ago

Can you enable debug logging and post the logs here?

tabascoz commented 11 months ago

Hi Mill1000,

Tested the code, the AC device now has all the three modes in HA: please find the results :)

Low - OK - AC beeps, goes to low and HA updates with Low speed Medium - OK, AC beeps, goes to Medium and HA updates accordingly High - AC beeps, fan goes to high and HA updates to Auto Auto - AC beeps, fan goes to Auto and HA updates to Auto if not switching from high ( as to HA it was in auto already)

So something wrong with high status detection, although it works.

Thanks! :)

franzenel commented 11 months ago

home-assistant_midea_ac_2023-10-31T22-18-20.243Z.log I turned it on and selected the different modes on fan, preset, etc. let me know if you want me to do something else

mill1000 commented 11 months ago

@tabascoz Uhh..odd. I can't explain that, but I'll look into it. Your device does support a "High" fan setting right?

@franzenel Your system is still running the released version of msmart-ng, not the branch with the fix.

2023-10-31 17:36:51.171 INFO (MainThread) [custom_components.midea_ac] Starting midea-ac-py. Using msmart-ng version 2023.10.0.

mill1000 commented 11 months ago

@tabascoz Can you enable debug logging and cycle through each fan mode?

franzenel commented 11 months ago

@mill1000 I ran the install again rebooted and did the debugger. here is the install screen capture image and here is the debugger. home-assistant_midea_ac_2023-11-01T20-36-02.674Z.log but it is still saying the same version. what am I doing wrong? I do still have the old version installed under HACS.

mill1000 commented 11 months ago

@franzenel I mentioned this in another thread: https://github.com/mill1000/midea-ac-py/pull/45#issuecomment-1788070221 but the Home Assistant command line is not the same as the as the actual container running Home Assistant. The pip command needs to be run within the HA container.

  1. According to this link you need to turn off "protection mode"
  2. Run docker ps to identify the HA container. Likely it's called hass or homeassistant
  3. Run docker exec <containername> -it bash
  4. Run the pip command.
franzenel commented 11 months ago

step 3 wouldn't run like you had it. I tried "docker exec -it sh" and now I have it. image works great and thank you for taking the time to help me out. Thank you very much.

mill1000 commented 11 months ago

Great! Thanks for your patience as well.

Do all the fan modes work for you?

franzenel commented 11 months ago

Yes they all seem to work.

On Wed, Nov 1, 2023 at 21:04 Tucker Kern @.***> wrote:

Great! Thanks for your patience as well.

Do all the fan modes work for you?

— Reply to this email directly, view it on GitHub https://github.com/mill1000/midea-msmart/issues/88#issuecomment-1789902255, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVDV6SIRX7JXDDWT4WOBVDYCLWTVAVCNFSM6AAAAAA6GFZIIKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBZHEYDEMRVGU . You are receiving this because you were mentioned.Message ID: @.***>

tabascoz commented 11 months ago

Hi Mill1000,

Yes it does have High setting and it works in smarthome app. Please find the log! thanks once more! ;)

fan.log

mill1000 commented 11 months ago

Odd.

When the device is commanded to the high fan speed (0x64 -> 100) it returns a fan speed value of 0.

I've isolated the fan speed values for visibility.

 nov 02 15:19:06 note hass[6336]: 2023-11-02 15:19:06.455 DEBUG (MainThread) [msmart.base_device] Sending command to 192.168.51.13:6444: aa24ac88000000000002404387 **64** 7f7f003000000000000000000000000000000000835631
 nov 02 15:19:07 note hass[6336]: 2023-11-02 15:19:07.098 DEBUG (MainThread) [msmart.device.AC.command] State response payload: c00187 **00** 7f7f0030000000674a00000000000000000000
 nov 02 15:19:07 note hass[6336]: 2023-11-02 15:19:07.098 DEBUG (MainThread) [msmart.device.AC.device] Unknown <enum 'FanSpeed'>: 0

Here's a comparison when commanded to medium (0x3c -> 60)

 nov 02 15:19:01 note hass[6336]: 2023-11-02 15:19:01.681 DEBUG (MainThread) [msmart.base_device] Sending command to 192.168.51.13:6444: aa24ac88000000000002404387 **3c** 7f7f003000000000000000000000000000000000807f33
 nov 02 15:19:02 note hass[6336]: 2023-11-02 15:19:02.268 DEBUG (MainThread) [msmart.device.AC.command] State response payload: c00187 **3c** 7f7f0030000000674a00000000000000000000

Can you collect logs while you switch the device to high fan speed via the app or remote?

tabascoz commented 11 months ago

Got it - weird.... does it reports 0 also when receiving the auto command?

here what i did, cycled on remote cotrol from low->mid->high->auto with 6-8 seconds in between. hope it helps

log2.log

mill1000 commented 11 months ago

Auto reports 0x66 -> 102 which is expected.

here what i did, cycled on remote cotrol from low->mid->high->auto with 6-8 seconds in between. hope it helps

Sorry I should have specified. That's too fast. The device state is only queried every 15 seconds. So you'll need to wait over 15 seconds per fan state.

tabascoz commented 11 months ago

sure thing! so did with 30 seconds, please note the AC i am testing is the ip 192.168.51.13, i have 5 other ACs... pls find below log3.log

mill1000 commented 11 months ago

Alright thanks! So what's happening is your device uses 80 for high speed, which I removed in this commit https://github.com/mill1000/midea-msmart/commit/d839872233320fca0d8fee15fa0bd60b081b51f7

But upon reviewing some of the reference code it looks like 80 is the correct value for "high", and 100 is for "strong".

From the Lua: https://github.com/mill1000/midea-msmart/blob/210d02ef551345c43ca2e40873a9d6080c1297b8/reference/T_0000_AC_00000Q1B_2023072401.lua#L241

From the plugin

if (windSpeed === "Mute") {
    return 20;
} else if (windSpeed === "Low") {
    return 40;
} else if (windSpeed === "Mid") {
    return 60;
} else if (windSpeed === "High") {
    return 80;
} else if (windSpeed === "Strong") {
    return 100;
} else if (windSpeed === "Auto") {
    return 102;
} else {
    return 102;
}