sensors

package
v0.0.65 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 4 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SensorTypeToString added in v0.0.63

func SensorTypeToString(sensorType SensorType) string

Types

type AirQuality added in v0.0.25

type AirQuality struct {
	NamedSensor `json:"-"`
	Name        string        `json:"name" mapstructure:"name"`
	Analog      bool          `json:"analog" mapstructure:"analog"`
	Pin         uint8         `json:"pin" mapstructure:"pin"`
	Interval    time.Duration `json:"interval" mapstructure:"interval"`
	Update      *UpdateRate   `json:"update,omitempty" mapstructure:"update,omitempty"`
}

func (AirQuality) GetName added in v0.0.46

func (s AirQuality) GetName() string

type AirQualitySensorData added in v0.0.24

type AirQualitySensorData struct {
	Serializable
	Processable
	Sensor     *AirQuality  `json:"sensor,omitempty"`
	AirQuality *SensorValue `json:"airQuality,omitempty"`
}

func (*AirQualitySensorData) HASerialize added in v0.0.64

func (s *AirQualitySensorData) HASerialize(hostname string) (string, error)

func (*AirQualitySensorData) Process added in v0.0.53

func (s *AirQualitySensorData) Process(f func(value SensorValue, name string) (err error)) error

func (*AirQualitySensorData) Serialize added in v0.0.62

func (s *AirQualitySensorData) Serialize() (string, error)

func (*AirQualitySensorData) String added in v0.0.24

func (s *AirQualitySensorData) String() string

type AirQualitySensorDataResponse added in v0.0.38

type AirQualitySensorDataResponse struct {
	SensorResponse
	Data []*AirQualitySensorData `json:"data"`
}

type BME280 added in v0.0.25

type BME280 struct {
	NamedSensor `json:"-"`
	Name        string      `json:"name" mapstructure:"name"`
	Bus         int         `json:"bus" mapstructure:"bus"`
	Update      *UpdateRate `json:"update,omitempty" mapstructure:"update,omitempty"`
}

func (*BME280) GetName added in v0.0.46

func (s *BME280) GetName() string

type BMPSensorData

type BMPSensorData struct {
	Serializable
	HASerializable
	Processable
	Sensor      *BME280      `json:"sensor,omitempty"`
	Temperature *SensorValue `json:"temperature,omitempty"`
	Pressure    *SensorValue `json:"pressure,omitempty"`
	Humidity    *SensorValue `json:"humidity,omitempty"`
}

BMPSensorData json converter

func (*BMPSensorData) HASerialize added in v0.0.64

func (s *BMPSensorData) HASerialize(hostname string) (string, error)

func (*BMPSensorData) Process added in v0.0.52

func (s *BMPSensorData) Process(f func(value SensorValue, name string) (err error)) error

func (*BMPSensorData) Serialize added in v0.0.62

func (s *BMPSensorData) Serialize() (string, error)

func (*BMPSensorData) String

func (s *BMPSensorData) String() string

type BMPSensorDataResponse added in v0.0.38

type BMPSensorDataResponse struct {
	SensorResponse
	Data []*BMPSensorData `json:"data"`
}

type Calibration added in v0.0.49

type Calibration struct {
	Min float32 `json:"min" mapstructure:"min"`
	Max float32 `json:"max" mapstructure:"max"`
}

type HASerializable added in v0.0.64

type HASerializable interface {
	Serializable
	HASerialize(hostname string) (string, error)
}

type Loudness added in v0.0.35

type Loudness struct {
	NamedSensor `json:"-"`
	Name        string        `json:"name" mapstructure:"name"`
	Analog      bool          `json:"analog" mapstructure:"analog"`
	Pin         uint8         `json:"pin" mapstructure:"pin"`
	Interval    time.Duration `json:"interval" mapstructure:"interval"`
	Update      *UpdateRate   `json:"update,omitempty" mapstructure:"update,omitempty"`
}

func (*Loudness) GetName added in v0.0.46

func (s *Loudness) GetName() string

type LoudnessSensorData added in v0.0.35

type LoudnessSensorData struct {
	Serializable
	HASerializable
	Processable
	Sensor   *Loudness    `json:"sensor,omitempty"`
	Loudness *SensorValue `json:"loudness,omitempty"`
}

func (*LoudnessSensorData) HASerialize added in v0.0.64

func (s *LoudnessSensorData) HASerialize(hostname string) (string, error)

func (*LoudnessSensorData) Process added in v0.0.53

func (s *LoudnessSensorData) Process(f func(value SensorValue, name string) (err error)) error

func (*LoudnessSensorData) Serialize added in v0.0.62

func (s *LoudnessSensorData) Serialize() (string, error)

func (*LoudnessSensorData) String added in v0.0.35

func (s *LoudnessSensorData) String() string

type LoudnessSensorDataResponse added in v0.0.38

type LoudnessSensorDataResponse struct {
	SensorResponse
	Data []*LoudnessSensorData `json:"data"`
}

type Meta added in v0.0.39

type Meta struct {
	MeasuredAt time.Time `json:"measuredAt"`
}

type NU40C16 added in v0.0.25

type NU40C16 struct {
	NamedSensor `json:"-"`
	Name        string      `json:"name" mapstructure:"name"`
	Pin         uint8       `json:"pin" mapstructure:"pin"`
	Update      *UpdateRate `json:"update,omitempty" mapstructure:"update,omitempty"`
}

func (*NU40C16) GetName added in v0.0.46

func (s *NU40C16) GetName() string

type NU40C16SensorData

type NU40C16SensorData struct {
	Serializable
	Processable
	Sensor   *NU40C16     `json:"sensor,omitempty"`
	Distance *SensorValue `json:"distance,omitempty"`
}

NU40C16SensorData json converter

func (*NU40C16SensorData) HASerialize added in v0.0.64

func (s *NU40C16SensorData) HASerialize(hostname string) (string, error)

func (*NU40C16SensorData) Process added in v0.0.53

func (s *NU40C16SensorData) Process(f func(value SensorValue, name string) (err error)) error

func (*NU40C16SensorData) Serialize added in v0.0.62

func (s *NU40C16SensorData) Serialize() (string, error)

func (*NU40C16SensorData) String added in v0.0.18

func (s *NU40C16SensorData) String() string

type NU40C16SensorDataResponse added in v0.0.38

type NU40C16SensorDataResponse struct {
	SensorResponse
	Data []*NU40C16SensorData `json:"data"`
}

type NamedSensor added in v0.0.46

type NamedSensor interface {
	GetName() string
}

type Processable added in v0.0.52

type Processable interface {
	Process(func(value SensorValue, name string) (err error)) error
}

type SI1145 added in v0.0.25

type SI1145 struct {
	NamedSensor `json:"-"`
	Name        string      `json:"name" mapstructure:"name"`
	Bus         int         `json:"bus" mapstructure:"bus"`
	Update      *UpdateRate `json:"update,omitempty" mapstructure:"update,omitempty"`
}

func (*SI1145) GetName added in v0.0.46

func (s *SI1145) GetName() string

type SI1145SensorData

type SI1145SensorData struct {
	Serializable
	Processable
	Sensor      *SI1145      `json:"sensor,omitempty"`
	Visible     *SensorValue `json:"visible,omitempty"`
	InfraRed    *SensorValue `json:"infraRed,omitempty"`
	UltraViolet *SensorValue `json:"ultraViolet,omitempty"`
}

SI1145SensorData json converter

func (*SI1145SensorData) HASerialize added in v0.0.64

func (s *SI1145SensorData) HASerialize(hostname string) (string, error)

func (*SI1145SensorData) Process added in v0.0.53

func (s *SI1145SensorData) Process(f func(value SensorValue, name string) (err error)) error

func (*SI1145SensorData) Serialize added in v0.0.62

func (s *SI1145SensorData) Serialize() (string, error)

func (*SI1145SensorData) String

func (s *SI1145SensorData) String() string

type SI1145SensorDataResponse added in v0.0.38

type SI1145SensorDataResponse struct {
	SensorResponse
	Data []*SI1145SensorData `json:"data"`
}

type SensorResponse added in v0.0.39

type SensorResponse struct {
	Meta Meta `json:"meta"`
}

type SensorSupport added in v0.0.20

type SensorSupport struct {
	Enabled             bool           `json:"enabled" mapstructure:"enabled"`
	Bme280Support       bool           `json:"bme280Support" mapstructure:"bme280Support"`
	Bme280              []BME280       `json:"bme280" mapstructure:"bme280"`
	Si1145Support       bool           `json:"si1145Support" mapstructure:"si1145Support"`
	Si1145              []SI1145       `json:"si1145" mapstructure:"si1145"`
	Nu40c16Support      bool           `json:"nu40c16Support" mapstructure:"nu40c16Support"`
	Nu40c16             []NU40C16      `json:"nu40c16" mapstructure:"nu40c16"`
	SoilMoistureSupport bool           `json:"soilMoistureSupport" mapstructure:"soilMoistureSupport"`
	SoilMoisture        []SoilMoisture `json:"soilMoisture" mapstructure:"soilMoisture"`
	AirQualitySupport   bool           `json:"airQualitySupport" mapstructure:"airQualitySupport"`
	AirQuality          []AirQuality   `json:"airQuality" mapstructure:"airQuality"`
	LoudnessSupport     bool           `json:"loudnessSupport" mapstructure:"loudnessSupport"`
	Loudness            []Loudness     `json:"loudness" mapstructure:"loudness"`
}

SensorSupport of a service

func (SensorSupport) String added in v0.0.22

func (c SensorSupport) String() string

type SensorType added in v0.0.41

type SensorType int
const (
	SensorType_BMP SensorType = iota
	SensorType_SI1145
	SensorType_NU40C16
	SensorType_SoilMoisture
	SensorType_AirQuality
	SensorType_Loudness
)

type SensorValue

type SensorValue struct {
	Value    float32 `json:"value"`
	Unit     string  `json:"unit"`
	UnitName string  `json:"unitName"`
}

SensorValue is a triple of a float value, unit and a human readable name

func (*SensorValue) String

func (v *SensorValue) String() string

type Serializable added in v0.0.62

type Serializable interface {
	Serialize() (string, error)
}

type SoilMoisture added in v0.0.25

type SoilMoisture struct {
	NamedSensor `json:"-"`
	Name        string        `json:"name" mapstructure:"name"`
	Analog      bool          `json:"analog" mapstructure:"analog"`
	Calibrate   *Calibration  `json:"calibrate,omitempty" mapstructure:"calibrate,omitempty"`
	Pin         uint8         `json:"pin" mapstructure:"pin"`
	Interval    time.Duration `json:"interval" mapstructure:"interval"`
	Update      *UpdateRate   `json:"update,omitempty" mapstructure:"update,omitempty"`
}

func (*SoilMoisture) GetName added in v0.0.46

func (s *SoilMoisture) GetName() string

type SoilMoistureSensorData added in v0.0.19

type SoilMoistureSensorData struct {
	Serializable
	Processable
	Sensor       *SoilMoisture `json:"sensor,omitempty"`
	SoilMoisture *SensorValue  `json:"soilMoisture,omitempty"`
}

SoilMoistureSensorData json converter

func (*SoilMoistureSensorData) HASerialize added in v0.0.64

func (s *SoilMoistureSensorData) HASerialize(hostname string) (string, error)

func (*SoilMoistureSensorData) Process added in v0.0.53

func (s *SoilMoistureSensorData) Process(f func(value SensorValue, name string) (err error)) error

func (*SoilMoistureSensorData) Serialize added in v0.0.62

func (s *SoilMoistureSensorData) Serialize() (string, error)

func (*SoilMoistureSensorData) String added in v0.0.19

func (s *SoilMoistureSensorData) String() string

type SoilMoistureSensorDataResponse added in v0.0.38

type SoilMoistureSensorDataResponse struct {
	SensorResponse
	Data []*SoilMoistureSensorData `json:"data"`
}

type UpdateRate added in v0.0.29

type UpdateRate struct {
	RateMs int `json:"rateMs,omitempty" mapstructure:"rateMs,omitempty"`
}

Jump to

Keyboard shortcuts

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