v0.7.2 Latest Latest

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 4 Imported by: 2



Package client lets your create and announce devices on the MQTT broker.



This section is empty.


This section is empty.


func DeleteDevice

func DeleteDevice(info *device.Info, transport device.Transport) error


type Device

type Device interface {
	// Common contains the common methods for client and server

	// Feature returns the feature with client functions (OnSet(), Update()) available.
	// Fetching a feature that doesn't exist will _NOT_ return nil, but instead create
	// a *feature.Fake. To check if feature actually exists; call Feature("name").Exists()
	Feature(name string) Feature

	// Features returns a slice of all available features
	Features() []Feature

Device in client package is used by applications that are talking to the actual devices, For example an application that's controlling lights over z-wave

func NewDevice

func NewDevice(info *device.Info, transport device.Transport) (Device, error)

NewClient will create a new client device from the device.Info. It spawns off a goroutine that checks for inbound discover-messages and returns meta-data to the announce-topic. The transport is responsible for closing the channel, at that point the goroutine will stop.

type Feature

type Feature interface {
	Name() string
	Min() int
	Max() int
	Step() int
	Exists() bool
	Update(string) error
	OnSet() (chan string, error)
	OnSetFunc(func(string)) error

Jump to

Keyboard shortcuts

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