sensors

package
v0.0.0-...-2f3587d Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SensorMap = map[string]Sensor{}
)

Functions

This section is empty.

Types

type CmdSensor

type CmdSensor struct {
	Name      string                     `json:"name"`
	Config    configuration.SensorConfig `json:"configuration"`
	MovingAvg float64                    `json:"movingAvg"`
}

func (CmdSensor) GetConfig

func (sensor CmdSensor) GetConfig() configuration.SensorConfig

func (CmdSensor) GetId

func (sensor CmdSensor) GetId() string

func (CmdSensor) GetMovingAvg

func (sensor CmdSensor) GetMovingAvg() (avg float64)

func (CmdSensor) GetValue

func (sensor CmdSensor) GetValue() (float64, error)

func (*CmdSensor) SetMovingAvg

func (sensor *CmdSensor) SetMovingAvg(avg float64)

type FileSensor

type FileSensor struct {
	Config    configuration.SensorConfig `json:"configuration"`
	MovingAvg float64                    `json:"movingAvg"`
}

func (FileSensor) GetConfig

func (sensor FileSensor) GetConfig() configuration.SensorConfig

func (FileSensor) GetId

func (sensor FileSensor) GetId() string

func (FileSensor) GetMovingAvg

func (sensor FileSensor) GetMovingAvg() (avg float64)

func (FileSensor) GetValue

func (sensor FileSensor) GetValue() (float64, error)

func (*FileSensor) SetMovingAvg

func (sensor *FileSensor) SetMovingAvg(avg float64)

type HwmonSensor

type HwmonSensor struct {
	Label     string                     `json:"label"`
	Index     int                        `json:"index"`
	Input     string                     `json:"string"`
	Max       int                        `json:"max"`
	Min       int                        `json:"min"`
	Config    configuration.SensorConfig `json:"configuration"`
	MovingAvg float64                    `json:"movingAvg"`
}

func (HwmonSensor) GetConfig

func (sensor HwmonSensor) GetConfig() configuration.SensorConfig

func (HwmonSensor) GetId

func (sensor HwmonSensor) GetId() string

func (HwmonSensor) GetMovingAvg

func (sensor HwmonSensor) GetMovingAvg() (avg float64)

func (HwmonSensor) GetValue

func (sensor HwmonSensor) GetValue() (result float64, err error)

func (*HwmonSensor) SetMovingAvg

func (sensor *HwmonSensor) SetMovingAvg(avg float64)

type Sensor

type Sensor interface {
	GetId() string

	GetConfig() configuration.SensorConfig

	// GetValue returns the current value of this sensor
	GetValue() (float64, error)

	// GetMovingAvg returns the moving average of this sensor's value
	GetMovingAvg() float64
	SetMovingAvg(avg float64)
}

func NewSensor

func NewSensor(config configuration.SensorConfig) (Sensor, error)

type VirtualSensor

type VirtualSensor struct {
	Name  string  `json:"name"`
	Value float64 `json:"value"`
}

func (VirtualSensor) GetConfig

func (sensor VirtualSensor) GetConfig() configuration.SensorConfig

func (VirtualSensor) GetId

func (sensor VirtualSensor) GetId() string

func (VirtualSensor) GetMovingAvg

func (sensor VirtualSensor) GetMovingAvg() (avg float64)

func (VirtualSensor) GetValue

func (sensor VirtualSensor) GetValue() (float64, error)

func (*VirtualSensor) SetMovingAvg

func (sensor *VirtualSensor) SetMovingAvg(avg float64)

Jump to

Keyboard shortcuts

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