aholstenson / miio

Control Mi Home devices, such as Mi Robot Vacuums, Mi Air Purifiers, Mi Smart Home Gateway (Aqara) and more
MIT License
1.86k stars 353 forks source link

New SmartMi Humidifier WATER LEVEL sensor #131

Open leoneleone opened 6 years ago

leoneleone commented 6 years ago

e089da30-dd73-46e4-8535-b988880e6ca5 @aholstenson

The newly released SmartMi Humidifier has a Water Level sensor. Can you please add the Water Level as a capability/sensor to your code?

leoneleone commented 6 years ago

From looking at the api information I believe the water level is defined by the “depth” capability on the humidifier. Is there any chance you can “depth” to the code?

fison67 commented 6 years ago

What is the model name like zhimi.humidifier.v1?

What do I have to add string in model.js if humidifier2 is supported?

leoneleone commented 6 years ago

I’m not sure about the model name of the new Smart Mi Humidifier as I haven’t received mine yet, but it seems the Canadian version of the original Humidifier also supports “depth” (water level?).

The model number for the Canadian version is:

zhimi.humidifier.ca1

I imagine the newest model will have the name: zhimi.humidifier.v2 But I can’t confirm that just yet.

stkang commented 6 years ago

This product is in use. My WiFi is recognized as below. zhimi-humidifier-ca1_mibt56689940

leoneleone commented 6 years ago

@stkang Which product are you referring to exactly? The model pictured above in my original post?

@aholstenson I’m still trying to find documentation on the “depth” property associated with the .ca1 model but there are no official details regarding it. It makes logical sense that “depth” refers to the Water Level of the Humidifier, I’d like to be able to use that Depth/Water Level in a homebridge plugin, but your current code doesn’t support the Depth property for Himidifiers. Any thoughts on this?

fison67 commented 6 years ago

I referenced temperature.js file and made depth file. I have tested on zhimi.humidifier.ca1.

This is a result. depth

leoneleone commented 6 years ago

@fison67 Thanks. So I assume depth=32 means the water tank is 32% full. Have you been able to confirm that depth property is indeed the water level percentage?

If so, please submit a pull request with the new depth.js file and references.

leoneleone commented 6 years ago

@fison67

Can you please send a link to the files you modified. Your forked version of miio doesn’t show the depth capability.

Thanks

stkang commented 6 years ago

@leoneleone yes

fison67 commented 6 years ago

@leoneleone

Max depth is 120. That's why value -> value / 1.2. I just modified files a moments ago.

I don't know this way is right but It's same value on the mi home app & miio.

https://github.com/fison67/miio/blob/master/lib/devices/humidifier.js https://github.com/fison67/abstract-things/blob/master/sensors/depth.js https://github.com/fison67/abstract-things/blob/master/sensors/index.js

leoneleone commented 6 years ago

@fison67 That’s great. Thank you so much.

What I’m still confused about is whether the “depth” capability is an actual indicator of Water Level. I don’t have the humidifier unit yet, waiting for it to be delivered.

The way you can confirm that “depth”=Water Level is:

  1. Fill the water tank/reservoir then check the “depth” readout.
  2. Empty the tank half way then check “depth” readout.
  3. Fully empty the tank then check “depth” readout.

If “depth” reading make a logical relationship with actual Water Level then it is indeed the correct capability for the Humidifier Water Sensor

fison67 commented 6 years ago

@leoneleone

Sorry actually I don't have a zhimi.humidifier.ca1. My friend test it.

This picture below is the MiHome app screen.

2018-03-29 1 24 15
leoneleone commented 6 years ago

@fison67

Thanks man. I feel confident "depth" refers to Water Level. Strange that full is 120 instead of 100 but I'm Xiaomi have their reasons.

Your code in the links above looks good to me. I'll add the Water Level sensor to https://github.com/acc-ua/homebridge-xiaomi-humidifier my original purpose for this was to add the WaterLevel Characteristic to the Humidifier in my HomeKit setup. Users of the plugin who want the WaterLevel in HomeKit will have to download your fork of miio to get it working, until you can submit your revisions to @aholstenson in a pull request. I'll have time to get this done tomorrow or over this weekend.

Thanks again man. Your work has been very useful 👍

manwe-pl commented 4 years ago

Anyone stepped into stuck depth level in zhimi.humidifier.ca1? I'm retrieving it in a loop with x = await device.depth(); like any other parameter (mode, temperature, etc.). But after 20~30 minutes it stops changing (other parameters are fine). If I restart my script it works again for some time.

galubap commented 3 years ago

For zhimi.humidifier.cb1 depth seems to be almost the same, like water level shown on Xiaomi Home app.