Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set response=True for write_gatt_char to fix silent failure #29

Merged
merged 2 commits into from
Nov 23, 2023
Merged

Conversation

tensorturtle
Copy link
Contributor

I was testing FTMS on my Elite Suito T smart trainer and the resistance wasn't changing using the example script.

I found that setting response=True for bleak's write_gatt_char fixed it.

Huawei docs says "When the phone request the control of a fitness machine, the fitness machine needs to respond with 0x80...". I'm guessing 'needs' here means that the request itself needs to be a "Write with response" type.

I'm not sure why it worked before when response=False.

@zacharyedwardbull
Copy link
Owner

Hi @tensorturtle, thanks for sending this. Just to check, does the setting resistance part not work for any turbo trainers at the moment? Or just the Elite Suito T? And did it work before?

Cheers

@tensorturtle
Copy link
Contributor Author

I only have the Elite Suito T available to test so I'm sorry I can't offer any info about other trainers. It worked before according to my memory plus I wouldn't have made the initial PR if it wasn't successful.

@zacharyedwardbull
Copy link
Owner

Has anything changed on your side since you implemented it? Are you using a different operating system? I'm happy to merge this but just want to understand why it wasn't an issue before.

@tensorturtle
Copy link
Contributor Author

There is a possibility that I set it to False before submitting the PR as a way to reduce the visual clutter, since the example prints the responses after every single message which can be a bit overwhelming. I didn't think at the time that this option would affect functionality at all.

@zacharyedwardbull
Copy link
Owner

It looks like the behaviour of bleak write_gatt_char may have changed somewhat, although not sure if it is related here e.g: hbldh/bleak#909.

Would you be able to try using the older version of bleak that would have been around when you first wrote the code? See if the current code (before your PR) works then.

Once we know why it worked before and not now I will merge in the update.

@tensorturtle
Copy link
Contributor Author

tensorturtle commented Nov 23, 2023

@zacharyedwardbull Your prediction was absolutely correct. Thank you for looking it up.

The breaking change in bleak was introduced in bleak==0.21

Bleak Version response=False response=True Empty
0.21.1 (latest) Fails Works Works
0.20.2 (before breaking change) Works Works Works

@zacharyedwardbull zacharyedwardbull merged commit e049b8c into zacharyedwardbull:master Nov 23, 2023
5 checks passed
@zacharyedwardbull
Copy link
Owner

Thanks for checking, nice work! Merged it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants