Xiaomi mi wifi plug & air purifier

Hey, i downloaded the dev branch, but nothing changes. Did i miss something?

Nope. I merged develop into master recently. May be you are using the current version already? There are platform services now. Goto “Services”, the Domain should be called “airpurifier”. There should be offered a view services.

Oh right :slight_smile:

i’ve ordered a wifi repeater… when it arrives… i can test it :wink:

Hi syssi,

I really thank you for your devotion.

I know you are targeting for Mi Air 2 but I want to tell you the result with my Mi Air Pro for your information.

  1. The mode idle is not working. Mi Air Pro has just 3 modes(auto, silent, favorite)
  2. The led on/off services are working.
  3. The attribute of favorite level is correct(it is between 1 and 17) but the set_favorite_level is not working.
  4. Because there is no function to turn on/off a buzzer, it is not working.
  5. The set_led_brightness is not working(There is no function for it in the Mi Home app)

Thanks for your support! It’s a bug and will be fixed soon. :slight_smile: If you like to fix the service in the mean time. Take a look here:

@af950833 Could you provide the output of

mirobo --ip 192.168.x.x --token 165xxxxx...xx3 -d info

I’m interested in the model name of your device to reduce the available feature set on runtime.

The model name is ‘zhimi.airpurifier.v6’

pi@Tommy:~ $ mirobo --ip 192.168.0.15 --token 864f047eb9bf4872330b4748bd99aaaa -d info
Usage: mirobo [OPTIONS] COMMAND [ARGS]…

Error: Invalid value for “–id-file”: Path “/tmp/python-mirobo.seq” is not writable.
pi@Tommy:~ $
pi@Tommy:~ $ sudo mirobo --ip 192.168.0.15 --token 864f047eb9bf4872330b4748bd99aaaa -d info
sudo: unable to resolve host Tommy
INFO:mirobo.vacuum_cli:Debug mode active
DEBUG:mirobo.vacuum_cli:Read stored sequence ids: {‘seq’: 7, ‘manual_seq’: 0}
DEBUG:mirobo.vacuum_cli:Connecting to 192.168.0.15 with token 864f047eb9bf4872330b4748bd99aaaa
DEBUG:mirobo.protocol:Unable to decrypt, returning raw bytes.
DEBUG:mirobo.device:Got a response: Container:
data = Container:
offset2 = 32
value = (total 0)
length = 0
data = (total 0)
offset1 = 32
header = Container:
offset2 = 16
value = Container:
length = 32
unknown = 0
devtype = 822
serial = 32066
ts = 1970-01-06 11:40:36
length = 16
data = !1\x00 \x00\x00\x00\x00\x036}B\x00\x07;\xb4 (total 16)
offset1 = 0
checksum = \x86O\x04~\xb9\xbfHr3\x0bGH\xbd\x99Y\xda (total 16)
DEBUG:mirobo.device:Discovered 822 32066 with ts: 1970-01-06 11:40:36, token: b’864f047eb9bf4872330b4748bd99aaaa’
DEBUG:mirobo.device:192.168.0.15:54321 >>: {‘id’: 8, ‘method’: ‘miIO.info’, ‘params’: []}
DEBUG:mirobo.device:192.168.0.15:54321 (ts: 1970-01-06 11:40:36, id: 8) << {‘id’: 8, ‘result’: {‘fw_ver’: ‘1.2.9_9043’, ‘mmfree’: 185088, ‘ott_stat’: [1, 3, 2, 69], ‘life’: 474036, ‘model’: ‘zhimi.airpurifier.v6’, ‘token’: ‘864f047eb9bf4872330b4748bd99aaaa’, ‘ot’: ‘otu’, ‘wifi_fw_ver’: ‘SD878x-14.76.36.p84-702.1.0-WM’, ‘mac’: ‘28:6C:07:B1:AA:AA’, ‘cfg_time’: 0, ‘otu_stat’: [72, 66, 14034, 8, 14010, 2800], ‘hw_ver’: ‘MW300’, ‘ap’: {‘rssi’: -48, ‘bssid’: ‘90:9F:33:76:74:90’, ‘ssid’: ‘Tommy’}, ‘netif’: {‘gw’: ‘192.168.0.1’, ‘localIp’: ‘192.168.0.15’, ‘mask’: ‘255.255.255.0’}}}
zhimi.airpurifier.v6 v1.2.9_9043 (28:6C:07:B1:AA:AA) @ 192.168.0.15 - token: 864f047eb9bf4872330b4748bd99aaaa
DEBUG:mirobo.vacuum_cli:Full response: {‘ap’: {‘bssid’: ‘90:9F:33:76:74:90’, ‘rssi’: -48, ‘ssid’: ‘Tommy’},
‘cfg_time’: 0,
‘fw_ver’: ‘1.2.9_9043’,
‘hw_ver’: ‘MW300’,
‘life’: 474036,
‘mac’: ‘28:6C:07:B1:AA:AA’,
‘mmfree’: 185088,
‘model’: ‘zhimi.airpurifier.v6’,
‘netif’: {‘gw’: ‘192.168.0.1’,
‘localIp’: ‘192.168.0.15’,
‘mask’: ‘255.255.255.0’},
‘ot’: ‘otu’,
‘ott_stat’: [1, 3, 2, 69],
‘otu_stat’: [72, 66, 14034, 8, 14010, 2800],
‘token’: ‘864f047eb9bf4872330b4748bd99aaaa’,
‘wifi_fw_ver’: ‘SD878x-14.76.36.p84-702.1.0-WM’}
DEBUG:mirobo.vacuum_cli:Writing {‘seq’: 8, ‘manual_seq’: 0} to /tmp/python-mirobo.seq
pi@Tommy:~ $

1 Like

Thanks a lot for the info.
I upgraded the Mirobo package but the set favorite level doesn’t work with my Mi Air Pro.

I tried the below commands and restarted HA one by one but both of them is not good for me.

sudo pip3 install -U python-mirobo
sudo pip3 install -U ‘https://github.com/rytilahti/python-mirobo/archive/168f5c0ff381b3b02cedd0917597195b3c521a20.zip#python-mirobo

I just released a fixed version: https://github.com/syssi/xiaomi_airpurifier/archive/0.2.1.zip

I installed the 0.2.1 but set_favorite_level is not working for my Mi Air Pro.
It is enough for me.
I always thank you~ :slight_smile:

Just give it a try again in a few weeks. There will be some progress. :slight_smile:

Switch has suddenly stopped showing up in HA, and I’m receiving this error;

    Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/tasks.py", line 235, in _step
    result = coro.send(value)
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/homeassistant/homeassistant_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 210, in async_add_entity
    yield from entity.async_update()
  File "/home/homeassistant/.homeassistant/custom_components/switch/xiaomi_plug.py", line 159, in async_update
    ATTR_CURRENT: state.current,
AttributeError: 'PlugStatus' object has no attribute 'current'

Any ideas?

It looks like you updated python-mirobo to >=0.1.5. The current attribute was removed there and is called load_power now. Please update the custom_component (xiaomi_plug) to the current development version:

https://github.com/syssi/xiaomiplug/archive/develop.zip

The python-mirobo version trouble has an end soon. We released version 0.2.0 recently. As soon as the version bump was merged into home assistant I will update all dependend components to use version 0.2.0.

Hello.

Any plan on when may this custom component be integrated within HA?

Thanks in advance.

It sounds strange but the requirement is a merge of Xiaomi Smart WiFi Socket and Smart Power Strip integration by syssi · Pull Request #9138 · home-assistant/core · GitHub

This will introduce python-mirobo==0.2.0. I will prepare a PR of the xiaomi_airpurifier subsequently.

I installed the 0.2.1 is not working for my Mi Air Purifier 1,But the command is work great.

  • wlan0 IPv4 zhimi-airpurifier-v3_miioxxxxx _miio._udp local

Could you provide some informations about your air purifier? Which commands and properties are supported? Which features are available at the Mi Home app?

mirobo --ip 192.168.x.x --token your-token raw_command set_mode '[“auto”]'
or
miio --control 192.168.x.x --method set_power --params '["on"]'

these command is work for me,

Could you post the output of

mirobo --ip 192.168.x.x --token your-token raw_command  get_prop '["power", "aqi", "humidity", "temp_dec", "mode", "led", "led_b", "buzzer", "child_lock", "bright", "favorite_level", "filter1_life", "f1_hour_used", "use_time", "motor1_speed"]'

and

mirobo --ip 192.168.x.x --token your-token -d info

and

mirobo --ip 192.168.x.x --token your-token raw_command set_mode '["auto"]'
mirobo --ip 192.168.x.x --token your-token raw_command set_mode '["silent"]'
mirobo --ip 192.168.x.x --token your-token raw_command set_mode '["favorite"]'
mirobo --ip 192.168.x.x --token your-token raw_command set_mode '["medium"]'
mirobo --ip 192.168.x.x --token your-token raw_command set_mode '["high"]'
mirobo --ip 192.168.x.x --token your-token raw_command set_mode '["strong"]'
mirobo --ip 192.168.x.x --token your-token raw_command set_mode '["idle"]'

Thanks in advance! I will improve the support of your device afterwards.