ruimarinho/miflora-mqtt
Run the miflora-mqtt-daemon in Docker.
500K+
Run the miflora-mqtt-daemon in Docker.
The miflora-mqtt-daemon is a bluetooth low energy to mqtt gateway enabling you to receive sensor information from Xiaomi Mi Plant sensors if they are away from your home automation server.
With this container, it becomes amazingly simply to setup a Raspberry or similar device running a container-optimized operating system such as HypriotOS and transform it into a low cost sensor gateway.
All settings of the miflora-mqtt-daemon can be dynamically configured via environment variables (thanks to confd) without having to create a new image or bind-mounting the configuration file.
The environment variable are organized into four groups, as per the original configuration file:
MIFLORA_GENERAL_<PROPERTY>
: populates the [General]
section.MIFLORA_DAEMON_<PROPERTY>
: populates the [Daemon]
section.MIFLORA_MQTT_<PROPERTY>
: populates the [MQTT]
section.MIFLORA_SENSORS_<INDEX>_<PROPERTY>
: populates each sensor inside the [Sensors]
section.Using the scheme above, the configuration can be as simple as setting the following environment variables:
docker run \
-e 'MIFLORA_MQTT_HOSTNAME=127.0.0.1' \
-e 'MIFLORA_SENSORS_0_Schefflera@Foo=C4:7C:8D:11:22:33' \
-d ruimarinho/miflora-mqtt
If you need to further customize the daemon's settings, check the next chapter for a detailed reference guide.
Environment Variable Name | Description |
---|---|
MIFLORA_GENERAL_REPORTING_METHOD | The operation mode of the program. Determines wether retrieved sensor data is published via MQTT or stdout/file. |
MIFLORA_GENERAL_ADAPTER | The bluetooth adapter that should be used to connect to Mi Flora devices (Default: hci0) |
MIFLORA_DAEMON_ENABLE | Enable or Disable an endless execution loop (Default: true) |
MIFLORA_DAEMON_PERIOD | The period between two measurements in seconds (Default: 300) |
MIFLORA_MQTT_HOSTNAME | The hostname or IP address of the MQTT broker to connect to (Default: localhost) |
MIFLORA_MQTT_PORT | The TCP port the MQTT broker is listening on (Default: 1883) |
MIFLORA_MQTT_KEEPALIVE | Maximum period in seconds between ping messages to the broker. (Default: 60) |
MIFLORA_MQTT_TOPIC | The MQTT base topic to publish all Mi Flora sensor data topics under. Default depends on the configured reporting_mode (mqtt-json, mqtt-smarthome: miflora, mqtt-homie: homie) |
MIFLORA_MQTT_HOMIE_DEVICE_ID | Homie specific: The device ID for this daemon instance (Default: miflora-mqtt-daemon) |
MIFLORA_MQTT_USERNAME | The MQTT broker authentification username (Default: no authentication) |
MIFLORA_MQTT_PASSWORD | The MQTT broker authentification password (Default: no authentication) |
MIFLORA_MQTT_TLS_ENABLED | Enable TLS/SSL on the connection |
MIFLORA_MQTT_TLS_CA_CERT | Path to CA Certificate file to verify host |
MIFLORA_MQTT_TLS_CLIENT_KEY | Path to TLS client auth key file |
MIFLORA_MQTT_TLS_CLIENT_CERT | Path to TLS client auth certificate file |
MIFLORA_SENSORS_<N>_<NAME>[@LOCATION] | Sensor configuration consisting of name, optional location and ethernet MAC address |
If you would like to take a look at the generated config file for debugging purposes, you can do so by running the following command:
docker run \
--rm \
--entrypoint sh \
-ti ruimarinho/miflora-mqtt \
-c confd -onetime -backend env -log-level debug && cat /miflora-mqtt-daemon/config.ini'
MIT
docker pull ruimarinho/miflora-mqtt