(このREADMEはGPT-4oを用いて作成されました。内容はShuyaGOEMONが確認済みです。)
本プロジェクトは、ARグラスを用いたハンズフリー環境操作を実現するためのクライアント・サーバシステムです。
音声認識エンジンWhisperと、SwitchBot APIを組み合わせ、QRコードで識別されたデバイスに対して音声で指示を出すことができます。
+----------------+ TCP通信 +------------------+ HTTPS +-----------------+
| クライアント(AR側) | <================> | サーバ(PC/RasPi) | <===========> | SwitchBotクラウド |
| - QR読み取り | | - 音声受信・Whisper変換 | | - デバイス制御API |
| - 音声録音・送信 | | - QR対応デバイス状態管理 | | |
+----------------+ +------------------+ +-----------------+
- Python 3.11
- Whisper (OpenAI) for speech-to-text
- OpenCV + Pyzbar for QRコード認識
- PyAudio for 音声録音
- SwitchBot API v1.1
- Tkinter for UI表示
.
├── client.py # クライアント(カメラ・録音・UI送信)
├── record.py # 音声録音(PyAudio + 音声検知)
├── server.py # サーバ(音声受信・Whisper認識・SwitchBot制御)
├── .env # SwitchBot APIトークン(公開しないでください)
├── received_audio/ # 音声保存用ディレクトリ
以下の内容を .env に記述し、python-dotenv などで読み込んでください。
SWITCHBOT_TOKEN=your_token_here
SWITCHBOT_SECRET=your_secret_here.env は .gitignore に必ず追加してください。
python server.pypython client.py(必要に応じて input_device_index を record.py 内で調整)
- 「スイッチオン」 →
turnOn実行 - 「スイッチオフ」 →
turnOff実行 - 「スイッチ切り替え」 →
press実行(ワンプッシュ型)
- Whisperモデル(
large)はGPU推奨(cuda)。CPU利用時はserver.pyのWHISPER_DEVICE = 'cpu'に変更。 - カメラデバイスやマイクデバイスのIDは環境依存です。
VideoCapture(0)やinput_device_indexを調整してください。 - SwitchBotの物理スイッチに機能が対応しているかをご確認ください。
MIT License
- WebベースのUI追加
- 英語音声認識対応
- BLE経由のローカルSwitchBot制御
(This README was created using GPT-4o. The content has been verified by ShuyaGOEMON.)
This project implements a hands-free control system using AR glasses, speech recognition, and the SwitchBot API.
By combining OpenAI's Whisper for speech-to-text and QR-based device identification, users can remotely control SwitchBot devices via voice commands.
+----------------+ TCP Communication +------------------+ HTTPS +-----------------+
| Client (AR side) | <=============================> | Server (PC/RasPi) | <===========> | SwitchBot Cloud |
| - QR recognition | | - Audio reception & STT | | - Device Control API |
| - Audio recording | | - QR device management | | |
+----------------+ +------------------+ +-----------------+
- Python 3.11
- Whisper (OpenAI) for speech-to-text
- OpenCV + Pyzbar for QR code recognition
- PyAudio for audio recording
- SwitchBot API v1.1
- Tkinter for UI display
.
├── client.py # Client: camera, recording, UI, and transmission
├── record.py # Audio recorder (PyAudio + detection)
├── server.py # Server: audio reception, Whisper, SwitchBot control
├── .env # SwitchBot API tokens (not for public)
├── received_audio/ # Directory to store recorded audio
Prepare a .env file containing your SwitchBot credentials:
SWITCHBOT_TOKEN=your_token_here
SWITCHBOT_SECRET=your_secret_hereNote: Make sure to add .env to .gitignore to prevent accidental exposure.
python server.pypython client.py(Adjust input_device_index in record.py depending on your microphone setup.)
- "スイッチオン" → Executes
turnOn - "スイッチオフ" → Executes
turnOff - "スイッチ切り替え" → Executes
press(toggle)
- Whisper
largemodel is GPU-friendly. For CPU, setWHISPER_DEVICE = 'cpu'inserver.py. - Camera and microphone device IDs may vary by system. Update
VideoCapture(0)andinput_device_indexaccordingly. - Make sure your SwitchBot devices support the required control mode.
MIT License
- Add Web-based UI
- Add English voice command support
- Enable local BLE control of SwitchBot devices