types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Humidity    MeasuredValueType = "humidity"
	Pressure                      = "pressure"
	Temperature                   = "temperature"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	ID           string     `json:"id" xml:"id"`
	Name         string     `json:"name" xml:"name"`
	Location     *string    `json:"location" xml:"location"`
	CreationDate time.Time  `json:"creation_date" xml:"creation_date"`
	UpdateDate   *time.Time `json:"update_date" xml:"update_date"`
}

Device represent a device with all his settings.

type MeasuredValue

type MeasuredValue struct {
	ID           string            `json:"id" xml:"id"`
	Value        float64           `json:"value,string" xml:"value,string"`
	ValueType    MeasuredValueType `json:"value_type" xml:"value_type"`
	Date         time.Time         `json:"date" xml:"date"`
	SensorID     string            `json:"sensor_id" xml:"sensor_id"`
	CreationDate time.Time         `json:"creation_date" xml:"creation_date"`
	UpdateDate   *time.Time        `json:"update_date" xml:"update_date"`
}

MeasuredValue represent a value provided by a measuring instrument. For example from a sensor. It can contains different types, for example humidity or temperature.

type MeasuredValueType added in v0.3.0

type MeasuredValueType string

type Sensor

type Sensor struct {
	ID           string     `json:"id" xml:"id"`
	Name         string     `json:"name" xml:"name"`
	Location     string     `json:"location" xml:"location"`
	WireID       *string    `json:"wire_id" xml:"wire_id"`
	I2CBus       *int       `json:"i2c_bus" xml:"i2c_bus"`
	I2CAddress   *uint8     `json:"i2c_address" xml:"i2c_address"`
	GPIONumber   string     `json:"gpio_number" xml:"gpio_number"`
	Model        string     `json:"model" xml:"model"`
	Enabled      bool       `json:"enabled" xml:"enabled"`
	TickDuration string     `json:"tick_duration" xml:"tick_duration"`
	DeviceID     string     `json:"device_id" xml:"device_id"`
	CreationDate time.Time  `json:"creation_date" xml:"creation_date"`
	UpdateDate   *time.Time `json:"update_date" xml:"update_date"`
}

Sensor represents a sensor with all his settings. The struct does not contains any read method.

func FilterSensorByMeasuredValueTypes added in v0.3.0

func FilterSensorByMeasuredValueTypes(sensors []*Sensor, measuredValueTypes ...MeasuredValueType) ([]*Sensor, error)

FilterSensorByMeasuredValueTypes filters sensors by the measured values types which they measure

func (*Sensor) GetTicker

func (s *Sensor) GetTicker() *time.Ticker

GetTicker returns a new ticker, which tick every when the sensor should be read

Jump to

Keyboard shortcuts

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