2024-05-30 15:09:03 +02:00
2024-05-30 18:36:23 +02:00
2024-05-30 18:17:09 +02:00
2024-06-22 18:11:38 +02:00
2024-06-22 18:11:38 +02:00
2024-05-30 18:54:53 +02:00
2024-05-30 18:36:23 +02:00

ATC_MiThermometer_Gateway

Python gateway for the custom firmware for the Xiaomi Thermometer LYWSD03MMC.

Features:

  • [DONE] Make in runnable in a docker container (because only cool people are using docker)

TODOs:

  • [WIP] Can run on Raspberry Pi (3, 4, zero w) or any other Linux driven hardware which has BLE and WiFi support
  • [WIP] Storing temperature, humidity and battery state as json in a text file
  • [WIP] Implement a loop for fetching the data every x minute
  • [WIP] Make discoveries async
  • [TODO] Make docker image smaller. I mean shiiit 1GB D: should be possible to be under 500MB
  • [TODO] Make a microPython version for using the raspberry pico w or any other microcontroller with BLE and WiFi support
  • [TODO] Collect data from multiple devices/gateways
  • [TODO] Command line tool for managing the devices
  • [TODO] Analyzing tool for making statistics
  • [TODO] HomeAssistant integration
  • [TODO] MQTT publishing
  • [TODO] Maybe... a webinterface. But I suck at web stuff, so I don't know.
  • [TODO] Implement other BLE Sensors

Current State

Getting started

First of all, you need to flash the custom firmware on your LYWSD03MMC device. A step-by-step guid is in his youtube channel, the video is linked on his GitHub repo. It's straight forward and does not require any special hardware.

Run Gateway

The libraries are needed to be installed as root, because the gateway itself needs to be executed as root, else it is not able to use the bluetooth adapter. In the future, I try to do it better. Also in the future it will be much easier to start and install.

Install bluez. It's needed for bluepy to communicate with the bluetooth adapter.

sudo apt-get install -y bluez

Install PIP Libraries

sudo pip3 install -r python/requirements.txt

Run Gateway

cd python/src
sudo python3 main.py

Docker

Build docker container

docker-compose build 

Run docker container. Killing the hosts bluetooth service is needed to access it from the docker container.

sudo sh run_docker.sh

MicroPython for MicroController

Coming when I develop it...

Description
Languages
Python 52.3%
Shell 26.3%
HTML 16.1%
Dockerfile 5.3%