fake

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fake is a fake PowerSensor for testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	resource.TriviallyValidateConfig
}

Config is used for converting fake movementsensor attributes.

type PowerSensor

type PowerSensor struct {
	resource.Named
	resource.AlwaysRebuild
	// contains filtered or unexported fields
}

PowerSensor implements a fake PowerSensor interface.

func (*PowerSensor) Close

func (f *PowerSensor) Close(ctx context.Context) error

Close closes the fake powersensor.

func (*PowerSensor) Current

func (f *PowerSensor) Current(ctx context.Context, cmd map[string]interface{}) (float64, bool, error)

Current gets the current and isAC of a fake powersensor.

func (*PowerSensor) DoCommand

func (f *PowerSensor) DoCommand(ctx context.Context, cmd map[string]interface{}) (map[string]interface{}, error)

DoCommand uses a map string to run custom functionality of a fake powersensor.

func (*PowerSensor) Power

func (f *PowerSensor) Power(ctx context.Context, cmd map[string]interface{}) (float64, error)

Power gets the power of a fake powersensor.

func (*PowerSensor) Readings

func (f *PowerSensor) Readings(ctx context.Context, extra map[string]interface{}) (map[string]interface{}, error)

Readings gets the readings of a fake powersensor.

func (*PowerSensor) Voltage

func (f *PowerSensor) Voltage(ctx context.Context, cmd map[string]interface{}) (float64, bool, error)

Voltage gets the voltage and isAC of a fake powersensor.

Jump to

Keyboard shortcuts

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