lolouk44 / hassio-addons

Xiaomi Mi Scale Add On for Home Assistant
MIT License
125 stars 42 forks source link

Bluetooth connection error: Failed to execute management command 'scanend' (code: 11, error: Rejected) #34

Closed magiva closed 3 years ago

magiva commented 3 years ago

Select Add-On (place a lowercase x for the relevant add-on)

Describe the bug the log shows this most times Bluetooth connection error: Failed to execute management command 'scanend' (code: 11, error: Rejected) the odd occasion it downloads data (1 out of 5)

To Reproduce let the add on do its thing

Expected behaviour sync data

Screenshots image

Scale (please complete the following information): Mi Body Composition Scale 2 | XMTZC05HM

Device running Home Assistant (please complete the following information): Raspberry pi 3 with built in Bluetooth

Additional context Add any other context about the problem here.

lolouk44 commented 3 years ago

Can you confirm which setting you have for BLUEPY_PASSIVE_SCAN? Have you tried to change it to true? Also can you confirm that the bluetooth radio is turned on?

magiva commented 3 years ago

i set the passive to false. i did try it with true but the log never updates past 'discovery completed' i see in the code that hci is cycled down to up, i tried that in ssh outside of the docker to see if that helped but it didnt [image: image.png]

On Fri, 5 Mar 2021 at 11:49, lolouk44 notifications@github.com wrote:

Can you confirm which setting you have for BLUEPY_PASSIVE_SCAN? Have you tried to change it to true? Also can you confirm that the bluetooth radio is turned on?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lolouk44/hassio-addons/issues/34#issuecomment-791340701, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZMQZMH7KJWUYGWKATW2CLTCCZLJANCNFSM4YU6CQAA .

magiva commented 3 years ago

i can see in lsusb that bluetooth is turned on and it did get 1 piece of data but then never again. bluetooth is also used for user proximity so i know its on

lolouk44 commented 3 years ago

i did try it with true but the log never updates past 'discovery completed'

That sounds more promising, i.e. no error messages. Have you tried to step on the scale then? The scale will only communicate for about 10-15 min before going to sleep and then you won't get any results anymore...

magiva commented 3 years ago

interesting, i did try this after setting it to passive yesterday but got nothing then and just now i got

2021-03-06 15:12:19 - Starting Xiaomi mi Scale... 2021-03-06 15:12:19 - Loading Config From Add-On Options... 2021-03-06 15:12:19 - Config Loaded... 2021-03-06 15:12:21 - Discovery Completed... 2021-03-06 15:15:51 - Publishing data to topic miscale/Mark/weight: {"weight":81.00,"weight_unit":"kg","bmi":15.06,"basal_metabolism":1290.18,"visceral_fat":2.98,"lean_body_mass":62.73,"body_fat":11.95,"water":48.59,"bone_mass":3.16,"muscle_mass":78.77,"protein":16.00,"body_type":"Superhero","metabolic_age":24,"timestamp":"2021-03-06 15:15:51.825682"} 2021-03-06 15:15:51 - Data Published ...

So ill monitor it and see how it goes, maybe i get a usb bluetooth instead of using the internal one

On Sat, 6 Mar 2021 at 14:28, lolouk44 notifications@github.com wrote:

i did try it with true but the log never updates past 'discovery completed'

That sounds more promising, i.e. no error messages. Have you tried to step on the scale then? The scale will only communicate for about 10-15 min before going to sleep and then you won't get any results anymore...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lolouk44/hassio-addons/issues/34#issuecomment-791940409, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZMQZNT7TUVKOLCY7MTHGTTCIUZDANCNFSM4YU6CQAA .

lolouk44 commented 3 years ago

So it's working 😊 Closing the issue in that case