diff --git a/.media/demo_001.gif b/.media/demo_001.gif new file mode 100644 index 0000000..2d4704a Binary files /dev/null and b/.media/demo_001.gif differ diff --git a/README.md b/README.md index 5551ba0..065c8ef 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Python gateway for the [custom firmware](https://github.com/atc1441/ATC_MiThermo **Features:** - [WIP] Can run on Raspberry Pi (3, 4, zero w, pico) 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 -- [TODO] Make in runnable in a docker container (because only cool people are using docker) +- [WIP] Make in runnable in a docker container (because only cool people are using docker) - [TODO] Collect data from multiple devices/gateways - [TODO] Command line tool for managing the devices - [TODO] Analyzing tool for making statistics @@ -16,8 +16,28 @@ Python gateway for the [custom firmware](https://github.com/atc1441/ATC_MiThermo - [TODO] Maybe... a webinterface. But I suck at web stuff, so I don't know. - [TODO] Implement other BLE Sensors +**Current State** + +![](.media/demo_001.gif) + ## Getting started First of all, you need to flash the [custom firmware](https://github.com/atc1441/ATC_MiThermometer) 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. +```bash +sudo apt-get install -y bluez +``` +Install PIP Libraries +```bash +sudo pip3 install -r python/requirements.txt +``` +Run Gateway +```bash +cd python/src +sudo python3 main.py +``` diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..ba91409 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,2 @@ +FROM python:3.12-alpine3.20 + diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..08aaafb --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,6 @@ +version: '3.3' + +services: + atc_mithermometer_gateway: + image: atc-mithermometer-gateway:develop + container_name: ATC_MiThermometer_Gateway diff --git a/src/__init__.py b/microPython/.gitkeep similarity index 100% rename from src/__init__.py rename to microPython/.gitkeep diff --git a/python/install_gateway.sh b/python/install_gateway.sh new file mode 100644 index 0000000..c158cd7 --- /dev/null +++ b/python/install_gateway.sh @@ -0,0 +1,17 @@ +# Update the system +sudo apt-get update +sudo apt-get uprade -y +sudo apt-get autoremove -y + +# Install the dependencies +sudo apt-get install python3 python3-pip bluez +sudo pip3 install -r requirements.txt + +# Install the Gateway + +# Install the service + +# Start the Gateway +sudo systemctl enable atc_mithermometer_gateway.service +sudo systemctl start atc_mithermometer_gateway.service +sudo systemctl status atc_mithermometer_gateway.service diff --git a/python/requierements.txt b/python/requierements.txt new file mode 100644 index 0000000..1a6a99d --- /dev/null +++ b/python/requierements.txt @@ -0,0 +1 @@ +bluepy \ No newline at end of file diff --git a/python/src/__init__.py b/python/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/data_class.py b/python/src/data_class.py similarity index 100% rename from src/data_class.py rename to python/src/data_class.py diff --git a/src/discovery.py b/python/src/discovery.py similarity index 100% rename from src/discovery.py rename to python/src/discovery.py diff --git a/src/main.py b/python/src/main.py similarity index 100% rename from src/main.py rename to python/src/main.py