MiBand 3 Home Automation with OpenHAB

Hello. I will show you a simple setup process for home automation with MiBand 3 smart watch and OpenHAB.

What you will need is:

  • Xiaomi MiBand 3 Smart Watch
  • Android Phone
  • Notify & Fitness for Mi Band (Android application)
  • Tasker (Android application)

What you can get:

  • Fell Asleep – do some tasks when you asleep
  • Woke Up – do some tasks when you awake
  • Heart Rate, Step counter, Battery Level…

First you need to pair the Xiaomi Mi Band with the MiFit application. The second step is to download the Notify & Fitness for Mi Band, connect it to your MiFit application and it should look something like this:

 

After you have successfully installed and configured the Notify & Fitness for Mi Band application we can proceed to the next step, Tasker. Tasker is one of the most powerful apps available for Android and is often used in Home Automation projects. 

After you install the Tasker application, configure it to automatically forward the intents sent from Fitness for Mi Band application to OpenHAB. Open Tasker and create a new event under System and Intent Received.

 

 

Here is one example: FellAsleep – which is very useful in bedroom. You can trigger OpenHAB to turn TV, Lights, Heater, etc. off. when you fall asleep. The name of the intent action should be “com.mc.miband.tasker.FellAsleep” (as shown in the picture below):

 

 

Furthermore, you need to create a task. In this instance I am going to create a HTTP Get task which triggers the OpenHAB, but you can make it also with MQTT or something third. Just write your ip/hostname from OpenHAB server. Also you need to put your Item name under Attributes – Item Name which we will trigger to ON.

 

Next step is to create Item and Rules in Openhab.

 

Item:


Switch MiBand_Vanja_FellAsleep
Rules:


rule "MiBand_Vanja_FellAsleep"
when
Item MiBand_Vanja_FellAsleep changed to ON
//when we receive the fell asleep command
then
MiBand_Vanja_FellAsleep.postUpdate(OFF)
//turn the switch back to off because its a momentary trigger
sendCommand(Bedroom_Desk_Lamp_Power, OFF)
//turn off the Desk Lamp
sendCommand(Bedroom_TV_Power, OFF)
//turn off the TV
sendCommand(BedsideLight_Power, OFF)
//turn off the Bedside light
end
 

That’s it. Here is a list of other intents that you can use:

When you want to get heart rate, steps, etc. from mi band you need to use the %value keyword under attributes, like this:

And you can get something like this in your OpenHAB sitemap:

If you need help, let me know. Best regards!

Vanja Vršić

Facebook YouTube 

Tagged with: , , , , , , , ,
2 comments on “MiBand 3 Home Automation with OpenHAB
  1. Hana OUERHANI says:

    Need your help please

Leave a Reply

Your email address will not be published. Required fields are marked *

*