MiPower is a Home Assistant integration that allows you to control the power state of media players that do not support traditional Wake-on-LAN (WOL) but can be "woken up" by a Bluetooth pairing request. It was specifically designed for devices like the Xiaomi Mi Box, but may work with other similar Android TV boxes.
This integration creates a switch
entity in Home Assistant.
- Turning ON the switch sends a series of Bluetooth commands via
bluetoothctl
to wake the device up. - Turning OFF the switch calls the
media_player.turn_off
service for the linked device. - The state of the switch is automatically synchronized with the state of the linked media player entity.
The MiPower project is developed with the vision of adding value to the open source community. Your support is vital to maintaining the continuity and development speed of this project.
If you appreciate my effort, you can support me via GitHub Sponsors or the following platforms. Thank you in advance!
Alternatively, you can see all funding options by clicking the Sponsor button (❤️) in the top right corner of the repository.
- Home Assistant OS / Supervised / Container: This integration requires a Linux-based Home Assistant installation where the
bluetoothctl
command-line tool is available and accessible. It will not work on a Home Assistant Core installation on Windows.
This integration is available as a custom repository in HACS.
- Navigate to your HACS dashboard.
- Click on Integrations.
- Click the three-dots menu in the top-right corner and select "Custom repositories".
- In the dialog box, enter the following information:
- Repository:
https://github.com/DenizOner/MiPower
- Category:
Integration
- Repository:
- Click "Add".
- The "MiPower" integration will now appear in your HACS list. Click on it.
- Click the "Download" button and then "Download" again in the next window.
- After the download is complete, you must restart Home Assistant for the integration to be loaded.
While HACS is the recommended method, you can also install the integration manually.
- Go to the Releases page of the repository and download the
mipower.zip
file from the latest release. - Unzip the downloaded file.
- Inside the unzipped folder, you will find a
custom_components
directory. Copy themipower
folder from within it. - Paste the copied
mipower
folder into thecustom_components
folder in your Home Assistant configuration directory. If thecustom_components
folder does not exist, you need to create it.- The final path should look like:
.../config/custom_components/mipower/
- The final path should look like:
- Restart Home Assistant.
After restarting, you can add and configure the MiPower switch.
- Go to Settings > Devices & Services.
- Click the "+ Add Integration" button in the bottom-right corner.
- Search for "MiPower" and click on it.
This is the simplest way to configure the integration.
- When prompted, choose "Easy Setup".
- The integration will automatically discover Bluetooth-enabled media players on your system.
- Select your target device (e.g., "Xiaomi Mi Box 4") from the dropdown list.
- Click "Submit".
That's it! The integration will create a switch linked to your media player.
Use this method if the Easy Setup does not find your device or if you need to configure advanced timing settings from the start.
- Step 1: Device Selection
- Choose "Advanced Setup".
- Select your target media player from the list of all media players in your Home Assistant.
- Step 2: MAC Address
- The integration will try to find the Bluetooth MAC address of the selected device.
- If found, it will be pre-filled. Verify that it is correct.
- If not found, you must enter the Bluetooth MAC address of your device manually.
- Step 3: Timing Settings
- You can configure various timeouts and delays for the Bluetooth commands. For most users, the default values are sufficient.
- Click "Submit" to complete the setup.
After you have configured your MiPower switch, you can adjust the timing settings at any time.
- Go to Settings > Devices & Services.
- Find the MiPower integration and click "Configure".
- Adjust the sliders for debounce, timeouts, and delays as needed.
In the configuration or options menu, you can fine-tune the timing of the Bluetooth commands. For most users, the default values work well.
-
Turn-On Debounce: The minimum time (in seconds) that must pass before the 'turn on' command can be executed again. This prevents spamming the device with wake-up signals if the switch is toggled rapidly.
-
Turn-Off Debounce: The minimum time (in seconds) that must pass before the 'turn off' command can be executed again.
-
Delay Between Commands: A very short delay (in seconds) between sending consecutive commands to the
bluetoothctl
utility. On some systems, adding a small pause can improve reliability. -
Process Spawn Timeout: The maximum time (in seconds) to wait for the
bluetoothctl
process to start. If it fails to start within this time, the turn-on attempt will fail. -
Pairing Timeout: In the simplified turn-on logic, this is the amount of time to wait after sending the
pair
command before assuming success. It gives the device time to process the wake-up signal. -
Bluetooth Scan Duration: The duration (in seconds) that the integration will scan for Bluetooth devices before attempting to send the pair command. A longer scan can help find devices that are slow to advertise their presence.
- Afrikaans
- العربية (Arabic)
- български (Bulgarian)
- বাংলা (Bengali)
- Català (Catalan)
- Čeština (Czech)
- Dansk (Danish)
- Deutsch (German)
- Deutsch (Schweiz) (German, Switzerland)
- Ελληνικά (Greek)
- English
- Español (Spanish)
- Eesti (Estonian)
- Euskara (Basque)
- فارسی (Persian)
- Suomi (Finnish)
- Français (French)
- Gaeilge (Irish)
- Galego (Galician)
- ગુજરાતી (Gujarati)
- עברית (Hebrew)
- हिन्दी (Hindi)
- Hrvatski (Croatian)
- Magyar (Hungarian)
- Bahasa Indonesia (Indonesian)
- Íslenska (Icelandic)
- Italiano (Italian)
- 日本語 (Japanese)
- ქართული (Georgian)
- ಕನ್ನಡ (Kannada)
- 한국어 (Korean)
- Kernewek (Cornish)
- Lëtzebuergesch (Luxembourgish)
- Lietuvių (Lithuanian)
- Latviešu (Latvian)
- മലയാളം (Malayalam)
- Монгол (Mongolian)
- मराठी (Marathi)
- Bahasa Melayu (Malay)
- Norsk bokmål (Norwegian Bokmål)
- नेपाली (Nepali)
- Nederlands (Dutch)
- Polski (Polish)
- Português (Portuguese)
- Português (Brasil) (Portuguese, Brazil)
- Română (Romanian)
- Русский (Russian)
- Slovenčina (Slovak)
- Slovenščina (Slovenian)
- Српски (Serbian)
- Srpski (latinica) (Serbian, Latin)
- Svenska (Swedish)
- Kiswahili (Swahili)
- తెలుగు (Telugu)
- ไทย (Thai)
- Türkçe (Turkish)
- Українська (Ukrainian)
- اردو (Urdu)
- Tiếng Việt (Vietnamese)
- 简体中文 (Simplified Chinese)
- 繁體中文 (香港) (Traditional Chinese, Hong Kong)