Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for LV600s #112

Closed
wants to merge 7 commits into from
Closed

Conversation

brianhealey
Copy link

No description provided.

if mode.lower() not in ['sleep', 'auto', 'humidity']:
logger.warning('Invalid humidity mode used (sleep, auto, or '
'humidity)- %s',
mode)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a difference between auto and humidity? Are there three modes on all devices? I only see auto and sleep mode on the other humidifiers. May have to put feature logic to adjust mode settings per device.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't actually tried auto. I based this PR off of what I was see in my captures. Agreed on adding the feature logic.

TBH, with all of the devices I am seeing in their app, this pattern is going to be outgrown pretty quick. :)

{
  "traceId": "[TRACE_ID]",
  "payload": {
    "method": "setHumidityMode",
    "data": {
      "mode": "humidity"
    },
    "source": "APP"
  },
  "token": "[TOKEN]",
  "appVersion": "VeSync 3.2.6 build6",
  "configModule": "WFON_AHM_LUH-A602S-WUS_US",
  "method": "bypassV2",
  "cid": "[CID]",
  "debugMode": false,
  "deviceRegion": "US",
  "phoneBrand": "iPhone 12 Pro",
  "userCountryCode": "US",
  "acceptLanguage": "en",
  "accountID": "[ACCOUNTID]",
  "timeZone": "America\\/Chicago",
  "phoneOS": "iOS 15.4"
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto didn't work for me. I changed my PR to simplify the interface. The caller won't have to know the distinction with this approach.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I can confirm with my testing that auto seems to have been renamed to humidity for the LV600S.

looking forward to seeing this PR soon.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have to make a new class or restructure logic. If you enjoy painful activities, building a test would be a great idea 😉

@anoblet
Copy link

anoblet commented Mar 1, 2022

Any update on this?

@webdjoe
Copy link
Owner

webdjoe commented Mar 1, 2022 via email

@brianhealey
Copy link
Author

Sorry, just getting back to this. Do you want me to provide tests for this, or would you prefer to just wait for the new release?

@adityapavan18
Copy link

Any word on when this will be merged and be available in new version?

@webdjoe
Copy link
Owner

webdjoe commented Mar 9, 2022

I have a branch ready to test, I incorporated all of your changes except the readme file. I will update that in the next day or so when hopefully testing works - https://github.com/webdjoe/pyvesync/tree/air-refactor

@anoblet
Copy link

anoblet commented Mar 10, 2022

I don't see my humidifier listed with this branch.

@webdjoe
Copy link
Owner

webdjoe commented Mar 10, 2022

Can you add logger.setLevel(logging.DEBUG) after the logging line and tell me what output you get. There should be a message with your device typee

@anoblet
Copy link

anoblet commented Mar 10, 2022

I fairly novice at this. Which file would I put that in?

This is what I'm trying:

pip install git+https://github.com/webdjoe/pyvesync.git@air-refactor
import sys

from pyvesync import VeSync

from pprint import pprint

manager = VeSync("", "", "EST")
manager.login()
manager.update()

devices = manager.get_devices()
pprint(vars(manager));

Only my air purifiers are returned.

@webdjoe
Copy link
Owner

webdjoe commented Mar 11, 2022

@anoblet I just added a debug feature so when you instantiate the class you can use VeSync('user', 'pass', time_zone='America/New_York', debug=True) this will print out your device dictionary. Please post it here

@anoblet
Copy link

anoblet commented Mar 11, 2022

@adityapavan18
Copy link

I tried the air-refactor code and it fails for me

manager.update()
2022-03-15 18:12:24,656 - DEBUG - [post] calling '/cloud/v1/deviceManaged/devices' api
2022-03-15 18:12:24,658 - DEBUG - Starting new HTTPS connection (1): smartapi.vesync.com:443
2022-03-15 18:12:25,133 - DEBUG - https://smartapi.vesync.com:443 "POST /cloud/v1/deviceManaged/devices HTTP/1.1" 200 None
2022-03-15 18:12:25,135 - DEBUG - New device list initialized
2022-03-15 18:12:25,135 - DEBUG - LUH-A602S-WUS device not added
2022-03-15 18:12:25,135 - ERROR - Please set modes for LAP-C401S-WUSR in the configuration
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/Cellar/python@3.9/3.9.1_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyvesync/vesync.py", line 289, in update
self.get_devices()
File "/usr/local/Cellar/python@3.9/3.9.1_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyvesync/vesync.py", line 238, in get_devices
proc_return = self.process_devices(device_list)
File "/usr/local/Cellar/python@3.9/3.9.1_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyvesync/vesync.py", line 211, in process_devices
device_str, device_obj = object_factory(dev_type, dev, self)
File "/usr/local/Cellar/python@3.9/3.9.1_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyvesync/vesync.py", line 50, in object_factory
type_str, dev_obj = fans(dev_type, config, manager)
File "/usr/local/Cellar/python@3.9/3.9.1_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyvesync/vesync.py", line 32, in fans
return 'fans', fan_obj(config, manager)
File "/usr/local/Cellar/python@3.9/3.9.1_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyvesync/vesyncfan.py", line 127, in init
raise Exception
Exception

@webdjoe
Copy link
Owner

webdjoe commented Mar 17, 2022

@brianhealey @adityapavan18 @anoblet Can you give the updated #121 branch a shot. It should be working now

@adityapavan18
Copy link

@webdjoe - no errors like before while running manager.update

But when I try to display the details using

for device in manager.fans:
... device.display()

Information doesn't show up properly for Air Purifier

Device Name:... Air Purifier
Model: ........ LAP-C401S-WUSR
Subdevice No: . None
Status: ....... off
Online: ....... online
Type: ......... wifi-air
CID: .......... IREDACTEDTHIS
UUID: ......... IREDACTEDTHIS
Mode: .............. Mode: Mode:
Filter Life: ....... Filter Life: Filter Life:
Fan Level: ......... Fan Level: Fan Level:
Display: ........... Display: Display:
Child Lock: ........ Child Lock: Child Lock:
Night Light: ....... Night Light: Night Light:
Display Config: .... Display Config: Display Config:
Display_Forever Config: Display_Forever Config: Display_Forever Config:
Air Quality: ....... Air Quality: Air Quality:

@anoblet
Copy link

anoblet commented Mar 18, 2022

@webdjoe

Here are my new logs:

https://gist.github.com/anoblet/424a1ad88ba53e93218511246859b03c

@webdjoe
Copy link
Owner

webdjoe commented Mar 20, 2022

This should be all set, releasing pypi package now. Let me know if there are still any issues

@webdjoe webdjoe closed this Mar 20, 2022
@anoblet
Copy link

anoblet commented Mar 23, 2022

Will this be added to Home Assistant?

@webdjoe
Copy link
Owner

webdjoe commented Mar 24, 2022

@anoblet you would have to submit a PR to HA repo to update the pyvesync package requirements to 2.0.0 unless you build from scratch

@brianhealey brianhealey deleted the LV600S branch May 27, 2022 17:44
@webdjoe
Copy link
Owner

webdjoe commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants