mill1000 / midea-msmart

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

Unable to turn off "breeze" modes on Breezeless device #161

Closed mill1000 closed 1 month ago

mill1000 commented 1 month ago

Originally reported here https://github.com/mill1000/midea-ac-py/issues/212

@lpispek @Jarrekstar Can you try running this example?

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():
    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
    print("Refreshing state")
    await device.refresh()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        "supports_breeze_away": device.supports_breeze_away,
        'breeze_mild': device.breeze_mild,
        "supports_breeze_mild": device.supports_breeze_mild,
        "breezeless": device.breezeless,
        "supports_breezeless": device.supports_breezeless,

    })

    print("Enabling Breezeless")
    device.breezeless = True
    await device.apply()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        'breeze_mild': device.breeze_mild,
        "breezeless": device.breezeless,
    })

    await asyncio.sleep(10)

    # Refresh the state
    print("Refreshing state")
    await device.refresh()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        'breeze_mild': device.breeze_mild,
        "breezeless": device.breezeless,
    })

    print("Diabling Breezeless")
    device.breezeless = False
    await device.apply()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        'breeze_mild': device.breeze_mild,
        "breezeless": device.breezeless,
    })

    await asyncio.sleep(10)

    # Refresh the state
    print("Refreshing state")
    await device.refresh()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        'breeze_mild': device.breeze_mild,
        "breezeless": device.breezeless,
    })

if __name__ == "__main__":
    asyncio.run(main())
lpispek commented 1 month ago

Yes, find the log:

breezless-debug.txt

mill1000 commented 1 month ago

Thanks. Lets try a different value for disabling breezeless

Try this code

import asyncio
import logging

from msmart.device import AirConditioner as AC
from msmart.device.AC.command import PropertyId, SetPropertiesCommand

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():
    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
    print("Refreshing state")
    await device.refresh()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        "supports_breeze_away": device.supports_breeze_away,
        'breeze_mild': device.breeze_mild,
        "supports_breeze_mild": device.supports_breeze_mild,
        "breezeless": device.breezeless,
        "supports_breezeless": device.supports_breezeless,

    })

    print("Enabling Breezeless")
    device.breezeless = True
    await device.apply()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        'breeze_mild': device.breeze_mild,
        "breezeless": device.breezeless,
    })

    await asyncio.sleep(10)

    # Refresh the state
    print("Refreshing state")
    await device.refresh()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        'breeze_mild': device.breeze_mild,
        "breezeless": device.breezeless,
    })

    print("Disabling Breezeless")

    # Try 0x01 for disabling breezeless
    await device._apply_properties({
        PropertyId.BREEZE_CONTROL: 0x01,
    })

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        'breeze_mild': device.breeze_mild,
        "breezeless": device.breezeless,
    })

    await asyncio.sleep(10)

    # Refresh the state
    print("Refreshing state")
    await device.refresh()

    # Print current breeze properties
    print({
        'breeze_away': device.breeze_away,
        'breeze_mild': device.breeze_mild,
        "breezeless": device.breezeless,
    })

if __name__ == "__main__":
    asyncio.run(main())
mill1000 commented 1 month ago

@lpispek Just checking if you saw this request.

lpispek commented 1 month ago

Yes, sorry, on a business trip. Tomorrow I will be at home and test the script.

mill1000 commented 1 month ago

No problem. Thanks for your help as always.

lpispek commented 1 month ago

I have tested with Breezless ON and OFF. After the script completes Breezless mode was OFF. OFF: breezless-OFF-debug.txt ON: breezless-ON-debug.txt