1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Merge pull request #1461 from spacelama/tasmota_power_fix

tasmota: introduced incorrect escaping in f1e354eb
This commit is contained in:
Kenyon Ralph 2024-10-22 11:01:48 -07:00 committed by GitHub
commit 1a84704248
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -101,7 +101,7 @@ voltage() {
echo "$axis.label Voltage" echo "$axis.label Voltage"
else else
get_status 8 '.StatusSNS["ENERGY"].Voltage' get_status 8 '.StatusSNS["ENERGY"]'.Voltage
echo "$axis.value $res" echo "$axis.value $res"
fi fi
} }
@ -115,7 +115,7 @@ current() {
echo "$axis.label Current" echo "$axis.label Current"
else else
get_status 8 '.StatusSNS["ENERGY"].Current' get_status 8 '.StatusSNS["ENERGY"]'.Current
echo "$axis.value $res" echo "$axis.value $res"
fi fi
} }
@ -135,7 +135,7 @@ power() {
done done
else else
for axis in ApparentPower ReactivePower Power ; do for axis in ApparentPower ReactivePower Power ; do
get_status 8 '.StatusSNS["ENERGY"].$axis' get_status 8 '.StatusSNS["ENERGY"]'.$axis
echo "$axis.value $res" echo "$axis.value $res"
done done
fi fi
@ -152,7 +152,7 @@ powerfactor() {
echo "$axis.max 1" echo "$axis.max 1"
echo "$axis.label Power Factor" echo "$axis.label Power Factor"
else else
get_status 8 '.StatusSNS["ENERGY"].Factor' get_status 8 '.StatusSNS["ENERGY"]'.Factor
echo "$axis.value $res" echo "$axis.value $res"
fi fi
} }
@ -167,7 +167,7 @@ energy() {
echo "$axis.label Energy" echo "$axis.label Energy"
echo "$axis.draw AREA" echo "$axis.draw AREA"
else else
get_status 8 '.StatusSNS["ENERGY"].Total' get_status 8 '.StatusSNS["ENERGY"]'.Total
echo "$axis.value $res" echo "$axis.value $res"
fi fi
} }
@ -183,7 +183,7 @@ temperature() {
echo "$axis.type GAUGE" echo "$axis.type GAUGE"
#echo "$axis.min 0" #echo "$axis.min 0"
else else
get_status 10 '.StatusSNS["ANALOG"].Temperature1' get_status 10 '.StatusSNS["ANALOG"]'.Temperature1
echo "$axis.value $res" echo "$axis.value $res"
fi fi
} }
@ -199,14 +199,14 @@ DS18B20() {
for i in '' `seq 1 9` ; do for i in '' `seq 1 9` ; do
axis=Temperature$i axis=Temperature$i
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
get_status 10 ".StatusSNS[\"DS18B20${i:+-$i}\"].Temperature" get_status 10 ".StatusSNS[\"DS18B20${i:+-$i}\"]".Temperature
if [ "$res" != U ] ; then if [ "$res" != U ] ; then
echo "$axis.label Temperature${i:+ $i}" echo "$axis.label Temperature${i:+ $i}"
echo "$axis.type GAUGE" echo "$axis.type GAUGE"
#echo "$axis.min 0" #echo "$axis.min 0"
fi fi
else else
get_status 10 ".StatusSNS[\"DS18B20${i:+-$i}\"].Temperature" get_status 10 ".StatusSNS[\"DS18B20${i:+-$i}\"]".Temperature
if [ "$res" != U ] ; then # should only echo U if there's if [ "$res" != U ] ; then # should only echo U if there's
# not a valid temperature where # not a valid temperature where
# there once was, but we don't # there once was, but we don't
@ -228,7 +228,7 @@ SCD40() {
echo "$axis.label Carbon Dioxide" echo "$axis.label Carbon Dioxide"
echo "$axis.type GAUGE" echo "$axis.type GAUGE"
else else
get_status 8 '.StatusSNS["SCD40"].CarbonDioxide' get_status 8 '.StatusSNS["SCD40"]'.CarbonDioxide
echo "$axis.value $res" echo "$axis.value $res"
fi fi
} }
@ -250,7 +250,7 @@ PMS5003() {
for v in 'PB1="PB1"' 'PB2_5="PB2.5"' 'PB10="PB10"' ; do for v in 'PB1="PB1"' 'PB2_5="PB2.5"' 'PB10="PB10"' ; do
axis=$( echo "$v" | cut -d= -f 1 ) axis=$( echo "$v" | cut -d= -f 1 )
field=$( echo "$v" | cut -d= -f 2 ) field=$( echo "$v" | cut -d= -f 2 )
get_status 8 '.StatusSNS["PMS5003"].$field' get_status 8 '.StatusSNS["PMS5003"]'.$field
echo "$axis.value $res" echo "$axis.value $res"
done done
fi fi
@ -276,7 +276,7 @@ millivolts() {
echo "$axis.label V" echo "$axis.label V"
echo "$axis.type GAUGE" echo "$axis.type GAUGE"
else else
get_status 8 '.StatusSNS["ANALOG"].Range' get_status 8 '.StatusSNS["ANALOG"]'.Range
if [ "$res" != U ] ; then if [ "$res" != U ] ; then
res=$( echo "$res" | awk '{printf "%0.3f", $1/1000}' ) res=$( echo "$res" | awk '{printf "%0.3f", $1/1000}' )
fi fi