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

encounter an error when using "Get Bluetooth device with identifier" #216

Open
Huangbinghui opened this issue Jan 8, 2024 · 14 comments
Open
Labels
bug Something isn't working

Comments

@Huangbinghui
Copy link

Description

when i using action "Get Bluetooth device with identifier", it throw an error "operation is not supported".

macOS/iOS version

IOS 17.2.1,iPhone 12 mini

Shortcut URL

No response

@Huangbinghui Huangbinghui added the bug Something isn't working label Jan 8, 2024
@sindresorhus
Copy link
Owner

Can you try out the latest TestFlight build and let me know whether it fixes the issue? https://testflight.apple.com/join/fJGUrsZx

@Huangbinghui
Copy link
Author

Can you try out the latest TestFlight build and let me know whether it fixes the issue? https://testflight.apple.com/join/fJGUrsZx

sure,it seems fixed. but this action returns disconnect states when my airpods is connnected to my phone.

@sindresorhus
Copy link
Owner

Did you try both AirPods? Each (left and right) has their own identifier.

@ShxdowStar
Copy link

ShxdowStar commented Jan 11, 2024

Did you try both AirPods? Each (left and right) has their own identifier.

I currently have both connected and this is what it returns:

Identifier: CE95259D-3E18-C236-CD98-0110935B3DE3 
Connected: false
Signal: 100%
RSSI: 0 
Unique Services: 0
Services: 0

Edit:
The testflight version did fix the Operation Not Supported issue though.

Edit #2:
I was testing with only having one or the other Airpod connected and it seems to return the same UUID, whether it is the left, right or both. Perhaps this is something related?
Edit #3
Did some more testing, and I got details on a Bluetooth device near by, and the connected value returns true despite me not being connected to it. Maybe the conditions for the Boolean are reversed in the code? Going to take a look now.

Edit #4:
I'm not very familiar with Swift but maybe the issue lies in line 71 to line 73?

if
			!wasConnected,
			peripheral.state == .connected

If I'm understanding this correctly, !wasConnected means "not" wasConnected, and then the code returns the value as connected which is the opposite of what is expected.

@zecanard
Copy link

I’ve just tested this in 3.1.0.62 (suggestion: maybe show the version number inside the app?). Here are my findings:

  • Using Get All Bluetooth Devices:

    1. My Powerbeats Pro headphones show Connected: false, normal RSSI and Signal Strength readings.
    2. My Apple Watch shows Connected: true. Under the App Store version (58?), it showed false.
    3. My iPad Pro, iMac, and all my HomePods show Connected: false with normal RSSI and Signal Strength.
    4. One of my neighbors’ smart bulb shows Connected: false with normal RSSI and Signal Strength.
    5. No device lists anything under Services or Unique Services.
    6. I’m playing music over my Powerbeats as I’m testing this.
  • Using Get Bluetooth Device by UUID:

    1. My Powerbeats Pro still show Connected: false; however, the RSSI is 0 and Signal Strength 100%.
    2. My Apple Watch still shows Connected: true, still with normal RSSI and Signal Strength. However, I’m now seeing a bunch of identifiers under Services. I believe 3.1.0.58 showed Connected: false.
    3. My HomePods, iMac and iPad Pro now show Connected: true, still with normal RSSI and Signal Strength. I’m also seeing a bunch of identifiers under Services. 3.1.0.58 also showed Connected: false, as far as I remember.
    4. My neighbor’s smart bulb now shows Connected: true, still with normal RSSI and Signal Strength. I’ve never paired/connected to that light bulb. I’m also seeing a bunch of identifiers under both Services and Unique Services.

Lastly, Get Bluetooth Device by UUID seems a lot less reliable than Get All Bluetooth Devices. The latter (Get All) reliably gives me all (or most Bluetooth devices), even in a crowded gym with tons of Bluetooth headphones and smart TVs.

Get by UUID usually fails to get me the smart TV I’m asking for at the gym (I meant to use it to detect being inside the gym). In my apartment with relatively few Bluetooth devices within range, Get by UUID only retrieves Bluetooth devices with a strong signal/RSSI. This is even if I push the scan duration to 10 seconds. Try Get All, and those weak devices show up immediately. Is this normal/an iOS limitation?

@ShxdowStar
Copy link

ShxdowStar commented Jan 12, 2024

Get by UUID usually fails to get me the smart TV I’m asking for at the gym (I meant to use it to detect being inside the gym).

Random thought, but wouldn't a location based automation/shortcut fare better than checking to see if you can detect the smart TV inside the gym? (Unless you are intentionally trying to avoid location based automations)
Side note: I am currently at work and I am able to detect the smart tvs, some of which are up to 500ft away. Have you tried the testflight version?

Can you try out the latest TestFlight build and let me know whether it fixes the issue? https://testflight.apple.com/join/fJGUrsZx

@zecanard
Copy link

I am on the TestFlight version (62), and I have a specific need for detecting being inside the gym.

@ShxdowStar
Copy link

I figured as much, I'm not sure as to why you're unable to detect those TV's.... Perhaps it is a limitation of the hardware inside of the TV rather than the software of the app. The TVs at my job are fairly new (purchased within the last 6 months) and may be able to transmit the signal farther due to new hardware.

@zecanard
Copy link

I am able to detect the smart TVs just fine, otherwise I couldn’t even attempt to Get by UUID. Retrieving a specific device is the problem.

Those are two distinct Actions.

@ShxdowStar
Copy link

ShxdowStar commented Jan 12, 2024

I see, sorry I misunderstood what you wrote. Not sure why it isn't retrieving a specific device with Get by UUID. I don't seem to be having that issue, even with one of the farther away TV's that I've never connected to, I have a 7% signal and get all of the information... (I set the timeout to 60s but it took maybe 15-20s maybe try a higher timeout and see?)

Edit: RSSI is -96 too

@zecanard
Copy link

I’ve done some more testing. Devices with weaker RSSI usually connect within 2–3 seconds, and sometimes return no result even after 25 seconds.

At the same time, one device I tried immediately throws an error (rather than returning no result). I guess Get by UUID actively tries to connect to the device, which may choose to reject the connection.

The documentation does state that you need to have connected to the device at least once before. I had read that part when the feature was first released, but since it actually worked for the random devices I had tested (my neighbors’ smart bulbs and foot massagers), it slipped my mind.

As for my Powerbeats Pro, Get All Devices returns the same UUID regardless of which earbud I put on. I wait a few minutes until the earbud that’s in the case disappears from my Batteries widget before scanning.

@Jack-GH2000
Copy link

I have similar issues. My Tesla Model 3 audio doesn't show up at all, only the key but the key shows as disconnected even though it is connected.

@TesLocker
Copy link

I also see the same issue with “get Bluetooth device” (singular). I have both AirPods on and am listening to music in both ears, but the shortcut returns that “connected” is false, signal is 100%, and RSSI is 0.

@Samuelodan
Copy link

Samuelodan commented Jun 23, 2024

I have the same issue with connected: false. I'm trying to run some actions when an app is opened with one of those actions running only when my AirPods are connected.

A fix will be appreciated.

Edit: for now tho, I can successfully check to see if the identifier matches what I expect as a way to know that it's connected. I initially tried to match the name but that didn't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants