sensor

package
v0.0.0-...-7b92d88 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SensorLabelFn = func(s Sensor) string {
	sensorCounter += 1
	cleanLabel := strings.ReplaceAll(strings.ToLower(fmt.Sprintf("%T_", s)), ".", "_")
	return strings.TrimPrefix(cleanLabel, "*") + strconv.Itoa(sensorCounter)
}

SensorLabelFn returns a unique label for a sensor.

Functions

This section is empty.

Types

type Sensor

type Sensor interface {
	// Stringer is for human-readable name
	fmt.Stringer
	// Label returns unique label value for the sensor.
	// Generally this method should not be defined by user,
	// intstead it will be defined in embedded `*base.Base`
	Label() string
	Template() string
	cluster.Provider
	appconfig.Provider
	devicetree.Applier
}

type Sensors

type Sensors []Sensor

func (*Sensors) UniqueClusters

func (s *Sensors) UniqueClusters() cluster.Clusters

UniqueClusters will return all unique clusters across all the sensors. Clusters might be configured for a specific sensor, so this method is mostly useful to *know* which clusters are available.

func (*Sensors) UnmarshalYAML

func (s *Sensors) UnmarshalYAML(value *yaml.Node) error

type Simple

type Simple struct {
	SensorName       string
	SensorLabel      string
	SensorTemplate   string
	SensorClusters   cluster.Clusters
	SensorAppConfig  []appconfig.ConfigValue
	SensorAppOverlay func(*devicetree.DeviceTree) error
}

func (*Simple) AppConfig

func (s *Simple) AppConfig() []appconfig.ConfigValue

func (*Simple) ApplyOverlay

func (s *Simple) ApplyOverlay(overlay *devicetree.DeviceTree) error

func (*Simple) Clusters

func (s *Simple) Clusters() cluster.Clusters

func (*Simple) Label

func (s *Simple) Label() string

func (*Simple) String

func (s *Simple) String() string

func (*Simple) Template

func (s *Simple) Template() string

type WithExtenders

type WithExtenders interface {
	Extenders() []generator.Extender
}

Jump to

Keyboard shortcuts

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