battery

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Battery

type Battery struct {
	RedisBatteryCharge
	Capacity    float64 // capacity of the battery, in Wh
	MaxDrawRate float64 // maximum charge/discharge rate, in W
}

func (*Battery) Draw

func (v *Battery) Draw(ctx context.Context, power float64, duration time.Duration) (float64, error)

type Collector

type Collector struct {
	health.TimeChecker
	// contains filtered or unexported fields
}

func NewCollector

func NewCollector(redisClient RedisClient, name string, capacity float64, rate float64, logger *slog.Logger) *Collector

func (*Collector) Collect

func (c *Collector) Collect(ch chan<- prometheus.Metric)

func (*Collector) Consume

func (c *Collector) Consume(ctx context.Context, recentMeasurement homewizard.RecentMeasurement)

func (*Collector) Describe

func (c *Collector) Describe(ch chan<- *prometheus.Desc)

type RedisBatteryCharge added in v0.2.4

type RedisBatteryCharge struct {
	RedisClient
	Key string
}

func (*RedisBatteryCharge) Add added in v0.2.4

func (*RedisBatteryCharge) GetCharge added in v0.2.4

func (r *RedisBatteryCharge) GetCharge(ctx context.Context) (float64, error)

type RedisClient added in v0.2.4

type RedisClient interface {
	Get(ctx context.Context, key string) *redis.StringCmd
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
}

Jump to

Keyboard shortcuts

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