miband4
miband4 copied to clipboard
"Set the band's music and receive music controls" is not working on miband5.
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
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:
2nd write command:
3rd write command:
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:
In first 3 commands it is writing the music data (similar as for miband 4 but using handle 0x0050 instead of 0x004a).
1st command:
2nd command:
3rd command:
complete wireshark overview:
It is working on my miband 5 when I send the 3 write events just after I have opened the music menu.
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
You can fix this easily by making following change:
- 30efb58