satcar77 / miband4

Access Xiaomi MiBand 4 from Linux using Bluetooth LE
MIT License
481 stars 109 forks source link

Can be used for home automation #5

Open ricardojlrufino opened 4 years ago

ricardojlrufino commented 4 years ago

It is possible to listen for click / navigation events ?

satcar77 commented 4 years ago

Yes, it is possible to listen to events from the music player in the band.

MrVinceZ commented 4 years ago

Hi, it is possible to listen to sleep detection event ? Thank you

satcar77 commented 4 years ago

You would have to poll the band to receive activity data frequently and check the category value received from the band. The value for deep sleep is 11 and light sleep is 9.

MrVinceZ commented 4 years ago

Do you know where I can found the signification of every value ? Thank you

ricardojlrufino commented 4 years ago

I implemented a integration with miband4 and ifttt https://www.youtube.com/watch?v=qLhn1YDUCf4 https://ricardojlrufino.wordpress.com/2020/02/26/controle-dispositivos-com-sua-mi-band-4/ sorry, portuguese language...

satcar77 commented 4 years ago

I implemented a integration with miband4 and ifttt https://www.youtube.com/watch?v=qLhn1YDUCf4 https://ricardojlrufino.wordpress.com/2020/02/26/controle-dispositivos-com-sua-mi-band-4/ sorry, portuguese language...

Awesome. It was really cool.

satcar77 commented 4 years ago

Do you know where I can found the signification of every value ? Thank you

@MrVinceZ These were the association to the values uncovered by the gadget bridge team. I hope this helps.

    // 0 = same activity kind as before
    // 1 = light activity walking?
    // 3 = definitely non-wear
    // 9 = probably light sleep, definitely some kind of sleep
    // 10 = ignore, except for hr (if valid)
    // 11 = probably deep sleep
    // 12 = definitely wake up
    // 17 = definitely not sleep related
public static final int TYPE_UNSET = -1;
public static final int TYPE_NO_CHANGE = 0;
public static final int TYPE_ACTIVITY = 1;
public static final int TYPE_RUNNING = 2;
public static final int TYPE_NONWEAR = 3;
public static final int TYPE_RIDE_BIKE = 4;
public static final int TYPE_CHARGING = 6;
public static final int TYPE_LIGHT_SLEEP = 9;
public static final int TYPE_IGNORE = 10;
public static final int TYPE_DEEP_SLEEP = 11;
public static final int TYPE_WAKE_UP = 12;
vcuculo commented 4 years ago

I implemented a integration with miband4 and ifttt https://www.youtube.com/watch?v=qLhn1YDUCf4 https://ricardojlrufino.wordpress.com/2020/02/26/controle-dispositivos-com-sua-mi-band-4/ sorry, portuguese language...

Nice @ricardojlrufino , but the music player functionality still works or is disabled?

ricardojlrufino commented 4 years ago

@vcuculo , works ... if you open a music player, it will work normally again ... when you close the player, the system will take control again, some times fail, I'm still testing