pierre-24 / pytimefliplib

Python library to deal with TimeFlip v3 and v4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running timeflip-discover on macOS does not seem to return BT MAC addresses?

victorhooi opened this issue · comments

I have installed pytimeflip on my macOS machine, and I'm trying to connect to my Timeflip device.

FYI - I had some issues running pytimeflip under the fish shell - it would seem to silently fail (with some signal abort). I will have to try to debug that later.

For now, I'm running it under the bash shell, and here's a sample output (note that it took timeflip-discover around 5 minutes to return - not sure if that's expected or not?)

❯ timeflip-discover
Looking around (this can take up to 1 minute) ... Done!
Results::
- TimeFlip devices: 4E95D46E-0376-7803-E6D6-40D2213BA156 (TimeFlip v2.0)
- Other BLE devices: B3BC7A66-62C0-C780-545A-BA2D8C4D3859 (Foo), E93557E7-BABE-6AEA-72CD-2951E52540C2 (Bar), C0295501-E49C-B62D-877E-2780F7D4FB3A (Wiz), 398976C1-221D-BC56-79D6-FB084B44C126 (LE-Acrux) etc.
- Other devices: EAA0A538-41BE-910F-0B32-6C1D2919A90A, 05AE2D1A-96CA-534E-6D03-83612D81A301, 9CB83DB9-A32A-DED0-A8EC-26C807B8FF0F, 41CDA805-FD2B-1941-B8A2-79F12EAAAB44, 1ECC194A-FEA8-FA83-85D2-FADC2FF0B93B, 8C8DF516-A414-9B6F-3BB5-4980283B67B8, 958CAE73-FEFE-F6D6-8128-39E6F01EA820, A7DE5719-88D7-2884-220D-69CFD4D3BFC2, 311CA114-15C0-CFFA-63FB-C534C7BA4E3B, C14A6C2A-EE69-692C-EF8A-21F14755D035, 94E01FB2-879D-2042-41A2-28728233EB86, 0C5C1CAD-8830-7A8F-2BCB-8F01B7F721E9, 25123793-AF99-2308-DCC9-D67DBF169854, 3F70B2E4-8D9D-4692-D365-61AC65D07042, F9B702BA-FB0D-0C79-6809-A8BA69048CCB, 9EB72888-F9A1-48A1-AC8D-F418E98DF30B, 5CBB5E40-26C7-CAEF-297F-581A4C629A2A, 679215FB-D66D-D6AB-1B7E-854349EA7E43, A654079E-11CB-0D33-CB2A-08C6BBF406D0

~/code/timeflip_testing is 📦 v0.1.0 via 🐍 v3.11.3 (timeflip-testing-py3.11) on ☁️  victorhooi@example.com took 4m6s 

The above identifiers don't seem to be MAC addresses, and of course, they don't work when pass into timeflip-check:

❯ timeflip-check -a 4E95D46E-0376-7803-E6D6-40D2213BA156
usage: timeflip-check [-h] [-v] -a ADDRESS [-p PASSWORD]
timeflip-check: error: argument -a/--address: 4E95D46E-0376-7803-E6D6-40D2213BA156 is not a valid address

Searching online, it seems like this might be some macOS issues with Bleak:

hbldh/bleak#284
hbldh/bleak#140

It seems on macOS at least, macOS doesn't provide MAC addresses by default, but uses a generated UUID.

However, in Bleak 2.0, they merged in a change that uses a hack that can give you back the MAC address:

hbldh/bleak#1257

Specifically, the use_baddr flag, which you can use with the macOS specific scanner.

What do you think of this?

Would you be open to changing it so that it could work better on macOS? (Or maybe you have some obvious workaround I missed, that means you can use it on macOS today?)

For reference, here is the discussion where I asked the Bleak team about macOS and using MAC addresses:

hbldh/bleak#1324

Ok, that got eventually fixed. I "just" removed the check to know if it is a valid MAC address :)