device

package
v5.0.0-...-67dc7c3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(id string) error

func From

func From(v *Device) (err error)

func Load

func Load(id string) error

func LoadAll

func LoadAll() error

func Open

func Open(id string) error

func Shutdown

func Shutdown() error

func Startup

func Startup() error

func Table

func Table() *table.Table

func Unload

func Unload(id string) error

Types

type Aggregator

type Aggregator struct {
	aggregator.Aggregator
	As string
}

type Device

type Device struct {
	Id        string `json:"_id" bson:"_id"`
	ProductId string `json:"product_id" bson:"product_id"`
	ProjectId string `json:"project_id,omitempty" bson:"project_id"`
	SpaceId   string `json:"space_id,omitempty" bson:"space_id"`
	Name      string `json:"name"`
	Disabled  bool   `json:"disabled"`
	// contains filtered or unexported fields
}

func Get

func Get(id string) *Device

func (*Device) Action

func (d *Device) Action(name string, values map[string]any) (map[string]any, error)

func (*Device) Close

func (d *Device) Close() error

func (*Device) HandleMqtt

func (d *Device) HandleMqtt(typ string, cl *mqtt.Client, payload []byte)

func (*Device) Open

func (d *Device) Open() error

func (*Device) PatchValues

func (d *Device) PatchValues(values map[string]any)

func (*Device) UnWatchValues

func (d *Device) UnWatchValues(watcher base.DeviceValuesWatcher)

func (*Device) Values

func (d *Device) Values() map[string]any

func (*Device) WatchValues

func (d *Device) WatchValues(watcher base.DeviceValuesWatcher)

func (*Device) WriteHistory

func (d *Device) WriteHistory(history map[string]any, timestamp int64)

func (*Device) WriteValues

func (d *Device) WriteValues(values map[string]any) error

type PayloadActionDown

type PayloadActionDown struct {
	Id         string         `json:"id"`
	Name       string         `json:"name"`
	Parameters map[string]any `json:"parameters,omitempty"`
}

type PayloadActionUp

type PayloadActionUp struct {
	Id     string         `json:"id"`
	Name   string         `json:"name"`
	Result string         `json:"result,omitempty"`
	Return map[string]any `json:"return,omitempty"`
}

type PayloadHistory

type PayloadHistory struct {
	Values    map[string]any `json:"values"`
	Timestamp int64          `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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