Skip to content

CLI in Python3 to asynchronously read NMEA2000 data from canboat's n2kd Stream Server and publish data to MQTT and InfluxDB

License

Notifications You must be signed in to change notification settings

iotfablab/nmea2kfluxlite

Repository files navigation

nmea2kfluxlite

Python3 CLI similar to n2kparser with asynchronous reading of incoming NMEA2000 data from n2kd CLI by canboat

Features

  • Send data to InfluxDB on a hardware using UDP Socket directly
  • Provide TLS settings for connecting to a Secure MQTT Broker
  • Use a fixed length queue (see PAYLOAD_QUEUE in code) to store incoming NMEA2000 data in Line Protocol Format and send them to DEVICE_NAME/DEVICE_ID/nmea2000 topic with QoS=1
  • NMEA2000 PGNS can be configured via the conf.json

Secure MQTT Configuration

Followig sample configuration for using a Secure MQTT Broker with Certificates. Use insecure: true to not use certificates.

"mqtt": {
      "broker": "secure_broker",
      "port": 8883,
      "username": null,
      "password": null,
      "TLS": {
          "enable": true,
          "insecure": false,
          "tls_version": "tlsv1.2",
          "certs": {
            "certdir": "/etc/ssl/certs/mqtt",
            "cafile": "ca.crt",
            "certfile": "mqtt-client.crt",
            "keyfile": "mqtt-client.key"
          }
      }
    }

systemd for n2kd Streaming Server

see the nmea2kstreamer.service and adapt the Serial Port for Actisense NGT-1 Gateway.

The stream socket is default at 2598.

PGN Configuration

Refer to n2kparser for how to adapt the conf.json to read different PGNs and filter out specific source PGNs

InfluxDB UDP Configuration

Sample configuration for influxdb.conf

[[udp]]
  enabled = true
  bind-address = ":8095"
  database = "IoTSink"
  precision = "n"

About

CLI in Python3 to asynchronously read NMEA2000 data from canboat's n2kd Stream Server and publish data to MQTT and InfluxDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages