Listens to MQTT messages like this:
SHHNoT/environment/room-d/sensor_ESP8266-SCD40-1/humidity 60.735
# i.e.,
SHHNoT/environment/<location>/<sensor_id>/<measurement> <value>
…and sends them to InfluxDB via the HTTP API
listen to MQTT messages with a command like
# listen to all messages
mosquitto_sub -h mosquitto.shhm.uk -t '#' -v
# listen to only environment messages
mosquitto_sub -h mosquitto.shhm.uk -t 'SHHNoT/environment/#' -v
# ignore messages before subscription ("retained" messages)
mosquitto_sub -R -h mosquitto.shhm.uk -t 'SHHNoT/environment/#' -v# ssh key for git interaction
mkdir -p /usr/shhm/.ssh/
ssh-keygen -f /usr/shhm/.ssh/mqtt-deploy-key
export GIT_SSH_COMMAND="ssh -i /usr/shhm/.ssh/mqtt-deploy-key"
# clone
git clone … /usr/shhm/mqtt
cd /usr/shhm/mqtt
# enable systemd service to run in background
sudo cp mqtt-to-influx.service /etc/systemd/system/mqtt-to-influx.service
sudo systemctl enable mqtt-to-influx.service
sudo systemctl start mqtt-to-influx.service
sudo systemctl status mqtt-to-influx.service