gozwave

package module
v0.0.0-...-597c14a Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

README

gozwave codecov Build Status

An opensource golang lib for zwave-controller communication thru serial-api. Tested and developed with a usb connected AEOTEC Z-Stick Gen5

Sigmadesigns have released some of the zwave documentation and it can be found here http://z-wave.sigmadesigns.com/design-z-wave/z-wave-public-specification/

Can I use this library in production?

This library is in the early development state and is not ready for production in any way. The api is subject to changes and we will probably redesign it a couple of times before its ready.

Contribute

We love any help we can get! If you are interested just fork the lib, make changes and send ous a pull request. We have a slack chat room on https://gophers.slack.com/messages/gozwave/ you can get invite on https://invite.slack.golangbridge.org/

TODO

  • Basic communication between controller and lib (serial-api)
  • Get a list of nodes
  • Identify each node and look them up in a device database
  • Save/Load the identified nodes in a file #4
  • List, get and set parameters in a node
  • Implement commands to send to the nodes (Some implemented)
  • Receive and decode events from sensors

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchByteAt

func MatchByteAt(message []byte, b byte, position int) bool

Types

type Connection

type Connection struct {
	Connected bool

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection() *Connection

func (*Connection) Connect

func (conn *Connection) Connect(connectChan chan error) (err error)

func (*Connection) Reader

func (conn *Connection) Reader() error

func (*Connection) Write

func (conn *Connection) Write(msg interfaces.Encodable) error

func (*Connection) WriteAndWaitForReport

func (conn *Connection) WriteAndWaitForReport(msg interfaces.Encodable, t time.Duration, er byte) (<-chan reports.Report, error)

func (*Connection) WriteWithTimeout

func (conn *Connection) WriteWithTimeout(msg interfaces.Encodable, t time.Duration) (<-chan *serialapi.Message, error)

func (*Connection) Writer

func (conn *Connection) Writer()

type Controllable

type Controllable interface {
	On()
	Off()
	Level(float64)
}

Controllable interface used by nodes and endpoints to controll them

type Controller

type Controller struct {
	Nodes      *nodes.List
	Connection *Connection `json:"-"`

	sync.RWMutex
	// contains filtered or unexported fields
}

func Connect

func Connect(port string, filename string) (*Controller, error)

func ConnectWithCustomPortOpener

func ConnectWithCustomPortOpener(port string, filename string, po PortOpener) (*Controller, error)

func NewController

func NewController() *Controller

func (*Controller) DeliverReportToNode

func (c *Controller) DeliverReportToNode(node byte, report reports.Report)

func (*Controller) GetNextEvent

func (c *Controller) GetNextEvent() chan interface{}

func (*Controller) LoadConfigurationFromFile

func (c *Controller) LoadConfigurationFromFile() error

func (*Controller) SaveConfigurationToFile

func (c *Controller) SaveConfigurationToFile() error

type Event

type Event interface {
}

type PortOpener

type PortOpener interface {
	/* TODO: add methods */
	Open() (io.ReadWriteCloser, error)
}

Jump to

Keyboard shortcuts

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