...
Code Block | ||||
---|---|---|---|---|
| ||||
#TEMP on SONOFF 158 SOURCE_URL="http://192.168.1.158/cm?user=admin&password=lifeisgreatxxx&cmnd=status%2010" if [ "$1" = "Get" ]; then # $2 would be the name 'sonoff158' # $3 would be the charactersistic if [ "$3" = "CurrentTemperature" ]; then temp=`curl -L $SOURCE_URL |sed -rn 's/.*"Temperature":([0-9]*.[0-9]*).*/\1/p'` echo $temp exit 0 fi if [ "$3" = "StatusActive" ]; then echo "1" exit 0 fi fi if [ "$1" = "Set" ]; then exit 1 fi exit 0 |
...