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

Great that helped.
It won’t populate, or will be disabled - unfortunately, API is still laggy. Pyvesync library developer needs help with interception of Android app API requests, but I can’t help, as my phone doesn’t allow that…
If you can help, it would probably help a lot.

BR
Andrii

Hello Andrii,

I followed your suggestion and removed the 4 lines in common.py relating to Switch and Light. Now have just the one entity.

Since then I have received no more error logs. The base entity is still stable after 36 hours. Well pleased.

I have also tested the following four services.

Humidifier: Toggle

Works as expected.

Humidifier: Turn off
Humidifier: Turn on
Humidifier: Set mode (I set this to auto)

The last 3 all worked as expected within two Automations.

The last service, “Humidifier: Set humidity” has not been tested yet due to naming/function inconsistencies and that is Target humidity: 54 % (Auto) as shown in the image below (I changed the name in the dashboard to read Current).

The value shown is the Current Humidity as displayed on the LED screen. It is not the target. My target is set to 45 % as per the App.

Clicking on the 3 dots displays a Target humidity slider. Again showing incorrect value as it should be 45 %.
Moving the slider does update the App Target humidity value (it’s very quick), but we have no correct display option for this.

Food for thought Andrii, suggestions welcomed.

Jeff

Nice work! I did purchase a Levoit 60H on Amazon today (prime day discount).
Would this one also work? I would love to add it to my HA setup.

I guess it won’t - it has no internet connection, from what i see, but is using the remote. I suggest, you could use something like Broadlink RM4 to connect it to HA. I did same stuff with my portable conditioner a while ago.

Hey Jeff.
Yes, i noticed it as well.
Looks like it got screwed up, when i added “humidity” entry to additional attributes - it overwrote target humidity value for HA.
Fixed it in new commit, check out repo.
(You may only replace humidifier.py file, all changes are there).
Now “target humidity” works good (changing it will switch device to Auto mode, as this is target humidity for Auto).
additional attribute “humidity” was renamed to “current_humidity”. Also removed some unnecessary additional state attributes from there.
Still lags though, can’t do much there.

BR
Andrii.

Seems like you looked into the wrong unit. The 60H does offer VeSync integration via there app.
If its not working i will look into flashing it with ESPHome / possible replacing the integrated controller with a Esp module.

I also dont unterstand the current limitations and where they are from. Seems like we can only get one controllable “output” (light or humidifying or display) to work? All of them together make issues?

Sorry, i got confused with 600HH, i guess.
This one is been sold in Europe? Could find it on amazon.de. It seems to be pretty similar to 300s though, maybe, just rebranding for another market.
If it respond with “Classic300S” as device type, it will work. Otherwise pyvesync repo should be updated with its device type to support it. After that i could extend this HA integration too.

I also dont unterstand the current limitations and where they are from. Seems like we can only get one controllable “output” (light or humidifying or display) to work? All of them together make issues?

This device is using some manufacturer server, which is a bit laggy, and often throws errors instead of accepting requests. Especially, if there’s several requests for one device coming.
Whic is exactly the case, when we want to initialize several Home Assistant entities, which are actually in one physical device (our case - it’s humidifier itself, night light bulb, and display switch). So HA, basically, bombs server with requests for this entities, and server starts throwing errors.
This leads to uninitialized entities there, and from those three, HA can miss either two.
That’s why i recommended to comment out bulb and display initialization code. It is working, but only if server itself works.

BR
Andrii.

Thanks for your explanation.

Yes the one is sold in Europe.

The server thing seems silly, i will look into replacing the controller than. I dont want to rely on the manufacturer servers. I was under the impression that control would be local only.

I will post my findings here.

Yes, this integration is cloud-based.
It’s always better to have local way to rule devices. Good luck there, and please share, if you succeed :slight_smile:

Cheers
Andrii.

Ok Thanks Andril. I will update tomorrow. Keep up the good work !!

1 Like

Hi Andril,

It’s been a week since our last contact, so just a quick update from me to report that all is well here with the VeSync FormatBCE Integration. Not one error to report. I updated my dashboard to use the services available and except for the occasional response lag, it works perfectly. In addition, a new family member arrived last week, one Levoit Air Purifier LV-PUR131S. Therefore, an additional entity created. No problems encountered and no response lag, but I would have expected a new device plus 1 entity !

Jeff

Glad to hear, Jeff. Mine is working too. Looks like, if I stop bombing that server and just use it - it’s almost fine :slight_smile:
I tried to meet all requirements for pull request to HA main repository, but didn’t even manage to run HA test setup. Will try on another PC this week. There’s too many to check for this small change :slight_smile:

Gonna keep updates.

Cheers
Andrii.

On that question about adding device for purifier:

I didn’t touch existing functionality for already supported devices, and there’s no implementation of device. Don’t know if it’s really needed, as we it will have just one entity in it, but it’s definitely doable. :slight_smile:

Thanks for the update on this. It works (with both flavours), so I won’t touch anything !! :slightly_smiling_face:

thanks for your work on this. I was looking for a humidifier to buy that I could tie into HA and the levoit looks like the one to get now. So do I just download your folder and stick it in the custom_components folder? I only really need to have it turn on and off as well as see the humidity levels

Yes, that’s pretty much it. It’s same old VeSync integration, just with added code for humidifier.
You may comment out the code related to screen and night light, to improve main stability. But it will work without modification too.

1 Like

Just got my humidifier in and looking at common.py, not too sure what to comment out. Im guessing these four lines below?

    if manager.fans:
        for fan in manager.fans:
            if HUMI_DEV_TYPE_TO_HA.get(fan.device_type):
                devices[VS_HUMIDIFIERS].append(fan)
                # devices[VS_SWITCHES].append(fan)
                # devices[VS_LIGHTS].append(fan)
                humidifiers_count += 1
                # switches_count += 1
                # lights_count += 1
            else:
                devices[VS_FANS].append(fan)
                fans_count += 1

yep, seems like thats all you need to comment out. I only see an entity for the humidifier. Thanks for all the work again!

Yes, sorry for no response - didn’t get notification. This should be enough.
For me, it works with all other entities for last week without any problems. But it definitely is more stable without that additional stuff.

no worries. I do see some errors in my log:

Logger: pyvesync.helpers
Source: /usr/local/lib/python3.9/site-packages/pyvesync/helpers.py:174
First occurred: 11:10:56 AM (1 occurrences)
Last logged: 11:10:56 AM

HTTPSConnectionPool(host='smartapi.vesync.com', port=443): Max retries exceeded with url: /cloud/v2/deviceManaged/bypassV2 (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fafa8e773a0>: Failed to establish a new connection: [Errno -3] Try again'))

and

This error originated from a custom integration.

Logger: homeassistant.helpers.entity
Source: custom_components/vesync_formatbce/common.py:107
Integration: VeSync-FormatBCE
First occurred: 11:10:56 AM (1 occurrences)
Last logged: 11:10:56 AM

Update for humidifier.bedroom_humidifier fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 401, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 609, in async_device_update
    raise exc
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/vesync_formatbce/common.py", line 107, in update
    self.device.update()
  File "/usr/local/lib/python3.9/site-packages/pyvesync/vesyncfan.py", line 757, in update
    self.get_details()
  File "/usr/local/lib/python3.9/site-packages/pyvesync/vesyncfan.py", line 738, in get_details
    outer_result = r.get('result', {})
AttributeError: 'NoneType' object has no attribute 'get'

Anything else I can do to prevent these?