homie

package
v0.0.0-...-4c4529c Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DtString = iota
	DtInteger
	DtFloat
	DtBoolean
	DtEnum
	DtColor
)

These are the allow Property data types, as per v4.0.0 convention

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

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

func NewDevice

func NewDevice(id, name string) *Device

func (*Device) Destroy

func (d *Device) Destroy()

to destroy a running device first cancel its context, then wait on its wait channel, then call here

func (*Device) GetName

func (d *Device) GetName() string

func (*Device) IsConnected

func (d *Device) IsConnected() bool

func (*Device) NewNode

func (device *Device) NewNode(id, name, nType string, handler func(d *Device, n *Node, p *Property, a string) bool) *Node

Create and return a node

func (*Device) Run

func (d *Device) Run()

Run the control loop All error conditions return by panic. No normaal return

func (*Device) RunWithContext

func (d *Device) RunWithContext(runContext context.Context, waitChannel chan bool)

func (*Device) SetBroadcastHandler

func (d *Device) SetBroadcastHandler(handler func(d *Device, level, value string))

func (*Device) SetGlobalHandler

func (d *Device) SetGlobalHandler(handler func(d *Device, n *Node, p *Property, value string) bool)

func (*Device) SetLoop

func (d *Device) SetLoop(handler func(d *Device))

func (*Device) SetMqttBroker

func (d *Device) SetMqttBroker(broker string)

func (*Device) SetTopicBase

func (d *Device) SetTopicBase(b string)

type Node

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

func (*Node) Advertise

func (n *Node) Advertise(id, name string, dataType int) *Property

func (Node) Id

func (n Node) Id() string

func (Node) Name

func (n Node) Name() string

func (Node) NodeType

func (n Node) NodeType() string

type Property

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

func (*Property) SetFormat

func (p *Property) SetFormat(format string)

func (*Property) SetProperty

func (p *Property) SetProperty() PropertyMessage

func (*Property) SetUnit

func (p *Property) SetUnit(unit string)

func (*Property) Settable

func (p *Property) Settable(handler func(d *Device, n *Node, p *Property, value string) bool)

type PropertyMessage

type PropertyMessage struct {
	Qos      byte // default value is 1
	Retained bool // default value is true
	// contains filtered or unexported fields
}

func (PropertyMessage) Send

func (m PropertyMessage) Send(value string) error

Returns an error if the property's value is wrong format, unit, or whatever. These errors are warnings only.

Jump to

Keyboard shortcuts

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