CharlesBlonde / libpurecoollink

Dyson Pure Cool link python library
http://libpurecoollink.readthedocs.io
Other
204 stars 54 forks source link

Connecting to a Pure Hot+Cool Hangs #12

Open blakemotl opened 6 years ago

blakemotl commented 6 years ago

import json from libpurecoollink.dyson import DysonAccount from libpurecoollink.const import FanSpeed, FanMode, NightMode, Oscillation, \ FanState, StandbyMonitoring, QualityTarget, ResetFilter, HeatMode, \ FocusMode, HeatTarget

if __name__ == '__main__': with open('config.json') as json_data: config = json.load(json_data) dyson_acc = DysonAccount(config["dyson_user"], config["dyson_pass"], config["dyson_lang"]) login_status = dyson_acc.login() if not login_status: print("Failed to login to Dyson account.") devices = dyson_acc.devices() device = devices[0].connect("192.168.1.157")

Using the above code, results in a hang on the connect line. Doesn't matter if I use auto_connect or connect directly to the host. If I manually connect to the device using paho-mqtt(and I captured the user/pass using wireshark) I am able to connect no problem. I have tried it from multiple environments/hosts all who can talk directly to the device.

CharlesBlonde commented 6 years ago

Hi,

I have been quite busy this last month but I'll take a look quickly !

tmonjalo commented 6 years ago

Hi,

I have a connection issue too (no discovery, no manual connection). I have checked that the device is recognized as DysonPureCoolLink instance, especially as DYSON_PURE_COOL_LINK_TOUR. When looking in Wireshark, it seems my Pure Cool Link is not replying to the MQTT connect.

How can I help?

theboyknowsclass commented 5 years ago

I'm also having a similar (or related issue), in that it hangs on second run?

I also notice in VS code that some threads are still lingering


def setfanspeed(ip, speed):
    dyson_account = DysonAccount(...)
    logged = dyson_account.login()

    if not logged:
        print('Unable to login to Dyson account')
        exit(1)

    devices = dyson_account.devices()
    name = devices[0].name

    if not devices[0].connected:
        connected = devices[0].connect(ip)

    if devices[0].connected:
        devices[0].set_configuration(fan_speed=FanSpeed(speed))
        devices[0].disconnect()
        content = "Dyson Fan at IP " + ip + "(" + name + ") is set to speed " + speed
    else:
        content = "ERROR: Setting Dyson Fan at IP " + ip + "(" + name + ") to speed " + speed

    return content```