rpi_gpio

package
v0.0.0-...-636febd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2020 License: MIT Imports: 4 Imported by: 0

README

RaspberryPi GPIO plugin

Collect metrics from the GPIO pins on a RaspberryPi

This plugin using the go-rpio library to read values from the GPIO pins.

Configuration

Example
# Reads binary values from the GPIO pins of a RaspberryPi
[[inputs.rpi_gpio]]

  ## Provide a data field name to gpio pin numbers
  ## Numbers correspond to the GPIO number, not the physical pin number
  [inputs.rpi_gpio.pins]
  button = 2
  motion_sensor = 3
  light_sensor = 4

You must to create a named field for each pin you want to read data from. The pin number corresponds to the GPIO number as indicated on the image below.

RaspberryPi GPIO

Measurements & Fields

The measurement name will always be gpio.

Field names are those defined in the [inputs.rpi_gpio_pins] section of the configuration. Readings will only be sent from pins defined in this section.

Values will always be either 0 (indicating LOW voltage on the pin) or 1 (indicating HIGH voltage)

Example Output

telegraf --config telegraf.conf --input-filter rpi_gpio --test
2020-03-02T20:45:53Z I! Starting Telegraf 
> gpio,host=raspberrypi button=1i,light_sensor=1i,motion_sensor=0i 1583181953000000000

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GPIO

type GPIO interface {
	Open() error
	Close() error
	ReadPin(pin_num int) int
}

type RPIO

type RPIO struct {
}

func (*RPIO) Close

func (s *RPIO) Close() error

func (*RPIO) Open

func (s *RPIO) Open() error

func (*RPIO) ReadPin

func (s *RPIO) ReadPin(pin_num int) int

type RPiGPIO

type RPiGPIO struct {
	Pins map[string]int  `toml:"pins"`
	Log  telegraf.Logger `toml:"-"`
	// contains filtered or unexported fields
}

func (*RPiGPIO) Description

func (s *RPiGPIO) Description() string

func (*RPiGPIO) Gather

func (s *RPiGPIO) Gather(acc telegraf.Accumulator) error

func (*RPiGPIO) SampleConfig

func (s *RPiGPIO) SampleConfig() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL