Forward to Influxdb from RPICT

From lechacal
Jump to: navigation, search

We will introduce you to the forwarding tool for Influxdb 'lcl-gateway'.

Prerequisites

  • Influxdb is already installed and a database has been created.
  • RPICT unit has been tested with the cat command first.
  • RPICT is using the default output format number 3.

Installation

Get the lcl-gateway tool and install it this way.

wget lechacal.com/RPICT/tools/lcl-gateway_1.3.0_armhf.deb
sudo dpkg -i lcl-gateway_1.3.0_armhf.deb

Configuration

You can now edit the configuration file

sudo nano /etc/lcl-gateway.conf

The file looks like this

[system]
port=/dev/ttyAMA0
baud=38400

[emoncms]
enabled = False
hostname = emoncms.org
apikey = --apikey-from-emoncms-goes-here--
node = 20

[influxdb]
enabled = True
version = 1
measurement = rpict3t1

# Parameters for version 1 below
db = home
url = http://192.168.1.65:8086/write

# Parameters for version 2 below
#url = http://192.168.1.169:8086/api/v2/write
token = NbMVAzr35B0uZehxgd_lPgVpqjDGM2-r2UF15Qd3F4D0uv-VKtVsWslH4-7vVDH1r95A-imvdqPALt1m9bW6rA==
org = lcl
bucket = home
 
[localsave]
enabled = False
directory = /tmp/

There are 2 versions of Influxdb. you should indicate which version is used in the version parameter.

For version 1 you must indicate the db and url parameters.

For version 2 you must indicate the url (uncomment it by removing the leading #) and also token org and bucket. token is the API token that can be obtained from the Influxdb interface. org and bucket are set when you first setup the Influxdb database.


start lcl-gateway

You can launch the gateway in the background using

sudo systemctl start lcl-gateway

If you prefer running the program by hand with some debugging to troubleshoot use the command below:

/usr/local/bin/lcl-gateway.py -d

To make the gateway start automatically at boot time enter:

sudo systemctl enable lcl-gateway