本帖最后由 arthurfsy 于 2023-3-21 09:41 编辑
返回的数据默认是GB的,如果需要改成MB需要自己在流量数值那里*1024,但是这个抓包默认只取到了GB的整数值,如147GB,所以精度上可能不太准。然后在“联通剩余流量”这个实体的单位,把“GB”改成“MB”
msg.payload = {
"rec":time +'\n'+ print2,
"remainTitle1":a[0].remainTitle,
"number1":a[0].number*1024, //乘以1024,
"unit1":a[0].unit,
"persent1":a[0].persent+'%',
"remainTitle2":a[1].remainTitle,
"number2":a[1].number,
"unit2":a[1].unit,
"persent2":a[1].persent+'%',
"remainTitle3":a[2].remainTitle,
"number3":a[2].number,
"unit3":a[2].unit,
"persent3":a[2].persent+'%',
}
|