Hi all
I have just started with telegraf and and therefore i’m a newbie …
My intention is to collect JSON data from my home electricity meter by telegraf then put them into influxdb and visualize by grafana. My meter does support collecting data by JSON download.
Telegraf 1.22.4 is running on Linux.
therefore i need some advice/assistance in configuring telegraf to:
- get JSON data from electricity meter
- flatten the JSON data
json readout below; primarily need to flatten the JSON data to Voltage reading as an example:
Position 17: Volt Phase L1 / 240.1
Position 18: Volt Phase L2 / 238.6
Position 19: Volt Phase L3 / 240.1
also need to have “DeviceId” within the flattened data to separate, will have 2 electricity meters later on.
feedback is very much appreciated,
regards
{
"TimeUTC":"Wed May 18 20:45:00 2022",
"Timestamp":1652906700,
"TimezoneOffset":-120,
"Device":{
"Id":7,
"AddressMode":0,
"PrimaryAddress":0,
"ManufacturerId":"EMU",
"Serial":"160755",
"Version":16,
"Medium":"Electricity",
"Active":-1,
"ReadoutCycle":0,
"BaudRate":2400,
"BACNetDevInstNumber":0,
"Name":"House",
"Site":"",
"CostUnit":"",
"CommentStr":"",
"LoggerLastReadout":1652906700,
"LoggerReadoutState":1,
"LoggerReadoutCycle":60,
"MediumGroup":1,
"Battery":false,
"DeviceType":0,
"BACNetDataBaseRevision":0,
"AppResetSubCode":0,
"ErrorFlags":0,
"ValueDescs":[
{
"Id":7,
"DeviceId":7,
"Position":0,
"DescriptionStr":"Energy",
"UnitStr":"Wh",
"ScalePower":0,
"ScaleMantissa":0,
"EncodeType":0,
"ValueType":0,
"StorageNum":0,
"Tariff":1,
"Active":-1,
"LoggerLastValue":267520.0,
"CfgDescription":3,
"CfgUnit":2,
"CfgPhase":0,
"CfgFactor":1000.0,
"CfgStorageNum":0,
"CfgTariff":1,
"CfgObisCode":"1-0:1.8.1",
"Values":[
{
"Id":7,
"Timestamp":1652906700,
"Val":267520.0
}
]
},
output ommited
{
"Id":24,
"DeviceId":7,
"Position":17,
"DescriptionStr":"Volts (vendor specific)",
"UnitStr":"V",
"ScalePower":0,
"ScaleMantissa":0,
"EncodeType":0,
"ValueType":0,
"StorageNum":0,
"Tariff":0,
"Active":-1,
"LoggerLastValue":240.1,
"CfgDescription":28,
"CfgUnit":26,
"CfgPhase":1,
"CfgFactor":0.0,
"CfgStorageNum":0,
"CfgTariff":0,
"CfgObisCode":"",
"Values":[
{
"Id":24,
"Timestamp":1652906700,
"Val":240.1
}
]
},
{
"Id":25,
"DeviceId":7,
"Position":18,
"DescriptionStr":"Volts (vendor specific)",
"UnitStr":"V",
"ScalePower":0,
"ScaleMantissa":0,
"EncodeType":0,
"ValueType":0,
"StorageNum":0,
"Tariff":0,
"Active":-1,
"LoggerLastValue":238.6,
"CfgDescription":28,
"CfgUnit":26,
"CfgPhase":2,
"CfgFactor":0.0,
"CfgStorageNum":0,
"CfgTariff":0,
"CfgObisCode":"",
"Values":[
{
"Id":25,
"Timestamp":1652906700,
"Val":238.6
}
]
},
{
"Id":26,
"DeviceId":7,
"Position":19,
"DescriptionStr":"Volts (vendor specific)",
"UnitStr":"V",
"ScalePower":0,
"ScaleMantissa":0,
"EncodeType":0,
"ValueType":0,
"StorageNum":0,
"Tariff":0,
"Active":-1,
"LoggerLastValue":240.1,
"CfgDescription":28,
"CfgUnit":26,
"CfgPhase":3,
"CfgFactor":0.0,
"CfgStorageNum":0,
"CfgTariff":0,
"CfgObisCode":"",
"Values":[
{
"Id":26,
"Timestamp":1652906700,
"Val":240.1
}
]
},
output ommited