Last active
September 10, 2018 12:53
-
-
Save e-minguez/1872566565d9a3a1650b7053cc1508fa to your computer and use it in GitHub Desktop.
pcsensor2mqtt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MQTT_HOST=${MQTT_HOST:-localhost} | |
MQTT_ID=${MQTT_ID:-n54l} | |
MQTT_TOPIC=${MQTT_TOPIC:-n54l/input/temp} | |
MQTT_OPTIONS=${MQTT_OPTIONS:-"-V mqttv311"} | |
# Raw message to MQTT | |
# https://github.com/shakemid/pcsensor-temper | |
TEMP=$(/home/edu/bin/pcsensor -c | awk '{ print $4 }') | |
/usr/bin/mosquitto_pub -h ${MQTT_HOST} -i ${MQTT_ID} -t ${MQTT_TOPIC} ${MQTT_OPTIONS} -m "${TEMP}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment