etheralm / libpurecool

Python library for dyson devices.
Other
66 stars 30 forks source link

I couldn't decrease fan speed #2

Closed GeneralD closed 5 years ago

GeneralD commented 5 years ago

This fork is so good! Several problems in original repo were solved here, but I have a problem with this fork. The fan speed can only be increased, but there's no response when i try to decrease it.

My code is:

def lambda_handler(event, context):
    # login
    dyson_account = DysonAccount("<my email>","<my password>","US")
    if not dyson_account.login():
        print('Unable to login to Dyson account')
        return

    # get my PureCool device
    devices = dyson_account.devices()
    pureCool = next(d for d in devices if d.name.startswith('Dyson Pure Cool'))
    if not pureCool:
        print("couldn't find a PureCool device")
        return

    # connect to the device
    if not pureCool.auto_connect():
        print("couldn't connect to a device")
        return

    # add listener
    pureCool.add_message_listener(on_message)

    # send request
    print('sending request')
    pureCool.set_configuration(fan_mode=FanMode.FAN, fan_speed=FanSpeed.FAN_SPEED_10)

    # TODO increasing fan speed was success, but decreasing is not. why?

    pureCool.disconnect()

def on_message(msg):
    print(msg)
etheralm commented 5 years ago

Hi,

can you tell me what's the model of the fan. There is some difference in the configuration between the old and the new models. If your fan is one of the 2018 models(TP04 or DP04), try to use the convenience methods that I added to set the speed or send just the fan speed with set_configuration.

you can do that with pureCool.set_fan_speed(FanSpeed.FAN_SPEED_10)

I created those methods because I noticed that at least for the new models, the fan is acting quite strangely depending on what configuration parameters you sent with set_configuration, so I had to check the payload of the mqtt packets that the android app is sending for each command.

GeneralD commented 5 years ago

Thank you. I try the convinience function! I'm using TP04.