0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

(メモ)ラズパイ スマートタグ確認ツール

Posted at

BLEAKを利用してスマートタグを鳴らすのがデフォルトらしい。
Perplexity AIを利用して調べて実装した。

import asyncio
from bleak import BleakScanner

async def main():
    scanner = BleakScanner()
    await scanner.start()
    await asyncio.sleep(5.0)  # 5秒間スキャン
    await scanner.stop()
    
    # discovered_devices_and_advertisement_dataプロパティを使用
    devices = scanner.discovered_devices_and_advertisement_data
    
    for address, (device, adv_data) in devices.items():
        print(f"デバイス: {device.address} ({device.name})")
        print(f"信号強度: {adv_data.rssi}")
        # 他のAdvertisementData属性にアクセス
        if adv_data.manufacturer_data:
            print(f"メーカーデータ: {adv_data.manufacturer_data}")
asyncio.run(main())

Tileで音を鳴らしてみようと試みたが
どうも認証する必要があるらしい
単純にならすことができないので断念した。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?