Home Assistant Community

Xiaomi mi wifi plug & air purifier

#329

@syssi Hi! Thanks for your awesome componnt. WOuld u think it is possible to create a AC Controller for this ?

This is already done for broadlink… would really be interested… unfortunately i am not able as i am not a coder or famiiar with python :frowning:

#330

I did receive your messages. It will be hard to implement a climate device without owning the hardware (ir remote & air condition / thermostat with IR receiver). There is another Xiaomi device called Xiaomi Air Conditioner Companion, which will be supported by HA soon: https://github.com/home-assistant/home-assistant/pull/10761

Please explain in a few words what you are trying to achieve. Do you own a air condition? Which IR commands does the air condition support? Is there a message structure? Can you provide the IR commands?

#331

hey… great having a feedback :slight_smile: well… I own an ac here which is controlled very easy with IR signals. It works perfect with broadlink ac component but i don’t wanna use broadlink (design is not my taste) so i replaced everything by the Xiami devices.

well.

I would like having a “complete” compnent" to control my 4 Air conditionings via frontend but also via automations.

automation wont need nice frontend style that’s clear.

The Xiaomi is the same princiü loike the broadlink… so i thought it would be easier to just use the broadlink ac component and “port” it to xiaomi. Sorry as mentioneed… i am absoltely nit familiar with coding.

but let me throw an eye the mentioned component. i might use dev branch to test if it work for my needs. I will give feedback asap.

#332

Could you provide your broadlink configuration?

#333

Hi, syssi. For IR code learn, there is another file called xiaomi_ir.py. Do you need it as well? And actually AC Controller is the same product as Xiaomi AC Partner. The difference are appearance and brand. Both products are made by Aqara but square one is branded Aqara and Round one is branded Xiaomi. Just like other Zigbee products such as temperature sensor and windows/door binary sensors. Furthermore, I notice that only Aqara one is official sold abroad, which means that overseas customers may only be familiar with this one.

@thundergreen We are working on AC Partner component. Right now, you can follow this repository and add it as custom_component. You can check markdown file, which is English Doc. Since PR at home-assistant official repository is quite a chaos now.

#334

@cxlwill I alredy tried AC Partner but it won’t work for the Chuang Mi IR Remote Controller unfortunately.

so we will have to pick up the xiaomi_ir.py to build this AC component

@syssi here is the link to the braodlink:

Config would look something like:

climate:
  - platform: broadlink
    name: Toyotomi Akira
    host: 192.168.1.85
    mac: 'BB:BB:BB:BB:BB:BB'
    ircodes_ini: 'broadlink_climate_codes/toyotomi_akira.ini'
    min_temp: 16
    max_temp: 30
    target_temp: 20
    temp_sensor: sensor.living_room_temperature
    default_operation: idle
    default_fan_mode: mid
    customize:
      operations:
        - idle
        - cool
        - heat
      fan_modes:
        - low
        - mid
        - high
        - auto

#335

Hi everyone, I have a Xiaomi Air Purifier Gen 1, and have tried to use the plugin. So far it doesn’t seem to detect it, although my Xiaomi Robot Vacuum detects fine and can be controlled. Would that be because the Xiaomi Air Purifier Gen 1 is not supported? So far, the discussions seem to be focused on the latter models of the Xiaomi Air Purifier.

If the Xiaomi Air Purifier Gen 1 isn’t supported in this plugin, is there anything that supports it?

Thank you everyone!

#336

Please use this component: https://home-assistant.io/components/fan.xiaomi_miio/

#337

Yes, that’s the component that I’m using, and the guide that I used as well. My configuration is below:

Xiaomi Air Purifier

fan:

  • platform: xiaomi_miio
    name: Xiaomi Air Purifier
    host: 10.168.48.243
    token: [my token removed]

I’ve added the Xiaomi Robot Vacuum successfully as well, so I’m fairly sure I used the right process to extract the tokens. However, the component isn’t turning up in my Home Assistant page.

My Air Purifier is a Gen 1 (not Xiaomi Air Purifier 2, Air Purifier 2S or Air Purifier Pro) so I’m wondering if that is the reason why the component isn’t turning in my Home Assistant page? If the Gen 1 is supported, then not sure what I’m doing incorrectly? Any advice appreciated! Thank you!

#338

@syssi Any ideas with this one?

#339

Thanks for all your work on the xiaomi purifier! Any future plans on supporting the humidifier through HA?

#340

Not yet. Do you like to provide some testing?

#341

hi raty,
just trying to achieve what you’ve done, however it doesnt seem to work. It doesnt change the fan speed, any idea what I am doing wrong?

I pretty much copied and pasted your settings and just changing the IP address to my purifier.

Thanks

image

#342

Hi kwetiaw,
since 0.60 the AirPurifier component isn’t working anymore in Home-Assistant (at least for me it isn’t).
I’ve read on github, that syssi is working on the solution.

Also, since there is an official component, the miio command has been replaced by the mirobo command.
But luckily it isn’t necessary anymore to do it the way I described.

Now, with the official component you can just use input_number and an automation like this:

Automation:

- id: xiaomi_fav_speed
  alias: Xiaomi Favorite Speed
  trigger:
    platform: state
    entity_id: input_number.xiaomi_fav_speed
  action:
    - service: fan.xiaomi_miio_set_favorite_level
      data_template:
        entity_id: fan.xiaomi_air_purifier_2
        level: '{{ states.input_number.xiaomi_fav_speed.state | int }}'

input_number:

xiaomi_fav_speed:
  name: Xiaomi Air Purifier Favorite Level
  initial: 5
  min: 1
  max: 16
  step: 1

But, as I said earlier, at the moment, it doesn’t work at all.

#343

I have the humidifier and would be more than happy to test for you

#344

It’s fixed and will be part of the next homeassistant release: https://github.com/home-assistant/home-assistant/pull/11837

1 Like
#345

I wrote a custom component as first step:

Please give it a try. If it works fine I will merge the code into fan/xiaomi_miio.

#346

@af950833 Last request for today. :wink: I want to support your Air Purifier Pro properly. You already know the procedere. Could you post the output of:

# I want to know the model name
bin/mirobo --ip 192.168.1.xx --token 3d5fffffffffffffffffffffff37453b info
# First bunch of properties
bin/mirobo --ip 192.168.1.xx --token 3d5fffffffffffffffffffffff37453b get_prop '["power", "aqi", "average_aqi", "humidity", "temp_dec", "mode", "favorite_level", "filter1_life", "f1_hour_used", "use_time", "motor1_speed", "purify_volume", "f1_hour"]'
# Second bunch of properties
bin/mirobo --ip 192.168.1.xx --token 3d5fffffffffffffffffffffff37453b get_prop '["led", "led_b", "bright", "buzzer", "child_lock", "volume" ]'

Thanks! :slight_smile:

#347

(homeassistant) [email protected]:/home/pi $ mirobo --ip 192.168.0.15 --token 2a4d39a5721f983fdceae9193fc35596 -d info
INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Read stored sequence ids: {‘manual_seq’: 0, ‘seq’: 12}
DEBUG:miio.vacuum_cli:Connecting to 192.168.0.15 with token 2a4d39a5721f983fdceae9193fc35596
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b’‘
DEBUG:miio.device:Got a response: Container:
data = Container:
data = (total 0)
offset2 = 32
offset1 = 32
length = 0
value = (total 0)
header = Container:
data = !1\x00 \x00\x00\x00\x00\x036}B\x00\x0b\xdbO (total 16)
offset2 = 16
offset1 = 0
length = 16
value = Container:
length = 32
unknown = 0
device_id = 03367d42 (total 8)
ts = 1970-01-09 23:50:39
checksum = *M9\xa5r\x1f\x98?\xdc\xea\xe9\x19?\xc3U\x96 (total 16)
DEBUG:miio.device:Discovered b’03367d42’ with ts: 1970-01-09 23:50:39, token: b’2a4d39a5721f983fdceae9193fc35596’
DEBUG:miio.device:192.168.0.15:54321 >>: {‘method’: ‘miIO.info’, ‘params’: [], ‘id’: 13}
DEBUG:miio.device:192.168.0.15:54321 (ts: 1970-01-09 23:50:39, id: 13) << {‘result’: {‘token’: ‘2a4d39a5721f983fdceae9193fc35596’, ‘mac’: ‘28:6C:07:B1:FE:B8’, ‘otu_stat’: [74, 74, 21452, 25, 21384, 404], ‘ot’: ‘otu’, ‘hw_ver’: ‘MW300’, ‘life’: 777039, ‘ap’: {‘ssid’: ‘Tommy’, ‘rssi’: -35, ‘bssid’: ‘AC:9E:17:A1:DF:F8’}, ‘model’: ‘zhimi.airpurifier.v6’, ‘wifi_fw_ver’: ‘SD878x-14.76.36.p84-702.1.0-WM’, ‘netif’: {‘localIp’: ‘192.168.0.15’, ‘mask’: ‘255.255.255.0’, ‘gw’: ‘192.168.0.1’}, ‘mmfree’: 185644, ‘ott_stat’: [0, 0, 0, 0], ‘cfg_time’: 0, ‘fw_ver’: ‘1.2.9_9049’}, ‘id’: 13}
zhimi.airpurifier.v6 v1.2.9_9049 (28:6C:07:B1:FE:B8) @ 192.168.0.15 - token: 2a4d39a5721f983fdceae9193fc35596
DEBUG:miio.vacuum_cli:Full response: {‘ap’: {‘bssid’: ‘AC:9E:17:A1:DF:F8’, ‘rssi’: -35, ‘ssid’: ‘Tommy’},
‘cfg_time’: 0,
‘fw_ver’: ‘1.2.9_9049’,
‘hw_ver’: ‘MW300’,
‘life’: 777039,
‘mac’: ‘28:6C:07:B1:FE:B8’,
‘mmfree’: 185644,
‘model’: ‘zhimi.airpurifier.v6’,
‘netif’: {‘gw’: ‘192.168.0.1’,
‘localIp’: ‘192.168.0.15’,
‘mask’: ‘255.255.255.0’},
‘ot’: ‘otu’,
‘ott_stat’: [0, 0, 0, 0],
‘otu_stat’: [74, 74, 21452, 25, 21384, 404],
‘token’: ‘2a4d39a5721f983fdceae9193fc35596’,
‘wifi_fw_ver’: ‘SD878x-14.76.36.p84-702.1.0-WM’}
DEBUG:miio.vacuum_cli:Writing {‘manual_seq’: 0, ‘seq’: 13} to /tmp/python-mirobo.seq
(homeassistant) [email protected]:/home/pi $
(homeassistant) [email protected]:/home/pi $ mirobo --ip 192.168.0.15 --token 2a4d39a5721f983fdceae9193fc35596 raw_command get_prop '[“power”, “aqi”, “average_aqi”, “humidity”, “temp_dec”, “mode”, “favorite_level”, “filter1_life”, “f1_hour_used”, “use_time”, “motor1_speed”, “purify_volume”, “f1_hour”]'
Sending cmd get_prop with params [‘power’, ‘aqi’, ‘average_aqi’, ‘humidity’, ‘temp_dec’, ‘mode’, ‘favorite_level’, ‘filter1_life’, ‘f1_hour_used’, ‘use_time’, ‘motor1_speed’, ‘purify_volume’, ‘f1_hour’]
[‘off’, 7, 18, 45, 234, ‘auto’, 17, 52, 1664, 2642700, 0, 62180, 3500]
(homeassistant) [email protected]:/home/pi $
(homeassistant) [email protected]:/home/pi $ mirobo --ip 192.168.0.15 --token 2a4d39a5721f983fdceae9193fc35596 raw_command get_prop '[“led”, “led_b”, “bright”, “buzzer”, “child_lock”, “volume” ]'
Sending cmd get_prop with params [‘led’, ‘led_b’, ‘bright’, ‘buzzer’, ‘child_lock’, ‘volume’]
[‘on’, None, 83, None, ‘off’, 50]
(homeassistant) [email protected]:/home/pi $

It is my pleasure to help you :slight_smile:
As I mentioned, there is no “led_b” in the Air purifier(and Buzzer is not in it)

#348

Perfect! I will prepare the next interation.