Help us shape the future of Go! Take the 2026 Go Developer Survey

lutron

package module
v0.0.0-...-c70bbca Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2016 License: MIT Imports: 10 Imported by: 1

README

lutron

A golang based library to scan and control Lutron devices

##Documentation See godoc

##Installation

go get github.com/go-home-iot/lutron

##Package

import "github.com/go-home-iot/lutron"

##Version History ###0.1.0 Initial release, support for Lutron L-BDG-WH Caseta Wireless Smart Bridge

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BtnPressEvt

type BtnPressEvt struct {
	Address       string
	DeviceAddress string
}

BtnPressEvt is fired when a button is pressed, not this is only the press action not also the release, this is not a click

func (BtnPressEvt) String

func (e BtnPressEvt) String() string

type BtnReleaseEvt

type BtnReleaseEvt struct {
	Address       string
	DeviceAddress string
}

BtnReleaseEvt is fired when a button is released

func (BtnReleaseEvt) String

func (e BtnReleaseEvt) String() string

type Device

type Device interface {
	// SetLevel sets the device to the specified level
	SetLevel(level float32, zoneAddress string, w io.Writer) error

	// RequestLevel requests the current level of the specified zone. You will have to
	// watch the devices stream to parse the response that comes back. It is async so
	// it may take time depending on how fast the lutron hub responds
	RequestLevel(zoneAddr string, w io.Writer) error

	// ButtonPress sends a button press command
	ButtonPress(devAddr, btnAddr string, w io.Writer) error

	// ButtonRelease sends a button release command
	ButtonRelease(devAddr, btnAddr string, w io.Writer) error

	// Ping sends a ping request e.g. #PING, callers can then wait for the
	// ping response e.g. ~PING, if nothing returns after a while you know something
	// is wrong with the connection you have to the hub
	Ping(w net.Conn, wait time.Duration) error

	Stream(r io.Reader, handler func(Event)) error
}

Device represents an interface to a Lutron device. Different Lutron devices may send different commands, so this interface is used to abstract that from the callers

func DeviceFromModelNumber

func DeviceFromModelNumber(modelNumber string) (Device, error)

DeviceFromModelNumber returns a Lutron device, based on the modelNumber parameter

type Event

type Event interface {
	fmt.Stringer
}

Event represents an event fired by a device

type UnknownEvt

type UnknownEvt struct {
	Msg string
}

UnknownEvt is an event which we don't parse into a concrete type, can inspect the Msg field

func (UnknownEvt) String

func (e UnknownEvt) String() string

type ZoneLevelEvt

type ZoneLevelEvt struct {
	Address string
	Level   float32
}

ZoneLevelEvt is when the system reports a zones current level

func (ZoneLevelEvt) String

func (e ZoneLevelEvt) String() string

Jump to

Keyboard shortcuts

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