Skip to main content

Xiaomi Mijia Temperature and Humidity Sensor

硬體規格

  • 名稱:小米藍芽溫溼度計
  • 型號:LYWSD03MMC

Raspberry Pi OS

安裝 Python module

# 以下指令必須用 user 帳號下執行 (non-root)
mkdir mitemp2
cd mitemp2
python -m venv env
source env/bin/activate
which python
# 記得先升級 pip 至最新版
pip install --upgrade pip
# 開始安裝套件
sudo apt install libbluetooth-dev libglib2.0-dev
pip install bluepy
pip install lywsd03mmc
pip install paho-mqtt

錯誤:ERROR: Could not build wheels for bluepy, which is required to install pyproject.toml-based projects

解決:

sudo apt install libbluetooth-dev libglib2.0-dev

Telegraf

Option 1: Python script

建立設定檔

mv /etc/telegraf/telegraf.conf /etc/telegraf/telegraf.conf.orig
telegraf --input-filter exec --output-filter influxdb_v2 config > /etc/telegraf/telegraf.conf

 

 

Option 2: MQTT Consumer