Add support for Levoit Classic 300S Smart Ultrasonic Top-Fill Cool Mist Humidifier in the VeSync integration

No, this is the error we were talking about - it’s server lags.
If you have ability to intercept API calls for official VeSync app, it would help greatly - pyvesync library developer needs help with it, and could try to update library with new API, if someone could get that info.

Hello Andrii,
I have been struggling integrating my Levoit 400S air purifier. Vesync does not support it…and I had no luck with pyvesync. I tried everything, it just doesn’t show up in my HA (on pi4). Maybe I just do not understand the pyvesync installation process, thus it fails to initiate.
In any event, I was reading your post regarding the 300S Humidifier, and I was wondering if there is a way to also add support for the Levoit 400S air purifier in your repo?

Thank you

Hello!
As far as I can see from docs, pyvesync library doesn’t support 400S yet.
Unfortunately, the only thing I did was adding device, supported by pyvesync, to Home Assistant.
If pyvesync will add support for 400S, it will be possible - but without actual device to test it’ll be pretty hard to implement.
Pyvesync is Python util - you may download it to Windows PC and try run from command line with “python pyvesync” command. Then just login there and try to get device list. Nothing to do with HA on current stage. :slight_smile:
However, as I mentioned, I believe it is not yet supported, so you may ask pyvesync dev to add support for 400S first.

Hello Andrii and many thanks for your reply.
Actually it seems that pyvesync now supports the 400S air purifier.
Here is the link :

I have the 400S and I will be happy to test any update of your repo.

Thank you

Oh, cool! I was looking here pyvesync · PyPI
Looks like docs there outdated.
The response seems to be copied from 200s, and if they similar enough, should be easy.

Well, I can try then.

I very much appreciate your support. If I can help testing, please let me know.

Thank you again!!

Please check out newest version and try it.

Express!! Thanks. I will try it now.
Just to make sure…I just copy the folder in the custom_components folder and install it via Configuration/Integrations.
There is NO need to install the VeSync integration and there is NO need to install pyvesync using “pip install pyvesync”. Just your repo. Is that right?

Yes, you’re right. You may delete official VeSync integration, to avoid duplication.

Hello Andrii,
I made sure that no pyvesync or vesync were installed. I copied your repo in custom_components folder and installed it via configuration/integrations. I entered my login credentials and it showed up under integrations.
I rebooted HA but unfortunately no entities or devices were discovered.
(FYI I am running HA 6.4 on raspberry pi4, core 2021.9.7, in usr/lib the python folder is “python3.9”)

Do you have any other VeSync devices except 400S?
Can you check the logs right after installing integration? (Delete integration and re-install it without rebooting on Configuration/Integrations)
Logs should be visible in Supervisor System section, choose “Core” in drop-down.

By the way, to all who still is struggling with 300S display and night light:
Today my humidifier got silently deleted from application. I re-added, and noticed, that it started to work really fast both with application and Alexa.
So I uncommented display and night light initialization lines, and rebooted HA.
All is working really fast stable. At least for now.
Gonna watch it closely for next couple weeks, but looks like API server got some update.

This doesn’t appear to pick up my Classic 200s humidifier (wifi and can see it via the app). Anything I can try on my end or provide?

Unfortunately I don’t have any other devices that pair through Vesync. I will retry installing and get the logs. Thank you for your help here. Much appreciated.

It does pick up my LV-PUR131S, just not the Classic 200S

This is the logs I get right after uninstalling the component. Note the ‘Config entry was never loaded!’ error:
I don’t receive any errors after re-installing.

File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 443, in async_unload
result = await component.async_unload_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/switch/init.py”, line 85, in async_unload_entry
return await component.async_unload_entry(entry)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 181, in async_unload_entry
raise ValueError(“Config entry was never loaded!”)
ValueError: Config entry was never loaded!
2021-10-01 09:55:41 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry [email protected] for light
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 443, in async_unload
result = await component.async_unload_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/light/init.py”, line 512, in async_unload_entry
return await component.async_unload_entry(entry)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 181, in async_unload_entry
raise ValueError(“Config entry was never loaded!”)
ValueError: Config entry was never loaded!
2021-10-01 09:55:41 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry [email protected] for humidifier
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/config_entries.py”, line 443, in async_unload
result = await component.async_unload_entry(hass, self) # type: ignore
File “/usr/src/homeassistant/homeassistant/components/humidifier/init.py”, line 102, in async_unload_entry
return await component.async_unload_entry(entry)
File “/usr/src/homeassistant/homeassistant/helpers/entity_component.py”, line 181, in async_unload_entry
raise ValueError(“Config entry was never loaded!”)
ValueError: Config entry was never loaded!

@LLam
That logs are fine. On deletion it tries to unload all types of devices.
I suspect, 400S is reporting a bit different name via API.
I’m afraid, you’ll have to get pyvesync working on some PC, because we need to receive device info via pyvesync console to make sure, that I’m doing integration correctly…
Try to use instructions from https://github.com/webdjoe/pyvesync
and get list of devices in console. It will help drastically.

Check the logs. It may have sense trying delete and install integration (no reboot needed, just re-integrate).
Also, make sure that you’re using my integration, and not the official one.

Thank you Andrii,
I tried to go with pyvesync and the specific instructions from the link you sent. (I tried that in the past many times)
Based on the instructions, installation is by running the “pip install pyvesync” command, which I did.
Yet it doesn’t do anything other than creating the following 2 folders:

/usr/lib/python3.9/site-packages/pyvesync
(includes the following files:init.py , helpers.py, vesync.py, vesyncbasedevice.py, vesyncbulb.py, vesyncoutlet.py, vesyncfan.py, vesyncswitch.py)

/usr/lib/python3.9/site-packages/pyvesync-1.4.0.dist-info

So, after running pip install pyvesync, I don’t really understand if I have to do anything else to get this to work. Apparently the pyvesync version from the link provides compatibility with 400S, yet by running pip install pyvesync, does it really pull the specific pyvesync version that supports 400S or maybe an outdated version. Do I have to install the VeSync integration as well?
If not, how will the Vesync entities/devices show in HA?
I am definitely missing something when it comes to pyvesync installation. Any ideas?
Thank you again for all your help.

Still only the air purifier. I am only running your integration. No errors in logs except the unloading ones that @LLam mentioned.

I’ve disabled, re-enabled. Restarted core, and host. Deleted, and re-installed (with and without rebooting) and still only the 1 entity (Air Purifier)

What else can I try or look at.

Thank you in advance!!