fix: cli temperature read

changes:
- fix: read temperature values without daemon
  Add subcommand to read temperature values without starting the daemon

- fix: implement measured value types
  Replace measured value types with constants

- fix: add sensor pipelines
  Add functions which returns a channel with measured values

- fix: filter measured values from a channel
  Add functions to filter measured values by sensor id or measured
  value types.
This commit is contained in:
2020-09-21 19:36:42 +02:00
parent 7cbd80c726
commit 3a090d190e
17 changed files with 481 additions and 77 deletions

View File

@ -8,11 +8,19 @@ import (
// example from a sensor. It can contains different types, for example humidity
// or temperature.
type MeasuredValue struct {
ID string `json:"id" xml:"id"`
Value float64 `json:"value,string" xml:"value,string"`
ValueType string `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"`
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"`
}
type MeasuredValueType string
const (
Humidity MeasuredValueType = "humidity"
Pressure = "pressure"
Temperature = "temperature"
)