Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 1.18 KB

README.md

File metadata and controls

48 lines (33 loc) · 1.18 KB

LYWSD03MMC

This script was made using typical Linux applications to get Temperature and Humidify data from Xiaomi Mijia Bluetooth Temperature humidity version 2 a.k.a. LYWSD03MMC

This script is a modification from the original version with support to use mosquitto_pub to send data over MQTT to a broker. Thanks to the author.

Reference: http://www.d0wn.com/using-bash-and-gatttool-to-get-readings-from-xiaomi-mijia-lywsd03mmc-temperature-humidity-sensor/

This version works fine in a Raspberry Pi 3+.

Use crontab to scheduler an execution every minute.

Dependences (often resolved with apt install):

  • gatttool (to work with BLE)
  • awk
  • bc
  • mosquitto_pub

Configuration

Use the command below to find the device mac address

sudo hcitool lescan

Installation

Grant execution permissions

chmod +x readSensor.sh

running..

./readSensor.sh

Xiaomi Mijia Bluetooth Temperature humidity version 2

Troubleshoot

Sometimes the devices get blocked. Try to reset the Bluetooth interface with the following commands:

sudo hciconfig hci0 down

sudo hciconfig hci0 up