devices

package
v0.0.0-...-60b2db8 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Udin   string
	Relay  uint
	Action string
}

func (*Action) String

func (a *Action) String() string

type Device

type Device struct {
	Name    string
	Type    RelayType
	Def     []string
	Enabled bool
	Icon    string
}

func (*Device) Command

func (d *Device) Command(cmd string) (*Action, error)

func (*Device) DiscoveryMessage

func (d *Device) DiscoveryMessage(cfg types.SimpleStringConfig) (*mqtt.Msg, error)

type Devices

type Devices struct {
	// contains filtered or unexported fields
}

func NewDevices

func NewDevices(udins map[string]*udin.UdinDevice) *Devices

func (*Devices) ActionForDevice

func (d *Devices) ActionForDevice(name, cmd string) (*Action, error)

func (*Devices) Create

func (d *Devices) Create(def []string, enabled bool, icon string) (*Device, error)

func (*Devices) Device

func (d *Devices) Device(name string) *Device

func (*Devices) Devices

func (d *Devices) Devices() []*Device

func (*Devices) EnableDisable

func (d *Devices) EnableDisable(name string, val bool)

func (*Devices) Relays

func (d *Devices) Relays() []string

func (*Devices) Types

func (d *Devices) Types() []string

func (*Devices) Update

func (d *Devices) Update(n Device)

type RelayType

type RelayType int
const (
	MomentaryOpenClose RelayType = iota
	UnsupportedRelayType
)

func (RelayType) String

func (r RelayType) String() string

Jump to

Keyboard shortcuts

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