webdjoe / pyvesync

pyvesync is a python library to manage Etekcity & Levoit smart devices
MIT License
175 stars 83 forks source link

Problem with Levoit Dual 200S #120

Closed lasry1 closed 2 years ago

lasry1 commented 2 years ago

Hi,

I'm not sure if i'm doing it right but i don't seem to find any devices populating the list I only have 1 device which is the Levoit Dual 200S humidifier ( https://www.amazon.co.uk/gp/product/B09KT9ZK7Q/ref=ppx_yo_dt_b_asin_image_o01_s00?ie=UTF8&th=1 )

I am logged in answered with 'true', Then i tried to obtain the list of devices but nothing appears on the screen

manager.update()

Am i doing it right?

Thanks

webdjoe commented 2 years ago

Please test with this branch - it should have most of the device models - https://github.com/webdjoe/pyvesync/tree/air-refactor

lasry1 commented 2 years ago

Could you help me on how to install that particular branch? I install the repo with 'pip install pyvesync' but that only install the master branch and can't find the humidifier

Thanks for your help

kevchu3 commented 2 years ago

@lasry1 You can take a look at #118 on how to set up your python environment to build from source code. I'd add that you should git checkout air-refactor right after your git clone command.

@webdjoe I saw you closed this PR, but I'd like to ask you to reconsider as not everyone here trying to test is a python guru. Some folks like myself could really use some published instructions to get started, and I figure reducing the barrier to development is great for the open source community.

lasry1 commented 2 years ago

@kevchu3 thanks a lot i installed the branch doing it as you mentioned and i can log in and use it.

@webdjoe With that particular branch the humidifier doesn't show neither

webdjoe commented 2 years ago

@kevchu3 Thank you for the PR. I was planning on adding that to the new branch when I updated the readme, just didnt get to it yet. I just merged your branch with the new one to make it available now.

@lasry1 After following the instructions to set up the environment here: just run a quick script in that environment that should output your device details. The update() method should output your device details when debug is on. Then manager.fans should show your device if it was successfully instantiated.


import pyvesync.vesync as vs
manager = vs.VeSync(user, pass, debug=True)
manager.login()
manager.update()
manager.fans
` 
lasry1 commented 2 years ago

@webdjoe that's of great help thanks! at least now i can see the device not being initiated!

The output log is:

manager.update() 2022-03-15 13:46:04,649 - DEBUG - [{'deviceRegion': 'EU', 'isOwner': True, 'authKey': None, 'deviceName': 'Humidificador', 'deviceImg': 'https://image.vesync.com/defaultImages/Dual_200S_Series/icon_dual200s_humidifier_160.png', 'cid': 'vsaq66ef1db14173b83f9c072d564e2d', 'deviceStatus': 'on', 'connectionStatus': 'online', 'connectionType': 'WiFi+BTOnboarding+BTNotify', 'deviceType': 'LUH-D301S-WEU', 'type': 'wifi-air', 'uuid': '825809f1-0639-45c6-a6f1-dd945431c986', 'configModule': 'WFON_AHM_LUH-D301S-WEU_EU', 'macID': '48:55:19:83:74:2a', 'mode': None, 'speed': None, 'extension': None, 'currentFirmVersion': None, 'subDeviceNo': None, 'subDeviceType': None, 'deviceFirstSetupTime': 'Mar 7, 2022 7:00:39 PM', 'deviceProp': None}] 2022-03-15 13:46:04,649 - DEBUG - New device list initialized 2022-03-15 13:46:04,652 - DEBUG - LUH-D301S-WEU device not added manager.fans []

webdjoe commented 2 years ago

@lasry1 That's interesting because that device type is included in the configuration. Let me create a test and see what is going on

webdjoe commented 2 years ago

@lasry1 just pushed a fix, should be working now

lasry1 commented 2 years ago

@webdjoe Great thanks now manager.fans returns the device but how do i fetch the information from the device?

For example VeSyncHumid200S300S.turn_on_display() returns NameError: name 'VeSyncHumid200S300S' is not defined The same happens using VesyncDecive instead VeSyncHumid200S300S

VeSyncHumid200S300S.turn_on_display() Traceback (most recent call last): File "", line 1, in NameError: name 'VeSyncHumid200S300S' is not defined

VeSyncDevice.turn_off() Traceback (most recent call last): File "", line 1, in NameError: name 'VeSyncDevice' is not defined

manager.fans [DevClass: VeSyncHumid200300S, Name:Humidificador, Device No: None, DevStatus: on, CID: vsaq66ef1db14173b83f9c072d564e2d]

My device is VeSyncHumid200300S (whitout the S in between 200 and 300) and the one in the description is VeSyncHumid200S300S with an S in between the 200 and 300

If i use VeSyncHumid200300S .turn_on_display() it happen the same

VeSyncHumid200300S.turn_on_display() Traceback (most recent call last): File "", line 1, in NameError: name 'VeSyncHumid200300S' is not defined

webdjoe commented 2 years ago

@lasry1 you would have to use the device instantiated in the manager.fans list. For example if you only have one device it would be my_device = manager.fans[0]

lasry1 commented 2 years ago

@webdjoe Thank you very much! That's great i can control and pull the info from the device now