This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build and publish for release
dotnet publish --configuration Release
# Build for development
dotnet build
# Run the application directly
dotnet runThe application scans for SwitchBot temperature/humidity meters and displays their readings:
# Single reading (default)
SwitchBotMeter
# With custom timeout (seconds)
SwitchBotMeter --timeout 10
# Continuous reading with limit
SwitchBotMeter --timeout 60 --limit 0
# Infinite continuous reading
SwitchBotMeter --timeout 0 --limit 0
# List all Bluetooth LE devices
SwitchBotMeter --list
# Show help
SwitchBotMeter --helpThis is a .NET 6.0 Windows console application that uses Windows Bluetooth LE APIs to scan for SwitchBot devices.
- Program.cs: Main application entry point containing command-line parsing, device scanning logic, and output formatting
- SwitchBotUtil.cs: Utility classes defining SwitchBot device constants and UUIDs
The application supports multiple SwitchBot device types:
- Original Meter (uses service UUID scanning)
- MeterPlus, MeterPro, OutdoorMeter (uses manufacturer data and service data)
- Parses command-line arguments for timeout, limit, and operation mode
- Creates BluetoothLEAdvertisementWatcher to scan for BLE advertisements
- Filters advertisements by SwitchBot service UUIDs or manufacturer data
- Decodes temperature, humidity, and battery data from advertisement payloads
- Outputs formatted readings:
ADDRESS TEMP HUMIDITY BATTERY DEVICE_TYPE
- Uses Windows Runtime APIs (Windows.Devices.Bluetooth)
- Requires .NET 6.0 with Windows 10 Build 19041+ target
- Single-file publish configuration for standalone deployment
- Active scanning mode for better device detection
- Two-stage detection for newer devices (service data then manufacturer data)