Use Wireless Switch To Turn On/Off XiaoMi Yeelight
This is a simple rule to train the XiaoMi Wireless switch to act like a normal wall light switch.
- Add a new Automation rule as described in page 5 of this tutorial.
- Choose an appropriate name for this Automation (this will be shown in Overview).
- Leave the conditions empty. This means the action will always be fired when the trigger is activated.
- Fill in the Action portion like so, remember to substitute the entity_id with the one for your Zigbee device:
- Click the save icon in the lower right.
- Congratulations. You have just created your first Automation.
Now try it out by clicking the button.
You can expand on this simple rule by setting conditions, and it can be anything you want. For example, when you are in the house, or when the time is between 9am to 10pm and so on. You can specify multiple actions on a trigger (e.g. turn on the light and a power socket). The wireless switch support the following event types:
So far I have only tried
long_click_press. Not entirely sure what is
long_click_release (they may just be duplicates of long_click_press). In other words, you can specify at least 3 Automations for a XiaoMi Smart wireless switch.
A Word From Our Sponsors
Comment from: Diogo Visitor
in point 5, with version 2.66.2, I needed to press 5 times, or more, not in the blank area above the version, at the bottom of the screen
Thanks. Have updated the article.
Comment from: Juan Visitor
I dont understand step 2. How can i do this step?
Hi Juan, which step 2 are you referring to? Can you tell me the page # of the article you’re having problems with?
Comment from: MALCOLM Visitor
Hi I cant find the password field in the latest version of the gateway 3.3.10_117 there is now a security PIN password General Settings > Security. Is this the same value??
Mac address and IP details can now also be viewed in a different menu General Settings > Network Info
No. The process has changed slightly, but it’s the same logic.
- Go into the Mi Home App
- Go into Xiaomi Gateway
- Tap on the … at the top right corner
- Tap "About"
- At the bottom, you should see "Plug-in versin: xxx.xxx.xx"
- Tap that repeatedly and two more options will pop up
- Type "Wireless communication protocol"
- Turn "Wireless communication protocol" on
- That password you see below is your API key (Everything after "Passwrd:"