Xiaomi mi wifi plug & air purifier

hi can you help me
where i put xiaomi_plug.py file in pi3 so i can work with my Xiaomi WiFi Plug?

Just create a folder called “custom_components” at the same directory as your configuration.yaml. In my case it looks like this:

/home/homeassistant/.homeassistant/custom_components/switch/xiaomi_plug.py

@flyguy Do you still use the Chuang Mi Plug V1 with the USB port? Could you check something to improve the Home Assistant support?

Can’t get the token :frowning: no rooted android phone

@syssi

Yes I am still using.

what can I do for you?

Could you try to ask the plug for the property temperature? Does the device provide an internal temperature?

cp. Plug with USB port compatibility? · Issue #5 · syssi/xiaomiplug · GitHub

What’s the output of

mirobo --ip 10.x.x.x --token a3d7fxxx  get_prop '["on","usb_on", "temperature"]'

Some good news! The xiaomiplug (official called switch.xiaomi_miio!) will be part of HA 0.56. In addition I have created a pull request for the xiaomi_airpurifier (in future called fan.xiaomi_miio): https://github.com/home-assistant/home-assistant/pull/9837

The xiaomiplug (switch.xiaomi_miio) gets a few recently added features soon. It’s part of this pull request: https://github.com/home-assistant/home-assistant/pull/9836

6 Likes

Hey congrats dude! Still haven’t gotten my purifier… But one of these days!

If it is included in HA 0.55.
How to enable it to discover my plugs and power strips.

It’s not working.

I was wrong. It will be released with version 0.56.

1 Like

ok, can you tell me how to enable it using Xiaomi_miio.py on HA 0.55.
I tried creating new folder custom_components/switch/xiaomi_miio.py
and updated my configuration like this:
switch:

  • platform: switch.xiaomi_plug
    name: Drawing Socket
    host: 192.168.86.31
    token: 2de97e36acaea4a7b9bb0651f7ceb11a

but I am still not able to make it work.

With the release of HA 0.56 the custom component isn’t needed anymore. Just add the configuration (use xiaomi_miio instead of xiaomi_plug):

switch:
  platform: switch.xiaomi_miio
  name: Drawing Socket
  host: 192.168.86.31
  token: 2de97e36acaea4a7b9bb0651f7ceb11a

As long as HA 0.56 isn’t released just use the custom component (https://github.com/syssi/xiaomiplug):

custom_components/switch/xiaomi_plug.py

switch:
  platform: switch.xiaomi_plug
  name: Drawing Socket
  host: 192.168.86.31
  token: 2de97e36acaea4a7b9bb0651f7ceb11a
1 Like

I have added custom component as xiaomi_plug.py but it is not discovering my switch.
switch:

  • platform: switch.xiaomi_plug
    name: Drawing Socket
    host: 192.168.86.60
    token: 2de97e36acaea4a7b9bb0651f7ceb11a
    Can you please help.

Thanks Syssi for the effort. It’s been a great component to HASS.
A question to that, I have upgraded to 0.56.1 and the WIFI plug USB toggle has gone.
But if I change back to the custom component, the USB is back on again. Is this something missed to the xiaomi_miio on 0.56.1?

You are right. The Chuang Mi Plug V1 support isn’t merged yet. I assume it will be part of a future release:

cool, that explains now.
Will wait for the next release… switch back to custom_component for now.
Thank you!

Could you do me a favour? Just read this post:

and execute the mentioned command (may be inside of your python environment). Does the Chuang Mi Plug V1 return a temperature?

Hi syssi,

Sure, I am happy to help out that. But how can I run the mirobo? I am running on HASS on Mac mini.

Here is my output…

bash-3.2# mirobo
bash: mirobo: command not found

How did you install homeassistant? If you have installed it inside a virtualenv, you have to activate it (and it’s usually good idea to avoid using root like shown in your output). That command is only available in the same environment homeassistant is installed and run.

I installed by following it on https://home-assistant.io/docs/installation/macos/
I didn’t remember I have installed the mirobo before.
The way I use the xiaomi_plug is have the custom_component on the main directory.