How do I get Avalon Miner Temperature from console? I am trying to read the temperature from my Avalon which has the Avalon Firmware: 20170603

I'm using the command:

cgminer-api -o stats

It brings me a lot of information that I don´t need.

root@OpenWrt:/etc# cgminer-api -o stats
STATUS=S,When=1482343577,Code=70,Msg=CGMiner stats,Description=cgminer 4.10.0|STATS=0,ID=AV70,Elapsed=30789,Calls=0,Wait=0.000000,Max=0.000000,Min=99999999.000000,MM ID1=Ver[7411612-6cf14b0] DNA[01313edbc5efabe3] Elapsed[30792] MW[340560 340538 340538 340538] LW[1362174] MH[180 238 259 216] HW[893] DH[2.749%] Temp[30] TMax[77] Fan[5430] FanR[90%] Vi[1201 1201 1202 1202] Vo[4438 4406 4443 4438] GHSmm[8063.47] WU[108083.46] Freq[715.86] PG[15] Led[0] MW0[1170 1302 1206 1250 1197 1312 1331 1262 1300 1216 1230 1281 1265 1273 1327 1291 1232 1231 1267 1292 1286 1203] MW1[1312 1189 1237 1251 1212 1247 1264 1275 1196 1256 1283 1257 1190 1247 1243 1282 1330 1315 1292 1273 1261 1271] MW2[1213 1262 1310 1202 1285 1220 1291 1267 1309 1307 1164 1212 1290 1289 1308 1174 1230 1276 1252 1189 1192 1242] MW3[1302 1275 1209 1307 1217 1294 1328 1273 1237 1256 1227 1239 1268 1242 1308 1314 1296 1314 1331 1324 1297 1190] TA[88] ECHU[512 0 0 0] ECMM[0] FM[1] CRC[974 0 0 0] PAIRS[0 0 0] PVT_T[4-70/0-76/72 0-69/11-76/70 2-70/0-77/74 20-67/0-75/70],MM ID2=Ver[7411612-6cf14b0] DNA[0132c3d0691693b9] Elapsed[30791] MW[340551 340551 340538 340538] LW[1362178] MH[2067 188 222 215] HW[2692] DH[3.629%] Temp[29] TMax[80] Fan[5490] FanR[90%] Vi[1204 1202 1201 1201] Vo[4461 4447 4420 4443] GHSmm[7887.76] WU[103670.36] Freq[700.26] PG[15] Led[0] MW0[1264 1270 1229 1313 1296 1184 1239 1237 1266 1247 1252 1242 1202 1266 1266 1317 1255 1272 1309 1230 1301 1243] MW1[1155 1159 1213 1196 1214 1154 1152 1213 1180 1180 1152 1193 1118 1122 1159 1173 1185 1193 1180 1161 1170 1175] MW2[1269 1138 1285 1180 1256 1210 1170 1299 1223 1185 1164 1132 1140 1225 1246 1173 1237 1212 1192 1284 1215 1205] MW3[762 1268 1187 1271 1277 1150 1202 1208 1172 1170 1176 1249 1177 1154 1197 1250 1176 1227 1268 1218 1262 1251] TA[88] ECHU[0 512 0 0] ECMM[0] FM[1] CRC[0 0 0 0] PAIRS[0 0 0] PVT_T[0-68/10-80/70 19-67/0-76/70 0-70/11-78/72 19-68/0-77/71],MM Count=2,Smart Speed=1,Connecter=AUC,AUC VER=AUC-20151208,AUC I2C Speed=400000,AUC I2C XDelay=19200,AUC Sensor=15483,AUC Temperature=28.17,Connection Overloaded=false,Voltage Offset=0,Nonce Mask=29,USB Pipe=0,USB Delay=r0 0.000000 w0 0.000000,USB tmo=0 0|STATS=1,ID=POOL0,Elapsed=30789,Calls=0,Wait=0.000000,Max=0.000000,Min=99999999.000000,Pool Calls=0,Pool Attempts=0,Pool Wait=0.000000,Pool Max=0.000000,Pool Min=99999999.000000,Pool Av=0.000000,Work Had Roll Time=false,Work Can Roll=false,Work Had Expire=false,Work Roll Time=0,Work Diff=65536.00000000,Min Diff=1.00000000,Max Diff=131072.00000000,Min Diff Count=12,Max Diff Count=18313,Times Sent=1531,Bytes Sent=228345,Times Recv=2668,Bytes Recv=1379612,Net Bytes Sent=228345,Net Bytes Recv=1379612|STATS=2,ID=POOL1,Elapsed=30789,Calls=0,Wait=0.000000,Max=0.000000,Min=99999999.000000,Pool Calls=0,Pool Attempts=0,Pool Wait=0.000000,Pool Max=0.000000,Pool Min=99999999.000000,Pool Av=0.000000,Work Had Roll Time=false,Work Can Roll=false,Work Had Expire=false,Work Roll Time=0,Work Diff=16384.00000000,Min Diff=4096.00000000,Max Diff=16384.00000000,Min Diff Count=374,Max Diff Count=993,Times Sent=109,Bytes Sent=12038,Times Recv=119,Bytes Recv=12214,Net Bytes Sent=12038,Net Bytes Recv=12214|STATS=3,ID=POOL2,Elapsed=30789,Calls=0,Wait=0.000000,Max=0.000000,Min=99999999.000000,Pool Calls=0,Pool Attempts=0,Pool Wait=0.000000,Pool Max=0.000000,Pool Min=99999999.000000,Pool Av=0.000000,Work Had Roll Time=false,Work Can Roll=false,Work Had Expire=false,Work Roll Time=0,Work Diff=0.00000000,Min Diff=0.00000000,Max Diff=0.00000000,Min Diff Count=0,Max Diff Count=0,Times Sent=2,Bytes Sent=151,Times Recv=3,Bytes Recv=244,Net Bytes Sent=151,Net Bytes Recv=244|
I hate to necropost but I am in the middle of building a custom monitoring system for our company and had to deal with this exact problem. While I sadly can't release any code at the moment, there two values you are looking for: "Temp" and "TMax". "Temp" is the inlet temperature and "TMax" is the outlet temperature. At the moment my code just iterates through the JSON data looking for those strings with a regex and combines all the ones it finds into an overall controller average.