Xiaomi mi wifi plug & air purifier

One more question from my side, is it discoverable through mDNS (does avahi-browse -a , avahi-browse -ar to see the IPs) too?

$ avahi-browse -ar
...
+  wlan0 IPv4 lumi-gateway-v3_miio522xxxxx                  _miio._udp           local
...
=  wlan0 IPv4 lumi-gateway-v3_miio522xxxxx                  _miio._udp           local
   hostname = [lumi-gateway-v3_miio522xxxxx.local]
   address = [192.168.130.xxx]
   port = [54321]
   txt = ["mac=286c07xxxxxx" "epoch=1"]
...

You are right. We can discover the gateway by netdisco. :wink:

Yeah, I thought it was done already, does not really help with detecting those devices not used through the gateway, where the output from the discovery could be useful :slight_smile:

I’m sorry. I mixed up the two threads I’m following. Please ignore my post. :slight_smile: The Xiaomi Gateway + sub devices aren’t comparable with WiFi plugs / strips and the vacuum clean IMHO. The discovery is different.

1 Like

Can you or somebody else provide the response of

miio --control 192.168.x.y --method get_prop --params "['power', 'aqi', 'humidity', 'temp_dec', 'mode', 'led', 'led_b', 'buzzer', 'child_lock', 'limit_hum', 'trans_level', 'bright', 'favorite_level', 'filter1_life', 'act_det', 'f1_hour_used', 'use_time', 'motor1_speed']"

Please specify the version/type of your device also. :slight_smile:

The result is like below.
Be careful for the single and double quotation

command >
miio --control 192.168.0.15 --method get_prop --params ‘[“power”,“aqi”,“humidity”,“temp_dec”,“mode”,“led”,“led_b”,“buzzer”,“child_lock”,“limit_hum”,“trans_level”,“bright”,“favorite_level”,“filter1_life”,“act_det”,“f1_hour_used”,“use_time”,“motor1_speed”]’)

Result>
[
“on”,
41,
62,
293,
“auto”,
“on”,
null,
null,
“off”,
null,
null,
161,
17,
77,
null,
771
]

Thanks a lot! Can you provide the model name and devtype (see above) of your device?

Can you verify the output a second time? The get_prop requests 18 properties. Your reponse contains 16 properties. Maybe it’s necessary to split up the request in two parts?

miio --control 192.168.0.15 --method get_prop --params '["power","aqi","humidity","temp_dec","mode","led","led_b","buzzer","child_lock"]')
miio --control 192.168.0.15 --method get_prop --params '["limit_hum","trans_level","bright","favorite_level","filter1_life","act_det","f1_hour_used","use_time","motor1_speed"]')

Model : Mi Air Pro

I will response the next result after a few hours… I am working now :slight_smile:

1 Like

One more task for tonight: Can you report the supported modes of your Air Purifier Pro?

miio --control 192.168.0.15 --method set_mode --params '["auto"]')
miio --control 192.168.0.15 --method set_mode --params '["silent"]')
miio --control 192.168.0.15 --method set_mode --params '["favorite"]')
miio --control 192.168.0.15 --method set_mode --params '["medium"]')
miio --control 192.168.0.15 --method set_mode --params '["high"]')
miio --control 192.168.0.15 --method set_mode --params '["strong"]')
miio --control 192.168.0.15 --method set_mode --params '["idle"]')

Thanks! :slight_smile:

See the below

pi@Tommy:~ $ miio --control 192.168.0.15 --method get_prop --params ‘[“power”,“aqi”,“humidity”,“temp_dec”,“mode”,“led”,“led_b”,“buzzer”,“child_lock”]’
INFO Attempting to control 192.168.0.15

INFO Got result:
[
“off”,
45,
63,
298,
“auto”,
“on”,
null,
null,
“off”
]

pi@Tommy:~ $ miio --control 192.168.0.15 --method get_prop --params ‘[“limit_hum”,“trans_level”,“bright”,“favorite_level”,“filter1_life”,“act_det”,“f1_hour_used”,“use_time”,“motor1_speed”]’
INFO Attempting to control 192.168.0.15

INFO Got result:
[
null,
null,
71,
17,
77,
null,
771,
2776200,
0
]

I am using the auto, silent, favorite modes.
I will check the rest modes tonight.

It looks that just 3 modes works.

pi@Tommy:~ $ miio --control 192.168.0.15 --method set_mode --params ‘[“auto”]’
INFO Attempting to control 192.168.0.15

INFO Got result:
[
“ok”
]
pi@Tommy:~ $ miio --control 192.168.0.15 --method set_mode --params ‘[“silent”]’ INFO Attempting to control 192.168.0.15

INFO Got result:
[
“ok”
]
pi@Tommy:~ $ miio --control 192.168.0.15 --method set_mode --params ‘[“favorite” ]’
INFO Attempting to control 192.168.0.15

INFO Got result:
[
“ok”
]
pi@Tommy:~ $ miio --control 192.168.0.15 --method set_mode --params ‘[“medium”]’
INFO Attempting to control 192.168.0.15

ERROR Encountered an error while controlling device

Error was:

pi@Tommy:~ $ miio --control 192.168.0.15 --method set_mode --params ‘[“high”]’
INFO Attempting to control 192.168.0.15

ERROR Encountered an error while controlling device

Error was:

pi@Tommy:~ $ miio --control 192.168.0.15 --method set_mode --params ‘[“strong”]’
INFO Attempting to control 192.168.0.15

ERROR Encountered an error while controlling device

Error was:

pi@Tommy:~ $ miio --control 192.168.0.15 --method set_mode --params ‘[“idle”]’
INFO Attempting to control 192.168.0.15

ERROR Encountered an error while controlling device

Error was:

pi@Tommy:~ $

Thanks! The last missing piece of the puzzle is the devtype (a number which will be shown on discovery). May be you have to enable the debug mode first or change the line from _LOGGER.debug to _LOGGER.info or _LOGGER.warning.

_LOGGER.debug("Discovered %s %s with ts: %s" % (self._devtype,
                                                            self._serial,
                                                            self._device_ts))

Apparently there were other modes exposed at some point which are not anymore available: https://github.com/aholstenson/miio/issues/13

I have removed the unsupported modes.

@syssi is this part of the new Xiaomi component added to HA recently in 0.50

No. The new component is about the xiaomi gateway (zigbee) and sub devices (sensors & actors). The devices (air purifier & wifi plug != zigbee plug) mentioned here are WiFi devices and won’t official supported right now.

@syssi, wouldn’t it make sense (or wouldn’t it be possible) to merge support of both lines of Xiaomi products, Zigbee and non-Zigbee, in a common component? Here we’re talking about air purifier and sockets, but there are others that are only WiFi: IR remote, Vacuum robot, etc…

Let’s assume both devices (xiaomi gateway and f.e. the air purifier) has nothing in common. Do you still want to merge both lines?