Code Monkey home page Code Monkey logo

n2kparser's Introduction

n2kparser

Python3.x CLI to parser incoming JSON data from actisense-serial and analyzer binaries from CANBOAT and store values into InfluxDB using UDP

Installation and Dependencies

Installation

Install the CANBOAT repository binaries in order to use actisense-serial and analyzer binaries.

Clone the repository and then install the code:

pip install .

Development

develop using venv:

python -m venv venv

activate the virtual environment and then

pip install -e .

Usage

Path to the conf.json (see File in repository for Structure) can be set via argument --config

Configuration File

$ n2kparser --config ./conf.json

The PGNs are configurable via the conf.json file in the repository. Follow the structure mentioned in the file.

A snippet of the PGN is as follows:

"pgnConfigs": {
  "130311": {
    "for": "Environmental Parameters",
    "fieldLabels": [
      "Temperature",
      "Atmospheric Pressure"
    ],
    "topics": [
      "environment/nmea2k/temperature",
      "environment/nmea2k/pressure"
    ]
  },
  "127250": {
    "for": "Vessel Heading",
    "fieldLabels": [
      "Heading"
    ],
    "topics": [
      "control/nmea2k/heading"
    ]
  },
    "127501": {
    "for": "Binary Switch Bank",
    "fromSource": 1,
    "fieldLabels": [
      "Indicator1",
      "Indicator2"
    ],
    "topics": [
      "input/nmea2k/switchbank"
    ]
  }
}

NOTE: A single PGN can measure a different values

  • for key is for Human-Readable Description for the PGN. (Optional)
  • fieldLabels key is an array of all the relevant keys for which the values should be saved to InfluxDB. Example, for Rudder (same PGN) one can choose to store only Position value or both Direction Order and Position (Required)
  • fromSource keys is a filter key to store information from only distinct source (e.g. Engine, Rudder). If there are two Engines/Rudders and the value of Engine/Rudder 1 is to be stored then use fromSource: 1. (Optional)
  • topics: A list of topics that are combined with deviceID and published in accordance with the fieldLabels (Required)

Topics

<DeviceID>/<Profile>/<Source>/<Measurement>

the payload is in the form of line protocol strings for each topic

Maintainer

n2kparser's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mielnicz

n2kparser's Issues

Add MQTT Publishing Feature

Feature

Save data locally on InfluxDB as well as publish it to an MQTT broker in the Influx Line Protocol string format.

Changes

  • Change conf.json file to include Broker parameters
  • Add MQTT topics based on specific profiles of the values
  • Adapt Measurement dict within the code to obtain line protocol strings
  • Add paho-mqtt publishing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.