pschroeder89 / homebridge-levoit-humidifiers

Levoit Humidifiers Plugin for Apple HomeKit via Homebridge
Apache License 2.0
70 stars 9 forks source link

Setting auto mode turns device off #2

Closed michaeldonovan closed 2 years ago

michaeldonovan commented 2 years ago

First off, thanks for putting this together, this is super useful.

I tried it with my Classic 300S and everything seems to be working great except auto mode. When I set the device to auto via HomeKit the device turns off. It's not just that the mist turns off, the device shows up as off in the VeSync app. This happens regardless of what the target humidity is set to. Also, if I set the device to auto mode in the VeSync app, it shows up as being in manual mode in homekit.

Let me know if there's any other information I can provide that'd be helpful. I might try to dig into the code a bit if I have some time this weekend.

Thanks!

pschroeder89 commented 2 years ago

Thanks for the bug! I have also been seeing this but haven't had a lot of time to dig into it. I should be able to take a look this weekend.

kurktchiev commented 2 years ago

Can confirm it’s doing the same thing for me as well on the 300s

kreeger commented 2 years ago

So far as I can tell and based on my limited familiarity with the Vesync API (I sniffed out the request from their app using Charles on my phone), the API call to the Vesync API looks good and right, and mode should be set to "auto" (and it is!) — gonna check and see if debug mode gives me anything interesting.


Update: going from Humidity mode to Auto actually sets the switch to be off.

[12/8/2021, 12:28:45 AM] [Levoit Humidifiers] [DEBUG]: [SEND COMMAND] Sending command setSwitch to Humidifier with ({"enabled":false,"id":0})...

A couple additional observations:

I don't know enough about the inner workings of Homebridge to fully diagnose, but it sounds like maybe there's some state management that's not being handled correctly, or a switch listener not being set properly?

pschroeder89 commented 2 years ago

Thanks @kreeger. Still haven't taken a look, but that's very helpful. From your logs, it seems like switching to Auto is not calling changeMode, but setSwitch. I'll try to get to this in an hour or so

pschroeder89 commented 2 years ago

I've published this fix in homebridge-levoit-humidifiers@1.2.7

Here are the two PRs: https://github.com/pschroeder89/homebridge-levoit-humidifiers/pull/4 https://github.com/pschroeder89/homebridge-levoit-humidifiers/pull/5

The auto mode target level still can't be adjusted currently FWIW.

michaeldonovan commented 2 years ago

Works great, thanks!

kurktchiev commented 2 years ago

seems to be working on my end as well. or at least it doesnt just shut itself off.