The service allow controlling gateway LEDs. sound and illuminance sensor over MQTT
opkg update
opkg install python3-pip python3-asyncio python3-evdev
pip install lumimqtt
pip install lumimqtt --upgrade
Default config should be located in /etc/lumimqtt.json
or
can be overridden with LUMIMQTT_CONFIG
environment variable.
The configuration file is a JSON with the following content:
{
"mqtt_host": "localhost",
"mqtt_port": 1883,
"mqtt_user": "",
"mqtt_password": "",
"topic_root": "lumi/{MAC}",
"sensor_threshold": 50,
"sensor_debounce_period": 60
}
Every line is optional. By default LumiMQTT will use the connection to localhost with the anonymous login.
sensor_threshold
is a threshold to avoid sending data to MQTT on small
changes
sensor_debounce_period
value in seconds to send data despite of the threshold
The topic name topic_root
can be redefined, for example living_room/gateway
.
If not set, default topic name lumi/mac_id
$ lumimqtt
$ lumimqtt &
To autorun lumimqtt you need a file /etc/init.d/lumimqtt with the following content:
#!/bin/sh /etc/rc.common
START=98
USE_PROCD=1
start_service()
{
procd_open_instance
procd_set_param env LUMIMQTT_CONFIG=/etc/lumimqtt.json
procd_set_param command python -m lumimqtt
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}