mill1000 / midea-msmart

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

Attempting to set Anion property causes device to respond with different property ID and an error #124

Closed mill1000 closed 4 months ago

mill1000 commented 4 months ago

Ok, looks like I really botched this anion feature. Your device (and another users #131) is interpreting the anion property (0x021E) as an "eco state" property (0x001E).

But upon further review of the Lua and JS available to me, it appears this Anion property is never actually used and instead it's using a "purifier" function. This might be the ION+UV option you described.

Originally posted by @mill1000 in https://github.com/mill1000/midea-ac-py/issues/128#issuecomment-2098969483

Also https://github.com/mill1000/midea-ac-py/issues/131

mill1000 commented 4 months ago

I've got a potential fix here #126, but I'd like to test it before pushing it into midea-ac-py

To test, either clone the branch

git clone -b issue/anion_purifier https://github.com/mill1000/midea-msmart.git

and run the code below from the project directory.

Or install via pip in a virtualenv, and run the code below.

pip install git+https://github.com/mill1000/midea-msmart.git@issue/anion_purifier

Here's an example script that should test the function.

import asyncio
import logging

from msmart.device import AirConditioner as AC

logging.basicConfig(level=logging.DEBUG)

DEVICE_IP = "YOUR_DEVICE_IP"
DEVICE_PORT = 6444
DEVICE_ID = "YOUR_AC_ID"

# For V3 devices
DEVICE_TOKEN = None  # "YOUR_DEVICE_TOKEN"
DEVICE_KEY = None  # "YOUR_DEVICE_KEY"

async def main():

    # Manually construct the device
    #  - See midea-discover to read ID, token and key
    device = AC(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    # Get device capabilities
    await device.get_capabilities()

    # Refresh the state
    await device.refresh()

    print({
        'id': device.id,
        'ip': device.ip,
        "online": device.online,
        "supported": device.supported,
        'power_state': device.power_state,
        'purifier': device.purifier,
    })

    await asyncio.sleep(1)

    # Change some device properties and apply them
    device.purifier = True
    await device.apply()

    print({
        'id': device.id,
        'ip': device.ip,
        "online": device.online,
        "supported": device.supported,
        'power_state': device.power_state,
        'purifier': device.purifier,
    })

if __name__ == "__main__":
    asyncio.run(main())
v1k70rk4 commented 4 months ago

Hi, here's the requested log :) python3_test.py.log

mill1000 commented 4 months ago

~Well I guess the big question is did it work? Did your device turn on its UV+ ION?~

Hm..the command that went out doesn't look correct actually.

v1k70rk4 commented 4 months ago

I just ran it :D :D I didn't sleep much last night.

So it's the same situation as with the anion :( If it's turned on beforehand, it turns off the UV lamp. If it's off, nothing happens.

v1k70rk4 commented 4 months ago

INFO:msmart.lan:Creating new connection to 192.168.1.60:6444.
DEBUG:msmart.lan:Connected to 192.168.1.60:6444.
INFO:msmart.lan:Authenticating with 192.168.1.60:6444.
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 83700040200000006966ad66bb925b4b48bf212cd4903597df90e05ff453d059eb50f4a741d36d43643e1277cc8c181f55412d70560752cde7e65fbc08cadd71daa7d4a5f655d484
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 837000402001b14c361f7e912465c6604a32d60c136c6aa76708f3f1ecc8eb20deb5b242e84697ae2515a22024860e947740c43219bede9fa523dcd0dd13c5440a67c40af55241ba
INFO:msmart.lan:Authentication successful. Expiration: 2024-05-09T03:37:35, Local key: 0c1eddd31c6307d97ddf3544b799fd4d8a1844dac992081ff662d74d49684343
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa0fac00000000000003b5010001e5a6
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011158002000000000001624250f08051814f0c70100008300000000000000000000000000000542065231b95b9123b7f675b1de90ae915c618b02ed2747fad73f2ffa0db1d3fcd710d1b1f23e836c4b93be49837ce1
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370007e2066fff4df4d43fe23c01c0dac671260a6506cbc4d933780de608562090bbed57ebcedd8c209194c0ef7c022155b59a0ddc27508fbc709533bdf4e6de8aa27ce99156bfa17f03480928d4105492bb761418eccdcc54db2ef72a6200273155e3312e4a94a712523a828bd55241e08271a1d179ded6bff70f25309e3dc29585b651ee7
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370009e20633a6158ca33e37873f2bd5e640ad8f7177f23cb8d3158a11b8a36c89a0360c2f98c27af3f408757d7b7f895fcd42f99ca0db59b697e45f8acaa2720db33da3990cd36d743d84d88e8baa92e4440b56713c7515775e23cc96ed10faa6ed29e5065446c084e82376e5f6231c17dfb8f1f649d70233e07dc87d5e72ef71effd1cedcc2a33599cc42b12e95de040ddb196332dc24b322b9566ffaf4e112fe574bb7e4
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a011178002080000000005b64250f08051814f0c7010000830000000000000000018000000000d50e76f9d56b1b007804ff46779892e434e1f89c6c121888c87c8cf2a94d4d83b80e5bf3567f3e76197a3ce12165c38f963ce4fda737198863136dad8c53af3d8fd19925939c81e16938b4beaca5be4e
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa31ac00000000000203b507120201011402010115020101160201001a02010110020101250207203c203c203c000100602d
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.130000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b507120201011402010115020101160201001a02010110020101250207203c203c203c000100
DEBUG:msmart.device.AC.command:Raw capabilities: {'eco_mode': True, 'eco_mode_2': False, '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, 'turbo_heat': True, 'turbo_cool': True, 'fan_silent': False, 'fan_low': False, 'fan_medium': False, 'fan_high': False, 'fan_auto': False, 'fan_custom': True, 'cool_min_temperature': 16.0, 'cool_max_temperature': 30.0, 'auto_min_temperature': 16.0, 'auto_max_temperature': 30.0, 'heat_min_temperature': 16.0, 'heat_max_temperature': 30.0, 'decimals': False}
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa10ac00000000000003b501010102c1c6
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011158002000000000002324250f08051814f0c70100008300000000000000000000000000004704d4f6cb7e757d97bb0fb355e696691c6cb0cecabc7672cd44e0d17faa570827786d3c3fe0bf77f8965d6e7138c4b2
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370007e20665507a765c5da25df28d011aedbb016ceedcf9df7337731f4a9553cddf479adbe15b963a8e35d7114fe4069db5fc88c2fb2528edfd4e923ec7d1e08896453d01dddded43bb7d59f1060fab328f2d7923475cbd3f6458df9e96bddcfe34007a6ddbcf3a94e6e73448cc77fd3b7ca0cb17dd5a73a20950e4223e9be2c329e49d636
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370009e2063171c79e5e5f6b91f8ed9fe53cdc44e3037cc3bcb715f2ca6466a0732cd404e2397e67f4220c49d33181735bc395a5056afa95c5ffaa99aa0daaf913424a008e9167d431bc33a77b2d6e2f4053bb27f364b1199f81fefda9b73f0d8835944f637c9cba9b88d2f17fdc138372d182d0d36a9f1ee6dce38bd7170b3d8126edbd4bbcab6aeb4e22e03d05c5e89107864413c94b868771280b0d2285a705501ca6929
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a01117800208000000000e564250f08051814f0c701000083000000000000000001800000000034a388355e4a208f9971c44c48082c155eab2881baca7cf77395a43aa7e53eabe065702bba646a72fab00dbd339a523e915c618b02ed2747fad73f2ffa0db1d3434b6a21f92879b71dd2d988a6d1cf47
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa2fac00000000000203b5081e0201011302010122020100190201003900010142000101090001010a00010100008bc8
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b5081e0201011302010122020100190201003900010142000101090001010a0001010000
DEBUG:msmart.device.AC.command:Raw capabilities: {'anion': True, 'freeze_protection': True, 'fahrenheit': True, 'aux_electric_heat': False, 'self_clean': True, 'one_key_no_wind_on_me': True, 'swing_vertical_angle': True, 'swing_horizontal_angle': True}
DEBUG:msmart.device.AC.command:Merged raw capabilities: {'eco_mode': True, 'eco_mode_2': False, '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, 'turbo_heat': True, 'turbo_cool': True, 'fan_silent': False, 'fan_low': False, 'fan_medium': False, 'fan_high': False, 'fan_auto': False, 'fan_custom': True, 'cool_min_temperature': 16.0, 'cool_max_temperature': 30.0, 'auto_min_temperature': 16.0, 'auto_max_temperature': 30.0, 'heat_min_temperature': 16.0, 'heat_max_temperature': 30.0, 'decimals': False, 'anion': True, 'freeze_protection': True, 'fahrenheit': True, 'aux_electric_heat': False, 'self_clean': True, 'one_key_no_wind_on_me': True, 'swing_vertical_angle': True, 'swing_horizontal_angle': True}
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa21ac00000000000003418100ff03ff00020000000000000000000000000303d590
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011168002000000000003124250f08051814f0c701000083000000000000000000000000000065cd8728fc6a5d31e6464235e81fa3b3553c1270500a690b50db22f43e80f968dfc4835a9e1397466b9ae12661353e343207d462b8d49a93b90319bbe7a26adb
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370008e206697d87d310bfa6bef157aec8e3f756d02e8d3c4b1c8a38f4f885ef952e7f697bd00a2081928015aaa9935afc1c9101eb5ddb208c01f499099d7d9dbe948c48ceb50433955a4591e4d42b44c7a5681060f656c47af409b666cb2f0a05f4158dff72e7ed12a9d8b12e0cdba05401e885d7ce838daf1705cb82b622e06ab7656fdb2105bf5c0cca018da001a154aa3d35bff
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370008e20636bb7fb0bc0028e0b0a84c39ad5cf270f59f6f330f7383f47af3efc53d0fc9504ca1e122c3db30e737a309c440d8a61d53cb2c15ba8d2e02fc5bf482917c61259694642a135aff67a9115e8a278b13d5988787dfd595e8c9f6338e18ca2758288f4e3bd47c0b84775402af70624ad4e5ba24614f94dc84dd87f024d843c33b2998927e409ab0e60cac34764457ca8212d
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a0111680020800000000074a4250f08051814f0c70100008300000000000000000180000000005567b3e522baa2e81a3fd44e212b2671ac67cdd6b4d4b2eec3089dc26a3b20a16dc298b74c9ddf0311569cb51ee0f26c5eaddff551588e5afa27a57b6035349e
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa28ac00000000000203c00148667f7f000000200065680c0048000000000000000100000000034431
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:State response payload: c00148667f7f000000200065680c004800000000000000010000000003
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa12ac00000000000003b10209000a0004284d
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011158002000000000003f24250f08051814f0c7010000830000000000000000000000000000c2235a913b9c5bd45d3a6e8eab07ed77e1af443f3affb3d28a44ed05d38fa7180fa13c041777f865bf9114636cea9287
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370007e206606f82ab7d1d2caceba1d6b45ad7a2c7303a92291a4ba538930348e8d71554a1275e46a52602f11aa9af86c56cd18825b802fc80bccf1f3a0484fa3b5a1fd13bbafc1dc0084b4ea7e9e79ceae469ce5305eecce1caed328f84e37a2875d3a77767cab065d27f0af2de057173604e1a0d42b1a37393b82926ca0ad851c444d4527
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370007e2063b03d80ae312de6fc5fa95d5784a6c918d4282ed894720334529f2802a8e2c38f3e3f2f2808218ab4d1970b66688e2c037308002861d903411bd1e8373e2e48edcbd5775753bdcc612a715dab28c95224243b056319b393587701f599e8a50b0f01933ccea00b9cdf408afe18d10d0c7eafb35b557c86569a6943f1b2dbecde0f
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a01115800208000000000e5a4250f08051814f0c7010000830000000000000000018000000000dd58dfbddb170ae32d64cbde2c3b5f5cce548da8234bf6d761c116d45aa04dd7dc7fa7a27775391dc32a5d2b566a855f
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa18ac00000000000203b10209000001000a0000010000c8a7
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.110000 seconds.
DEBUG:msmart.device.AC.command:Properties response payload: b10209000001000a0000010000
{'id': 144036023355376, 'ip': '192.168.1.60', 'online': True, 'supported': True, 'power_state': True, 'purifier': False}
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa24ac00000000000002400348667f7f003000000000000000000000000000000000059179
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011168002000000000004a25250f08051814f0c70100008300000000000000000000000000001dd0d7fbc48dc36d692ad3948a8afc228b0164f204b60803fd1e0ea38206e81c5579381a1919bf5bde46246e98e73a28d0d7594347d2f80eddfae5a6933e9b5f
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370008e2066ff094d045b604532bc14c010f11ffc87bdbbf4447f84f64e2df9149d4d8d9e8c2d0a64b5a019c842f378d5550a764252fe13c08b04eb0aea1b5a6574a6ca0a5c7be17c6889623a1f583dc640385508f7aabc34183bedb252246c42c5830fc5871bcad46a99cfa3fe38f126d1369e438e1cc89a9a415740a5b41b3daffb23175ce27c6ea4c2bb44efd233ea4c00aa11b9
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370008e2063f323ea03b3e3292b54f1fdac8aee6174942dff89b86195bc07f582c59d77e12d9fae7c1d77437b1e7a7cffb19a98aa12de7c93485b0569de4e245e84914cbba3196b1f6a80b4c51af4a49ba693b181f452846ee693eb6e08689ded6ef0554921208451c6cbef893ef3d9de3c46d571084a6d3f06d5061b8044b6bdfa5eb081fa679309bf5c5700317be90cb2a77a1ad0
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a011168002080000000007ae5250f08051814f0c7010000830000000000000000018000000000ccb32425b51e10e2661030abc7298cc68c914e3a5ce682f783977adca48d92d818e91175878f4a91eb61ca75d12b03c05b2b451a68c3265bf13e4ef4273e1a2c
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa28ac00000000000202c00148667f7f000000000065680c004800000000000000010000000005a1f3
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.150000 seconds.
DEBUG:msmart.device.AC.command:State response payload: c00148667f7f000000000065680c004800000000000000010000000005
{'id': 144036023355376, 'ip': '192.168.1.60', 'online': True, 'supported': True, 'power_state': True, 'purifier': True}```
mill1000 commented 4 months ago

I made a silly mistake and just pushed an update to the branch. Can you grab it and run the example again?

v1k70rk4 commented 4 months ago

COMPLETE SUCCESS :)

It turns on and works :) The air conditioner doesn't show "ON" on the display when it's turned on, but the UV lamp lights up.

DEBUG:asyncio:Using selector: EpollSelector
INFO:msmart.lan:Creating new connection to 192.168.1.60:6444.
DEBUG:msmart.lan:Connected to 192.168.1.60:6444.
INFO:msmart.lan:Authenticating with 192.168.1.60:6444.
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 83700040200000006966ad66bb925b4b48bf212cd4903597df90e05ff453d059eb50f4a741d36d43643e1277cc8c181f55412d70560752cde7e65fbc08cadd71daa7d4a5f655d484
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 837000402001b14cfffd920d7e664b5693961866e80d9c5227d5f73b7a645dcb25fed4b2c3dd83694b0c7f23b365e6d27d888e888f91812820f68ced1b93a4ed36dc88e2a0557cae
INFO:msmart.lan:Authentication successful. Expiration: 2024-05-09T04:01:33, Local key: 8a72a8827f0d72a09cc3483d24c48030587c3da7a2d671603d7aac32de20383d
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa0fac00000000000003b5010001e5a6
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011158002000000000005522011008051814f0c70100008300000000000000000000000000000542065231b95b9123b7f675b1de90ae915c618b02ed2747fad73f2ffa0db1d34da491f3b8ab13124fe8efe2bf6e36f4
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370007e206625dda5e5d1558bbee576b20c3157a04597040c64b879fefdc856e2f0856036aa70bce8c5cd803442d3c4973c50e03bdca05145f7bbeb90fe65ab64ca2f0ccc06703bfce74f24da82a0a1c62034d6fc6210eec77eff134c2b27068db002ecc41c6225655c18b154b84e93467740a41a4c086a8def619228882be1dda9016334ee
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370009e20637d4299ce665a8a18c2853b0948c44c3b26adf1dc88e332e10ae3aa1ba58553e16d681bb10482498f868d2f0a8f3f9b867e3634a23479997e158475ad7f0ad1046354d9cca1339e56e5b4d0752696a3c4c0ec19f49d8cb704a53323ad7360c10b98a0fdad0a30e24cd034119af32aa09fca2ec82ce56e628d32db09ed164ffac8ccfb0f50d2295a47beb78677f955157698028c18c132528b346b7805b7044916
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a01117800208000000000d6e2011008051814f0c7010000830000000000000000018000000000d50e76f9d56b1b007804ff46779892e434e1f89c6c121888c87c8cf2a94d4d83b80e5bf3567f3e76197a3ce12165c38f963ce4fda737198863136dad8c53af3d97a82788b06dc981d902db7d94c06a0c
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa31ac00000000000203b507120201011402010115020101160201001a02010110020101250207203c203c203c000100602d
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b507120201011402010115020101160201001a02010110020101250207203c203c203c000100
DEBUG:msmart.device.AC.command:Raw capabilities: {'eco_mode': True, 'eco_mode_2': False, '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, 'turbo_heat': True, 'turbo_cool': True, 'fan_silent': False, 'fan_low': False, 'fan_medium': False, 'fan_high': False, 'fan_auto': False, 'fan_custom': True, 'cool_min_temperature': 16.0, 'cool_max_temperature': 30.0, 'auto_min_temperature': 16.0, 'auto_max_temperature': 30.0, 'heat_min_temperature': 16.0, 'heat_max_temperature': 30.0, 'decimals': False}
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa10ac00000000000003b501010102c1c6
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011158002000000000006322011008051814f0c70100008300000000000000000000000000004704d4f6cb7e757d97bb0fb355e696691c6cb0cecabc7672cd44e0d17faa57088f9c3a2661272c23f994934bc3d2c7e4
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370007e2066713549b5d454a3960da833ba2f89389e9474570307757adf046cb65fcac8047ea1d03e6a7bdd6966dc7a01d323a0e5f6930d7a4d8081d95d9f4a9bca0305463445342c9ce1449864abcd4c17ba829a5c4e33d4eebfd637598a43a08fdff02f93e8a7571f367a69e0e2dd1c4d66f37a648d2529527a5abc46fe33f5b76c485468
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370009e2063d61361c0483c34fa25076e23873f8cba777b7cf1cb02d3feadc500089b5f6d06d6b8c507107ce079f84d41ff1a12aabfa48de12a258bda6ed6ee60ef339de1a4c816da5225d0b4b8203a1a1989271e8fe13e7eb64cb584b8c41a35f183e63c904b3eddb3f3e3c802c06233034f9a312cbfb112e96bbc24c45bf4175dfcac8f59a6c4305aacceebd56ae0ed8c1c474099115c7f070f4251d03fb4b29eca33ff7c
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a011178002080000000007823011008051814f0c701000083000000000000000001800000000034a388355e4a208f9971c44c48082c155eab2881baca7cf77395a43aa7e53eabe065702bba646a72fab00dbd339a523e915c618b02ed2747fad73f2ffa0db1d30f43769c67acdbd8212b8833ef958e12
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa2fac00000000000203b5081e0201011302010122020100190201003900010142000101090001010a00010100008bc8
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.140000 seconds.
DEBUG:msmart.device.AC.command:Capabilities response payload: b5081e0201011302010122020100190201003900010142000101090001010a0001010000
DEBUG:msmart.device.AC.command:Raw capabilities: {'anion': True, 'freeze_protection': True, 'fahrenheit': True, 'aux_electric_heat': False, 'self_clean': True, 'one_key_no_wind_on_me': True, 'swing_vertical_angle': True, 'swing_horizontal_angle': True}
DEBUG:msmart.device.AC.command:Merged raw capabilities: {'eco_mode': True, 'eco_mode_2': False, '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, 'turbo_heat': True, 'turbo_cool': True, 'fan_silent': False, 'fan_low': False, 'fan_medium': False, 'fan_high': False, 'fan_auto': False, 'fan_custom': True, 'cool_min_temperature': 16.0, 'cool_max_temperature': 30.0, 'auto_min_temperature': 16.0, 'auto_max_temperature': 30.0, 'heat_min_temperature': 16.0, 'heat_max_temperature': 30.0, 'decimals': False, 'anion': True, 'freeze_protection': True, 'fahrenheit': True, 'aux_electric_heat': False, 'self_clean': True, 'one_key_no_wind_on_me': True, 'swing_vertical_angle': True, 'swing_horizontal_angle': True}
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa21ac00000000000003418100ff03ff00020000000000000000000000000303d590
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011168002000000000000c23011008051814f0c701000083000000000000000000000000000065cd8728fc6a5d31e6464235e81fa3b3553c1270500a690b50db22f43e80f968dfc4835a9e1397466b9ae12661353e34a08102c533d1f3bd647ec6c1d1663d79
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370008e20667c04f0f2e2ac987a9864d8e231bf4391d96b1e10c001c545cdc41f2b653d247a096db3918e31723c000f3f6c35dbea682b3e0eda4808717338a8933ef8da04fce1a1cadd9b4070e5775130c7b40cf1648526b741382f68cdf78190c501de183846a62b6460ba5b2f4ca2e2b438bc6ddb8e78191165344ae680b01a3d8db5128274a4cbc6c0d8ec7b48bdd0daf1678974
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370008e206325f911ceb3dab791f258c707701ae73ec33e66f948b0235732a9d82b5de4d46992e7467b0447bc7a1237f2a35db33aadf5303fedacb87082ab6b9244e0015296c39ea66bf20349d192ebbcbcf8b174662b5a510a1d7d43f88703c5efd56f2d312df45c87ab4d9c3d559f0f79bc239df6127b81562946d896fa16967b55470c93602418c7016ae5f0086372afaef2449c
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a011168002080000000001163011008051814f0c70100008300000000000000000180000000005567b3e522baa2e81a3fd44e212b2671e9ee7c6da1e125ddf67f501b6f0194e06908bd3f4d25ece114355a321982d7471f570c24f93397cf7f41e3541a592270
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa28ac00000000000203c00148667f7f0000000000615e0c003500000000000000010000000003595d
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.160000 seconds.
DEBUG:msmart.device.AC.command:State response payload: c00148667f7f0000000000615e0c003500000000000000010000000003
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa12ac00000000000003b10209000a0004284d
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011158002000000000001c23011008051814f0c7010000830000000000000000000000000000c2235a913b9c5bd45d3a6e8eab07ed77e1af443f3affb3d28a44ed05d38fa71882f580c8e2bf300bcd2b87ed5fb80e80
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370007e206654eb48dd5d1d61528b9f0a8dbb76c9e537dca39cc36ed0512e8da3735c894735b6081635589901aa673bc1772bcb078fd70276d436192263978d51c3e0cc3cd2118df4c8611d898c079fc437cf35928c8326e4930f1bf681b465a464f3dd8460e37d91659a451ef1e05d5d7b07cb7d87188fb24ddbfad0d72042624297fcbe1d
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370007e20635b993e47a81f7983f19775a6d1b5045573434bcc8942cab241fd6fbc4c7666974e19e3732deaae45840f94b0c23ba760a24d86c7de95aa4dbd48a13bbf7ed60dd4eac98a730f47f74a1d4e9bf02fc7dda0b998cc6f11f0dd289ea8bb6f1127d712c2e3e31a1905d7c3ad22a2d2c7deab3c794c033e84f044abed76130dafa68f
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a011158002080000000008263011008051814f0c7010000830000000000000000018000000000dd58dfbddb170ae32d64cbde2c3b5f5cce548da8234bf6d761c116d45aa04dd7e1706da9af692f4af7c45c3d3549d1ce
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa18ac00000000000203b10209000001000a0000010000c8a7
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.110000 seconds.
DEBUG:msmart.device.AC.command:Properties response payload: b10209000001000a0000010000
{'id': 144036023355376, 'ip': '192.168.1.60', 'online': True, 'supported': True, 'power_state': True, 'purifier': False}
DEBUG:msmart.base_device:Sending command to 192.168.1.60:6444: aa24ac00000000000002400348667f7f003000200000000000000000000000000000058169
DEBUG:msmart.lan:Sending packet to 192.168.1.60:6444: 5a5a011168002000000000002724011008051814f0c70100008300000000000000000000000000001dd0d7fbc48dc36d692ad3948a8afc22e211f6cdaf36e1d63945bf683c391ed098f284ad88dae488ba134128d4ce7bcd8f0ef18d65e846d65ed1b8a6a618a982
DEBUG:msmart.lan:Sending data to 192.168.1.60:6444: 8370008e206670ebc37c0fdde597f0067fb67c93cc068f0f983b50cb2ef251209691404d5a257c3446d49bd161bf87e231361bda732f958a76dce35c788292f0e49e87969365b1d53079e842b5db4f546a64c03713f36c867a433e796ab4f8d22a9d2a8255bedd366c2fa11fe909e8521f3bb71a44af5b52dc635a31cab8842fd1ecfd8d9f81fa6174d87d172c5e8d2ed9d8133b45d0
DEBUG:msmart.lan:Received data from 192.168.1.60:6444: 8370008e20632cf429c4b752366b10d99efc1d873ccf9d945419c479c9a374e35f52ac07c36bab3f2567ed275fcd30b40a1929c9523dd73989965f8944df230dd9eac116cdd4295db87dc033faf31a81bd37b54cffd593fecdc938d975f475a0f80a6fea73b4269297feb7b828d055acfda2f6cc2bb84661fc4baf9e6bcf553a9a15d1686909a5d84e64ddf8daf1e7c9f7f7b847e115
DEBUG:msmart.lan:Received packet from 192.168.1.60:6444: 5a5a0111680020800000000021a4011008051814f0c7010000830000000000000000018000000000ccb32425b51e10e2661030abc7298cc6c2d4b886ff6fdd601b6c8e68bf6efe6a5df7b440d5e19271eed4bba2f342cf00c6d545883d38c92296d769c27918690d
DEBUG:msmart.lan:Received response from 192.168.1.60:6444: aa28ac00000000000202c00148667f7f0000002000615e0c003500000000000000010000000005bcd9
DEBUG:msmart.base_device:Response from 192.168.1.60:6444 in 0.160000 seconds.
DEBUG:msmart.device.AC.command:State response payload: c00148667f7f0000002000615e0c003500000000000000010000000005
{'id': 144036023355376, 'ip': '192.168.1.60', 'online': True, 'supported': True, 'power_state': True, 'purifier': True}
mill1000 commented 4 months ago

Progress!

That's interesting about the display not showing it.

Can you rerun this example twice? Once with the UV+ION on via the remote/app? And again with the UV+ION off via the remote/app?

import asyncio
import logging

from msmart.device import AirConditioner as AC

logging.basicConfig(level=logging.DEBUG)

DEVICE_IP = "YOUR_DEVICE_IP"
DEVICE_PORT = 6444
DEVICE_ID = "YOUR_AC_ID"

# For V3 devices
DEVICE_TOKEN = None  # "YOUR_DEVICE_TOKEN"
DEVICE_KEY = None  # "YOUR_DEVICE_KEY"

async def main():

    # Manually construct the device
    #  - See midea-discover to read ID, token and key
    device = AC(ip=DEVICE_IP, port=6444, device_id=int(DEVICE_ID))
    if DEVICE_TOKEN and DEVICE_KEY:
        await device.authenticate(DEVICE_TOKEN, DEVICE_KEY)

    # Get device capabilities
    await device.get_capabilities()

    # Refresh the state
    await device.refresh()

    print({
        'id': device.id,
        'ip': device.ip,
        "online": device.online,
        "supported": device.supported,
        'power_state': device.power_state,
        'purifier': device.purifier,
    })

if __name__ == "__main__":
    asyncio.run(main())
v1k70rk4 commented 4 months ago

In the attached log, the beginning shows the ION mode turned on, followed by the mode turned off. Apparently, I don't see a difference in the log. :P So maybe the remote is switching something else. :P

But the UV lamp is on :) ion_on_ion_off.log

mill1000 commented 4 months ago

I see the difference. :)

DEBUG:msmart.device.AC.command:State response payload: c0014b667f7f000000 **00** 00 605a 0f 00 3400000000000000010000000003
DEBUG:msmart.device.AC.command:State response payload: c0014b667f7f000000 **20** 00 605a 0f 00 3300000000000000010000000003

Thanks for all your help.