Skip to content

s1232/amsparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Power meter HDLC parser

Small command line tool that accepts a HDLC frame from a certain automatic power meter as a non-textual byte array and returns a json string containing the current power consumption and a timestamp, suitable for a POST request to Cognite's API for writing data points:

$ echo -n -e '~\xa1\x0bA\x08\x83\x13\xfa\xe6\xe7\x00\x0f@\x00\x00\x00\x00\x01\x0c\x02\x02\t\x06\x01\x01\x00\x02\x81\xff\n\x0bAIDON_V0001\x02\x02\t\x06\x00\x00\x01\x00\xff\n\x107359992901964692\x02\x02\t\x06\x00\x00\x01\x07\xff\n\x046525\x02\x03\t\x06\x01\x00\x01\x07\x00\xff\x06\x00\x00\x08\x84\x02\x02\x0f\x00\x16\x1b\x02\x03\t\x06\x01\x00\x02\x07\x00\xff\x06\x00\x00\x00\x00\x02\x02\x0f\x00\x16\x1b\x02\x03\t\x06\x01\x00\x03\x07\x00\xff\x06\x00\x00\x00\x00\x02\x02\x0f\x00\x16\x1d\x02\x03\t\x06\x01\x00\x04\x07\x00\xff\x06\x00\x00\x01c\x02\x02\x0f\x00\x16\x1d\x02\x03\t\x06\x01\x00\x1f\x07\x00\xff\x10\x00B\x02\x02\x0f\xff\x16!\x02\x03\t\x06\x01\x00G\x07\x00\xff\x10\x000\x02\x02\x0f\xff\x16!\x02\x03\t\x06\x01\x00\x07\x00\xff\x12\t\x82\x02\x02\x0f\xff\x16#\x02\x03\t\x06\x01\x004\x07\x00\xff\x12\t\x83\x02\x02\x0f\xff\x16#\x02\x03\t\x06\x01\x00H\x07\x00\xff\x12\t\x80\x02\x02\x0f\xff\x16#\x01\xe9~' 

| amsparser

{
    "items":
        [{
            "datapoints":
            [{
                "timestamp":1673520450191,
                "value":2180
            }],
            "externalId":"amsreading"
        }]
}

The NiFi processor ExecuteStreamCommand will call the command for every flow file and pass the json response on as a new flow file.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages