shenxn / libdyson

Python library for dyson devices
Apache License 2.0
64 stars 41 forks source link

Unable to change status #11

Closed sohsatoh closed 3 years ago

sohsatoh commented 3 years ago

Hi. First of all, thank you for the great library. I have tried to use this library with PURE_HOT_COOL_LINK(455), but all the commands about changing the state do not work. (I can get the state without any problem).

Script used for testing

from libdyson import DEVICE_TYPE_PURE_HOT_COOL_LINK, DysonPureHotCoolLink
import logging
import sys

root = logging.getLogger()
root.setLevel(logging.DEBUG)

handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)

DEVICE_TYPE = DEVICE_TYPE_PURE_HOT_COOL_LINK
HOST = '192.168.1.83'
DEVICE_SERIAL = 'G5V-JP-<redacted>'
DEVICE_PASSWORD = '<redacted>'

device = DysonPureHotCoolLink(DEVICE_SERIAL, DEVICE_PASSWORD, DEVICE_TYPE)
device.connect(HOST)

print('Before: ', device._status)
device.disable_auto_mode()
device.turn_off()
print('After: ', device._status)

Results

2021-07-05 22:36:53,802 - libdyson.dyson_device - DEBUG - Connected with result code 0
2021-07-05 22:36:53,802 - libdyson.dyson_device - INFO - Connected to device G5V-JP-<redacted>
2021-07-05 22:36:54,045 - libdyson.dyson_device - DEBUG - New state: {'msg': 'CURRENT-STATE', 'time': '2021-07-05T13:36:53.000Z', 'mode-reason': '', 'state-reason': 'MODE', 'dial': 'OFF', 'rssi': '-42', 'product-state': {'fmod': 'AUTO', 'fnst': 'FAN', 'fnsp': 'AUTO', 'qtar': '0003', 'oson': 'ON', 'rhtm': 'ON', 'filf': '3869', 'ercd': 'NONE', 'nmod': 'OFF', 'wacd': 'NONE', 'hmod': 'OFF', 'hmax': '2970', 'hsta': 'OFF', 'ffoc': 'OFF', 'tilt': 'OK'}, 'scheduler': {'srsc': '65dd', 'dstv': '0000', 'tzid': '0001'}}
2021-07-05 22:36:54,142 - libdyson.dyson_device - DEBUG - New environmental state: {'msg': 'ENVIRONMENTAL-CURRENT-SENSOR-DATA', 'time': '2021-07-05T13:36:53.001Z', 'data': {'tact': '2975', 'hact': '0066', 'pact': '0009', 'vact': '0000', 'sltm': 'OFF'}}
Before:  {'fmod': 'AUTO', 'fnst': 'FAN', 'fnsp': 'AUTO', 'qtar': '0003', 'oson': 'ON', 'rhtm': 'ON', 'filf': '3869', 'ercd': 'NONE', 'nmod': 'OFF', 'wacd': 'NONE', 'hmod': 'OFF', 'hmax': '2970', 'hsta': 'OFF', 'ffoc': 'OFF', 'tilt': 'OK'}
After:  {'fmod': 'AUTO', 'fnst': 'FAN', 'fnsp': 'AUTO', 'qtar': '0003', 'oson': 'ON', 'rhtm': 'ON', 'filf': '3869', 'ercd': 'NONE', 'nmod': 'OFF', 'wacd': 'NONE', 'hmod': 'OFF', 'hmax': '2970', 'hsta': 'OFF', 'ffoc': 'OFF', 'tilt': 'OK'}
sohsatoh commented 3 years ago

I had just forgotten to disconnect. It worked fine! Thanks!