Documentation ¶
Index ¶
- Variables
- type DB
- type Data
- type Device
- func (dev *Device) Close() error
- func (dev *Device) Interval() (time.Duration, error)
- func (dev *Device) Name() string
- func (dev *Device) NumData() (int, error)
- func (dev *Device) Read() (Data, error)
- func (dev *Device) ReadAll() ([]Data, error)
- func (dev *Device) Since() (time.Duration, error)
- func (dev *Device) Version() (string, error)
- type Quality
- type Samples
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoData indicates a missing data point. // This may happen during sensor calibration. ErrNoData = errors.New("aranet4: no data") // ErrDupDevice is returned by DB.AddDevice when a device with // the provided id is already stored in the database. ErrDupDevice = errors.New("aranet4: duplicate device") )
Functions ¶
This section is empty.
Types ¶
type DB ¶ added in v0.11.0
type DB interface { io.Closer // PutData puts the provided data for the device id into the underlying store PutData(id string, vs []Data) error // Data iterates over data for the device id and the requested time interval [beg, end) Data(id string, beg, end time.Time) iter.Seq2[Data, error] // Last returns the last data point for the provided device id Last(id string) (Data, error) // AddDevice declares a new device id AddDevice(id string) error // Devices returns the device ids list Devices() ([]string, error) }
DB is the interface to manage aranet4 data.
type Data ¶
type Data struct {
H, P, T float64
CO2 int
Battery int
Quality Quality
Interval time.Duration
Time time.Time
}
Data holds measured data samples provided by Aranet4.
func (Data) BinarySize ¶ added in v0.11.0
BinarySize returns the number of bytes needed to hold the binary data for a single Data element.
type Quality ¶
type Quality int
Quality gives a general assessment of air quality (green/yellow/red).
- green: [ 0 - 1000) ppm
- yellow: [1000 - 1400) ppm
- red: [1400 - ...) ppm
func QualityFrom ¶ added in v0.11.0
QualityFrom creates a quality value from a CO2 value.
Directories ¶
Path | Synopsis |
---|---|
Package arasrv provides tools to gather and present aranet4 data over HTTP.
|
Package arasrv provides tools to gather and present aranet4 data over HTTP. |
cmd
|
|
aranet4-daq
Command aranet4-daq retrieves data from an Aranet4 device and uploads it to an HTTP server.
|
Command aranet4-daq retrieves data from an Aranet4 device and uploads it to an HTTP server. |
internal
|
|
arabolt
Package arabolt provides an implementation of an aranet4 database, backed by bbolt.
|
Package arabolt provides an implementation of an aranet4 database, backed by bbolt. |
arasqlite
Package arasqlite provides an implementation of an aranet4 database, backed by SQlite3.
|
Package arasqlite provides an implementation of an aranet4 database, backed by SQlite3. |
Click to show internal directories.
Click to hide internal directories.