tilmanginzel / alfred-bluetooth-workflow

Yet another Alfred workflow to connect / disconnect Bluetooth devices
MIT License
189 stars 8 forks source link

Notification says the device is connected while it's not #12

Closed tilmanginzel closed 4 years ago

tilmanginzel commented 4 years ago

Copied from @tbrek at https://github.com/trietsch/alfred-bluetooth-connector/issues/5

Steps to reproduce:

  1. Try connecting to device which is out of range or currently connected other device
  2. Notification will say it's connected while it isn't
tilmanginzel commented 4 years ago

@trietsch @tbrek This bug was introcuded via https://github.com/tilmanginzel/alfred-bluetooth-workflow/commit/985ddd815042718f8a4818e21e31a7d65f507513 to fix https://github.com/tilmanginzel/alfred-bluetooth-workflow/issues/10. I can reproduce the issue it but interestingly it does not appear for all (unavailable) devices.

I don't entirely understand why it occurs though. If I use blueutil directly on the command line, the exit code is always correct and states whether the device was connected or not. When executed in my script though, the exit code is sometimes incorrect.

The only viable solution I can think of is to use the blueutil --is-connected command again, with a sleep 1 right before executing it. blueutil --is-connected also sometimes returns an incorrect result, even though the device was connected successfully. So while the sleep 1 feels like a bad solution, I don't have any other for now. Will provide a version to test soon.

tilmanginzel commented 4 years ago

@tbrek Can you please test if the following version fixes the issue? :) Bluetooth Connector.alfredworkflow.zip

tilmanginzel commented 4 years ago

@tbrek New version 0.7.0 was just published which should mitigate the issue.

tbrek commented 4 years ago

I did update via Alfred and I'm getting this now:

image

Also I'm not getting any notifications.

tbrek commented 4 years ago

I've sorted notifications. Had to right-click run terminal-notifier and blueutil. I'm still getting those weird null though.

tilmanginzel commented 4 years ago

Had to right-click run terminal-notifier and blueutil. I'm still getting those weird null though.

Is my assumption correct that you are on Catalina?

I'm still getting those weird null though.

Hm. We could probably just filter those values. Can you paste the content of the following command to check the output?

./blueutil --paired --format=JSON

I assume name is null, but maybe the other values also look odd?

tilmanginzel commented 4 years ago

@tbrek Feel free to check if the version I posted here fixes it.

I am gonna close this issue for now as the incorrect notification problem is fixed. Let's continue with the null issue in #15 :)