lib.hemtjan.st: lib.hemtjan.st/client Index | Files

package client

import "lib.hemtjan.st/client"

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

Index

Package Files

device.go doc.go feature.go

func DeleteDevice Uses

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

type Device Uses

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

    // 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 Uses

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 Uses

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

Package client imports 4 packages (graph) and is imported by 3 packages. Updated 2019-05-05. Refresh now. Tools for package owners.