A simple OpenMetrics Exporter responsible for handling ATC1441 sensor data via BLE advertisements.
Heavily inspired by MiTemperature2, xiaomi-sensor-exporter, and atc-prometheus-exporter; this script combines the passive/low-power scanning from former with the OpenMetrics scrapability of the latter two.
Special thank you as well to
aioblescan, a pruned subset of
which has been vendored in (see atc1441_exporter/_aioblescan.py) to
handle passive BLE scanning and advertising-report parsing over a raw
HCI socket.
First off, you'll need to flash your devices with ATC1441-compatible firmware. The canonical source, in my opinion would be from pvvx/ATC_MiThermometer. Once you've followed the instructions and flashed your device, swap the advertising format over to ATC.
Then, create a config.ini with the sensors you want to scrape. While
you're flashing them, you can grab their MAC addresses from the same
page (just remove the last two bytes and add the relevant colons). Mine
looks like:
[a4:c1:38:d8:f8:9d]
name=Living Room
[a4:c1:38:bf:95:e9]
name=Studio
Once this file exists, you can run the app. The easiest thing to do is to run it via docker, but if you want to run it locally, you can check the Dockerfile for the relevant dependencies.
docker run --rm -it --net=host --privileged -v/path/to/config.ini:/app/config.ini quay.io/thekevjames/atc1441-exporter:latest /app/config.ini
Or, for example, as a docker compose service:
atc1441-exporter:
container_name: atc1441-exporter
image: quay.io/thekevjames/atc1441-exporter:latest
command: /app/config.ini
restart: unless-stopped
network_mode: host
privileged: true
volumes:
- ./atc1441.ini:/app/config.ini:Z
There are a few optional flags you can pass in the command:
--interface | -i Hardware interface, eg. hciX [default: 0]
--port | -p OpenMetrics listen port [default: 8000]
Content type
Image
Digest
sha256:3dcdbea49…
Size
44.5 MB
Last updated
about 6 hours ago
docker pull thekevjames/atc1441-exporter