Last active
March 22, 2017 19:52
-
-
Save pingec/5f91a617aad229bfce85f1c0fa2943cf to your computer and use it in GitHub Desktop.
Reporting temperatures from openwrt router
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/sh | |
# Gets temperature from 1wire sensor with specified address and posts it to specified url (teste on openwrt@wr1043nd) | |
SENSR_ADDR="28DD70770200009C" | |
SENSR_NUM=$(/usr/bin/digitemp_DS9097 -s /dev/ttyUSB0 -i -q | grep $SENSR_ADDR | grep ROM | cut -c6) | |
TEMP=$(/usr/bin/digitemp_DS9097 -t$SENSR_NUM -q -o"%.2C") | |
$(wget -q "http://***/temp.php?temp=$TEMP" -O /dev/null) | |
if [ $? -ne 0 ]; | |
then echo "FAILED TO SEND" | |
else echo "OK" | |
fi | |
SENSR_ADDR="282C57CD0400002B" | |
SENSR_NUM=$(/usr/bin/digitemp_DS9097 -s /dev/ttyUSB0 -i -q | grep $SENSR_ADDR | grep ROM | cut -c6) | |
TEMP=$(/usr/bin/digitemp_DS9097 -t$SENSR_NUM -q -o"%.2C") | |
$(wget -q "http://***/temp.php?temp=$TEMP" -O /dev/null) | |
if [ $? -ne 0 ]; | |
then echo "FAILED TO SEND" | |
else echo "OK" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment