原始报文:{
“message”: {
“header”: {
“version”: “V1.0.0”,
“ts”: “2023-09-14 16:23:54”,
“index”: 195,
“function”: “pmMsgReq”
},
“dataBody”: [
{
“pmAddr”: “pm0_1”,
“fTotalActEng”: “130689”,
“rTotalActEng”: “14”,
“aVolt”: “226.4”,
“bVolt”: “225.9”,
“cVolt”: “229.2”,
“aCurr”: “273.6”,
“bCurr”: “340.8”,
“cCurr”: “187.2”,
“fre”: “49.96”,
“totalActPwr”: “163.4”,
“totalReactPwr”: “40.8”,
“totalPSPwr”: “168.3”,
“totalFactPwr”: “0.97”,
“topFActEng”: “0”,
“peakFActEng”: “0”,
“flatFActEng”: “0”,
“valleyFActEng”: “0”,
“topRActEng”: “0”,
“peakRActEng”: “0”,
“flatRActEng”: “0”,
“valleyRActEng”: “0”
},
{
“pmAddr”: “pm0_2”,
“fTotalActEng”: “”,
“rTotalActEng”: “”,
“aVolt”: “”,
“bVolt”: “”,
“cVolt”: “”,
“aCurr”: “”,
“bCurr”: “”,
“cCurr”: “”,
“fre”: “”,
“totalActPwr”: “”,
“totalReactPwr”: “”,
“totalPSPwr”: “”,
“totalFactPwr”: “”,
“topFActEng”: “”,
“peakFActEng”: “”,
“flatFActEng”: “”,
“valleyFActEng”: “”,
“topRActEng”: “”,
“peakRActEng”: “”,
“flatRActEng”: “”,
“valleyRActEng”: “”
},
{
“pmAddr”: “pm0_5”,
“fTotalActEng”: “31326”,
“rTotalActEng”: “26019”,
“aVolt”: “227.3”,
“bVolt”: “227.1”,
“cVolt”: “230.2”,
“aCurr”: “144.3”,
“bCurr”: “145.5”,
“cCurr”: “142.5”,
“fre”: “49.96”,
“totalActPwr”: “-97.8”,
“totalReactPwr”: “-1.5”,
“totalPSPwr”: “97.8”,
“totalFactPwr”: “0.00”,
“topFActEng”: “157”,
“peakFActEng”: “675”,
“flatFActEng”: “5”,
“valleyFActEng”: “30489”,
“topRActEng”: “25910”,
“peakRActEng”: “109”,
“flatRActEng”: “0”,
“valleyRActEng”: “0”
}
]
}
}
sql:
SELECT
payload.message.dataBody[2].fTotalActEng as fTotalActEng,
payload.message.dataBody[2].rTotalActEng as rTotalActEng,
payload.message.dataBody[2].aVolt as aVolt,
payload.message.dataBody[2].bVolt as bVolt,
payload.message.dataBody[2].cVolt as cVolt,
payload.message.dataBody[2].aCurr as aCurr,
payload.message.dataBody[2].bCurr as bCurr,
payload.message.dataBody[2].cCurr as cCurr,
payload.message.dataBody[2].fre as fre,
payload.message.dataBody[2].totalActPwr as totalActPwr,
payload.message.dataBody[2].totalReactPwr as totalReactPwr,
payload.message.dataBody[2].totalPSPwr as totalPSPwr,
payload.message.dataBody[2].topFActEng as topFActEng,
payload.message.dataBody[2].peakFActEng as peakFActEng,
payload.message.dataBody[2].flatFActEng as flatFActEng,
payload.message.dataBody[2].valleyFActEng as valleyFActEng,
payload.message.dataBody[2].topRActEng as topRActEng,
payload.message.dataBody[2].peakRActEng as peakRActEng,
payload.message.dataBody[2].flatRActEng as flatRActEng,
payload.message.dataBody[2].valleyRActEng as valleyRActEng,
payload.message.header.ts as ts
FROM
“/device/data/jiali/post_reply/VR2306D-002”
WHERE payload.message.header.function=‘pmMsgReq’
插入语句:
INSERT INTO iot_datas.jiali_VR2306D002_pm_5 USING iot_datas.iot_meters TAGS (‘pm_5’, ‘VR2306D-002’,‘’,‘’,‘’,‘’) VALUES (now,${fTotalActEng},${rTotalActEng},${aVolt},${bVolt} ,${cVolt},${aCurr},${bCurr},${cCurr},${fre},${totalActPwr},${totalReactPwr},${totalPSPwr},${totalFactPwr},${topFActEng},${peakFActEng},${flatFActEng},${valleyFActEng},${topRActEng},${peakRActEng},${flatRActEng},${valleyRActEng})
所有读取到的数据都是未定义