Skip to content

Linux service to collect and transfer Xiaomi Mi Flora plant sensor data via MQTT, with mass-cluster support 🌱🌼πŸ₯€πŸ‘🌳

License

Notifications You must be signed in to change notification settings

RaymondMouthaan/miflora-mqtt-daemon

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

95 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Docker images for miflora-mqtt-daemon

Build Status DockerHub Pull DockerHub Stars

A simple Linux python script to query arbitrary Mi Flora plant sensor devices and send the data to an MQTT broker.

For more info: miflora-mqtt-daemon

All credits go to Thom Dietrich for creating miflora-mqtt-daemon.

Image Variants

Miflora2mqtt Docker images come in different variations and are supported by manifest lists (auto-detect architecture). This makes it more easy to deploy in a multi architecture Docker environment. E.g. a Docker Swarm with mix of Raspberry Pi's and amd64 nodes. But also in a non-multi architecture Docker environment, there is no need to explicit add the tag for the architecture to use.

All images are based on Alpine Linux.

Supported architectures are: amd64, arm32v6, arm32v7 and arm64v8.

Usage

Docker run

docker run -it -e TZ=Europe/Amsterdam --network=host -v <host_path_to_config>:/config --name miflora raymondmm/miflora2mqtt:latest

Docker stack / compose

################################################################################
# Miflora Stack
################################################################################
#$ docker stack deploy miflora --compose-file docker-compose-miflora.yml

# hcitool lescan
# sudo ip link set dev eth0 down && sudo ip link set dev eth0 up
################################################################################
version: "3.7"

services:
  miflora:
    image: raymondmm/miflora2mqtt:latest
    environment:
      - TZ=Europe/Amsterdam
    networks:
      hostnet: {}
    volumes:
      - <host_path_to_config>:/config
    deploy:
      placement:
        constraints: [node.hostname == rpi-2]
      replicas: 1

networks:
  hostnet:
    external: true
    name: host

Bluetooth

Below a few steps to run on a Raspberry PI 3B with Ubuntu server installed.

sudo apt install bluez
sudo ln -s /lib/firmware /etc/firmware

Remove console=ttyAMA0,115200 from /boot/firmware/cmdline.txt

sudo nano /boot/firmware/cmdline.txt
sudo hciattach /dev/ttyAMA0 bcm43xx 921600 -

Verify

dmesg | grep -i 'bluetooth'
sudo hcitool dev
sudo bluetoothctl -v
sudo hcitool lescan

Cronjob

sudo nano /etc/cron.hourly/hci0-restart
#!/bin/bash
hciconfig hci0 down
hciconfig hci0 up
hcitool lescan
sudo chmod 755 /etc/cron.hourly/hci0-restart
sudo cat /var/log/syslog | grep CRON

About

Linux service to collect and transfer Xiaomi Mi Flora plant sensor data via MQTT, with mass-cluster support 🌱🌼πŸ₯€πŸ‘🌳

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 73.9%
  • Dockerfile 26.1%