Collect data from SwitchBot MeterTH S1 with Windows Powershell (Python, Bleak, BT 4.0 BLE)
SwitchBot Thermometer and Hygrometer (FCC ID : 2AKXB-METERTH1)
# Pyhton 3
wget "https://www.python.org/ftp/python/3.10.7/python-3.10.7-amd64.exe" -OutFile ".\python-3.10.7-amd64.exe"
.\python-3.10.7-amd64.exe
# Bleak
pip install bleak
# SwitchBot_Thermometer
cd "$env:LOCALAPPDATA\Programs\Python\Python310\Lib\site-packages\bleak\"
wget "https://raw.githubusercontent.com/cesar93600/SwitchBot_Thermometer/main/SwitchBot.py" -OutFile ".\SwitchBot.py"
# Activate your Bluetooth before execution Script
py -3 ".\SwitchBot.py"
$SwitchBot = $(py -3 ".\SwitchBot.py")
# JSON Output : {'Meter': 'SwitchBot MeterTH S1', 'Mac': 'EA:73:76:7F:55:2C', 'Temperature': 20.1, 'Humidity': 55, 'Battery': 100}
# Convert to Object
$SwitchBot = ConvertFrom-Json($SwitchBot)
# Get Object Properties
$SwitchBot.Meter
# Output : SwitchBot MeterTH S1
- Linux / Raspberry Pi - Version (Code used for adaptation)
- BleakScanner (Bleak documentation)