TMU USB thermometer (www.papouch.com) to MQTT bridge
- logrotate daemon is installed
- systemd daemon is installed
- python >= 3.7 is installed
- python module manager
pip
is installed
Run sudo bash ./install.sh
Script will
- check prerequisites
- install tmu2mqtt to /opt/tmu2mqtt folder
- install default configuration
- install tmu2mqtt service and logrotate configuration
- start tmu2mqtt service
Configuration is by default read from file /etc/tmu2mqtt.cfg
File has ini-style structure.
Required section is mqtt
containing configuration needed for MQTT client.
At least one section tmuN
shall be present, where N is number from 1 to 99.
Collected data will be published to mqtt broker topic {mqtt.client_id}/{tmuNN.id}
- client_id - required mqtt client id - has to be unique within mqtt broker.
- host - optional mqtt host name or ip address. Default is
localhost
- port - optional mqtt broker TCP port. Default is
1883
- username - optional username. Default is none.
- password - optional password. Default is none.
- port - required serial port device name, e.g. /dev/ttyUSB0
- id - optional TMU device identifier. Default is section name.
- qos - optional mqtt QOS level for data from this port. Default is
1
.
[mqtt]
client_id=tmu2mqtt
[tmu1]
id=nas_temp
port=/dev/ttyUSB0
[tmu2]
id=server_temp
port=/dev/ttyUSB1
- modify tmu2mqtt bridge configuration
sudo nano /etc/tmu2mqtt.cfg
Do not forget to restart service daemon - see below
- modify tmu2mqtt logrotate configuration
sudo nano /etc/logrotate.d/tmu2mqtt
- modify service startup
sudo nano /etc/systemd/system/tmu2mqtt.service
- check tmu2mqtt service status
sudo systemctl status tmu2mqtt
- restart tmu2mqtt service
sudo systemctl restart tmu2mqtt