miband4 icon indicating copy to clipboard operation
miband4 copied to clipboard

"Set the band's music and receive music controls" is not working on miband5.

Open janvda opened this issue 3 years ago • 5 comments

I successfully connected to my miband5 but when I Set the band's music and receive music controls as below it doesn't work:

Set music track artist to : artist1
Set music track album to: album1
Set music track title to: title1
Set music volume: 80
Set music position: 100
Set music duration: 1000

My miband5 is showing just a sec... when opening the music menu and all the music controls are disabled.

FYI the info of my miband5:

MiBand
Soft revision: V1.0.2.58
Hardware revision: V0.44.23.2
Serial: 2c1049507e9d
Battery: 51
Time: 2021-12-06T00:04:38
Press a key to continue

I tried the same on my miband4 and it is working as expected (see output here below)

Set music track artist to : artist1
Set music track album to: album1
Set music track title to: title1
Set music volume: 80
Set music position: 100
Set music duration: 1000
Music focus in
Played
Forward
Backward
volume down
volume up
Music focus out

janvda avatar Dec 05 '21 23:12 janvda

FYI:

wireshark log of miband 4 that is properly setting the music:

So when it receives a music focus notification (handle 0x004a - value fee0) then 3 write commands are send to handle 0x004d:

1st write command: image

2nd write command: image

3rd write command: image

image

image

janvda avatar Dec 13 '21 20:12 janvda

I did the same on miband5 but this is not working: when it receives the focus event it is not responding with writing 3 events.

Music focus event: image

In first 3 commands it is writing the music data (similar as for miband 4 but using handle 0x0050 instead of 0x004a).

1st command: image

2nd command: image

3rd command: image

complete wireshark overview: image

janvda avatar Dec 13 '21 20:12 janvda

It is working on my miband 5 when I send the 3 write events just after I have opened the music menu.

janvda avatar Dec 13 '21 20:12 janvda

Root cause:

The handle for receiving the music notification is different on miband5 ( = 0x004d) compared to miband4 (= 0x004a).

So the following part of the code is never executed for miband 5 (74 = 0x4a)

https://github.com/janvda/miband4/blob/e6875a5ed55fe051949009196fbe6cb105179811/miband.py#L108

janvda avatar Dec 13 '21 21:12 janvda

You can fix this easily by making following change:

  • 30efb58

janvda avatar Dec 14 '21 15:12 janvda