goopenzwave

package module
Version: v0.0.0-...-472b257 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2018 License: MIT Imports: 3 Imported by: 2

README

goopenzwave

Go bindings for the OpenZWave library.

Warning

This package is still fairly new and so the API is changing pretty rapidly, so be careful if you decide to use it. However, the API will try to mimic the C++ OpenZWave library as much as possible, if it doesn't already, so there shouldn't be many breaking changes.

Most of the C++ OpenZWave library is wrapped now, but should you find anything missing please create a new issue or fork it, implement it yourself and submit a pull request.

Installing OpenZWave

This package requires a system installation of OpenZWave. pkg-config is then used during the build of this package to get the open-zwave library and headers.

Note that package managers may install an old version of the library so a manual build/install from source is preferred.

Example install from source:

  1. git clone https://github.com/OpenZWave/open-zwave.git
  2. cd open-zwave
  3. make -j$(nproc)
  4. sudo make install
  5. You may need to call sudo ldconfig now on linux systems
  6. See the open-zwave/INSTALL file for more information

Get the Package

go get github.com/jimjibone/goopenzwave

Example: gominozw

This package comes with a basic example, gominozw, which is a replica of the original C++ OpenZWave MinOZW utility, now written in Go.

It shows how to set up the Manager with various options and listen for Notifications. Once the initial scan of devices is complete, polling for basic values is set up for the devices.

To install and use:

go install github.com/jimjibone/goopenzwave/gominozw
gominozw --controller /dev/ttyYourUSBDevice

Notes

open-zwave build fails with fatal error: libudev.h: No such file or directory on Debian/Ubuntu

Try installing libudev with apt and build again.

apt-get install libudev-dev
cd open-zwave && make
Crashes instantly on macOS 10.12

Do you see something like this when trying to run something with the goopenzwave package?

$ ./gominozw -h
zsh: killed     ./gominozw -h

You should try building with the -ldflags=-s option. E.g.: go build -ldflags=-s. More info at golang/go#19734.

Documentation

Index

Constants

View Source
const (
	LogLevelInvalid      = LogLevel(C.loglevel_invalid)
	LogLevelNone         = LogLevel(C.loglevel_none)
	LogLevelAlways       = LogLevel(C.loglevel_always)
	LogLevelFatal        = LogLevel(C.loglevel_fatal)
	LogLevelError        = LogLevel(C.loglevel_error)
	LogLevelWarning      = LogLevel(C.loglevel_warning)
	LogLevelAlert        = LogLevel(C.loglevel_alert)
	LogLevelInfo         = LogLevel(C.loglevel_info)
	LogLevelDetail       = LogLevel(C.loglevel_detail)
	LogLevelDebug        = LogLevel(C.loglevel_debug)
	LogLevelStreamdetail = LogLevel(C.loglevel_streamdetail)
	LogLevelInternal     = LogLevel(C.loglevel_internal)
)

Variables

This section is empty.

Functions

func ActivateScene

func ActivateScene(sceneID uint8) error

ActivateScene activates a given scene to perform all its actions. Returns an error if the scene was not activated.

func AddAssociation

func AddAssociation(homeID uint32, nodeID uint8, groupIDx uint8, targetNodeID uint8, instance uint8)

AddAssociation adds a node to an association group.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the association data held in this class is updated directly. This will be reverted by a future Association message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func AddDriver

func AddDriver(controllerPath string) error

AddDriver creates a new driver for a Z-Wave controller using the path specified (e.g. "/dev/ttyUSB0"). It returns an error if the controller already exists.

This method creates a Driver object for handling communications with a single Z-Wave controller. In the background, the driver first tries to read configuration data saved during a previous run. It then queries the controller directly for any missing information, and a refresh of the list of nodes that it controls. Once this information has been received, a DriverReady notification callback is sent, containing the Home ID of the controller. This Home ID is required by most of the OpenZWave Manager class methods.

func AddNode

func AddNode(homeID uint32, doSecurity bool) bool

AddNode starts the Inclusion Process to add a Node to the Network. It will return true if the command was sent to the controller successfully.

The Status of the Node Inclusion is communicated via Notifications. Specifically, you should monitor ControllerCommand Notifications.

func AddSceneValueBool

func AddSceneValueBool(sceneID uint8, homeID uint32, valueID uint64, value bool) bool

AddSceneValueBool adds a bool Value ID to an existing scene. Returns true if the Value ID was added.

func AddSceneValueFloat

func AddSceneValueFloat(sceneID uint8, homeID uint32, valueID uint64, value float32) bool

AddSceneValueFloat adds a decimal Value ID to an existing scene. Returns true if the Value ID was added.

func AddSceneValueInt16

func AddSceneValueInt16(sceneID uint8, homeID uint32, valueID uint64, value int16) bool

AddSceneValueInt16 adds a 16-bit signed integer Value ID to an existing scene. Returns true if the Value ID was added.

func AddSceneValueInt32

func AddSceneValueInt32(sceneID uint8, homeID uint32, valueID uint64, value int32) bool

AddSceneValueInt32 adds a 32-bit signed integer Value ID to an existing scene. Returns true if the Value ID was added.

func AddSceneValueListSelectionInt32

func AddSceneValueListSelectionInt32(sceneID uint8, homeID uint32, valueID uint64, value int32) bool

AddSceneValueListSelectionInt32 adds the selected item list Value ID to an existing scene (as a integer). Returns true if the Value ID was added.

func AddSceneValueListSelectionString

func AddSceneValueListSelectionString(sceneID uint8, homeID uint32, valueID uint64, value string) bool

AddSceneValueListSelectionString adds the selected item list Value ID to an existing scene (as a string). Returns true if the Value ID was added.

func AddSceneValueString

func AddSceneValueString(sceneID uint8, homeID uint32, valueID uint64, value string) bool

AddSceneValueString adds a string Value ID to an existing scene. Returns true if the Value ID was added.

func AddSceneValueUint8

func AddSceneValueUint8(sceneID uint8, homeID uint32, valueID uint64, value uint8) bool

AddSceneValueUint8 adds a bool Value ID to an existing scene. Returns true if the Value ID was added.

func AssignReturnRoute

func AssignReturnRoute(homeID uint32, nodeID uint8) bool

AssignReturnRoute will ask a Node to update its update its Return Route to the Controller. It will return true if the command was sent to the controller successfully.

func CancelControllerCommand

func CancelControllerCommand(homeID uint32)

CancelControllerCommand cancels any in-progress command running on a controller.

func ClearSwitchPoints

func ClearSwitchPoints(homeID uint32, valueID uint64)

ClearSwitchPoints clears all switch points from the schedule.

func CreateButton

func CreateButton(homeID uint32, nodeID uint8, buttonID uint8) bool

CreateButton create a handheld button id. It will return true if the command was sent to the controller successfully.

func CreateNewPrimary

func CreateNewPrimary(homeID uint32) bool

CreateNewPrimary will create a new primary controller when old primary fails. Requires SUC. It will return true if the command was sent to the controller successfully.

This command Creates a new Primary Controller when the Old Primary has Failed.

Requires a SUC on the network to function.

func CreateScene

func CreateScene() uint8

CreateScene creates a new Scene and returns the scene ID.

func DeleteAllReturnRoutes

func DeleteAllReturnRoutes(homeID uint32, nodeID uint8) bool

DeleteAllReturnRoutes will ask a Node to delete all Return Routes. It will return true if the command was sent to the controller successfully.

This command will ask a Node to delete all its return routes, and will rediscover when needed.

func DeleteButton

func DeleteButton(homeID uint32, nodeID uint8, buttonID uint8) bool

DeleteButton deletes a handheld button id. It will return true if the command was sent to the controller successfully.

func DestroyOptions

func DestroyOptions() bool

DestroyOptions deletes the Options and cleans up any associated objects. The application is responsible for destroying the Options object, but this must not be done until after the Manager object has been destroyed.

func DisablePoll

func DisablePoll(homeID uint32, valueID uint64) bool

DisablePoll disables the polling of a device's state. Returns true if polling was disabled.

func EnablePoll

func EnablePoll(homeID uint32, valueID uint64, intensity uint8) bool

EnablePoll enables the polling of a device's state. Returns true if polling was enabled.

func GetChangeVerified

func GetChangeVerified(homeID uint32, valueID uint64) bool

GetChangeVerified returns true if value changes upon a refresh should be verified. If so, the library will immediately refresh the value a second time whenever a change is observed. This helps to filter out spurious data reported occasionally by some devices.

func GetControllerNodeID

func GetControllerNodeID(homeID uint32) uint8

GetControllerNodeID returns the node ID of the Z-Wave controller.

func GetControllerPath

func GetControllerPath(homeID uint32) string

GetControllerPath returns a string of the controller interface path.

func GetGroupLabel

func GetGroupLabel(homeID uint32, nodeID uint8, groupIDx uint8) string

GetGroupLabel returns a label for the particular group of a node. This label is populated by the device specific configuration files.

func GetLibraryTypeName

func GetLibraryTypeName(homeID uint32) string

GetLibraryTypeName returns a string containing the Z-Wave API library type used by a controller.

The possible library types are: - Static Controller - Controller - Enhanced Slave - Slave - Installer - Routing Slave - Bridge Controller - Device Under Test

The controller should never return a slave library type. For a more efficient test of whether a controller is a Bridge Controller, use the IsBridgeController method.

func GetLibraryVersion

func GetLibraryVersion(homeID uint32) string

GetLibraryVersion returns a string version of the Z-Wave API library used by a controller.

func GetMaxAssociations

func GetMaxAssociations(homeID uint32, nodeID uint8, groupIDx uint8) uint8

GetMaxAssociations returns the maximum number of associations for a group.

func GetNodeBasicType

func GetNodeBasicType(homeID uint32, nodeID uint8) uint8

GetNodeBasicType returns the basic type of a node.

func GetNodeClassInformation

func GetNodeClassInformation(homeID uint32, nodeID uint8, commandClassID uint8) (bool, string, uint8)

GetNodeClassInformation returns true if the node has the defined class available or not, and the class name and version if available.

func GetNodeDeviceType

func GetNodeDeviceType(homeID uint32, nodeID uint8) uint16

GetNodeDeviceType returns the node device type as reported in the Z-Wave+ Info report.

func GetNodeDeviceTypeString

func GetNodeDeviceTypeString(homeID uint32, nodeID uint8) string

GetNodeDeviceTypeString returns a string of the node device type as reported in the Z-Wave+ Info report.

func GetNodeGenericType

func GetNodeGenericType(homeID uint32, nodeID uint8) uint8

GetNodeGenericType returns the generic type of a node.

func GetNodeLocation

func GetNodeLocation(homeID uint32, nodeID uint8) string

GetNodeLocation returns the location of a node.

The node location is a user-editable string that would normally be handled by the Node Naming commmand class, but many devices do not support it. So that a node can always report its location, OpenZWave stores it with the node data, and provides access through this method and SetNodeLocation, rather than reporting it via a command class Value object.

func GetNodeManufacturerID

func GetNodeManufacturerID(homeID uint32, nodeID uint8) string

GetNodeManufacturerID returns the manufacturer ID of a device.

The manufacturer ID is a four digit hex code and would normally be handled by the Manufacturer Specific commmand class, but not all devices support it. Although the value reported by this method will be an empty string if the command class is not supported and cannot be set by the user, the manufacturer ID is still stored with the node data (rather than being reported via a command class Value object) to retain a consistent approach with the other manufacturer specific data.

func GetNodeManufacturerName

func GetNodeManufacturerName(homeID uint32, nodeID uint8) string

GetNodeManufacturerName returns the manufacturer name of a device.

The manufacturer name would normally be handled by the Manufacturer Specific commmand class, taking the manufacturer ID reported by the device and using it to look up the name from the manufacturer_specific.xml file in the OpenZWave config folder. However, there are some devices that do not support the command class, so to enable the user to manually set the name, it is stored with the node data and accessed via this method rather than being reported via a command class Value object.

func GetNodeMaxBaudRate

func GetNodeMaxBaudRate(homeID uint32, nodeID uint8) uint32

GetNodeMaxBaudRate returns the maximum baud rate of a node's communications.

func GetNodeName

func GetNodeName(homeID uint32, nodeID uint8) string

GetNodeName returns the name of a node.

The node name is a user-editable label for the node that would normally be handled by the Node Naming commmand class, but many devices do not support it. So that a node can always be named, OpenZWave stores it with the node data, and provides access through this method and SetNodeName, rather than reporting it via a command class Value object. The maximum length of a node name is 16 characters.

func GetNodePlusType

func GetNodePlusType(homeID uint32, nodeID uint8) uint8

GetNodePlusType returns the node PlusType as reported in the Z-Wave+ Info report.

func GetNodePlusTypeString

func GetNodePlusTypeString(homeID uint32, nodeID uint8) string

GetNodePlusTypeString returns a string of the node PlusType as reported in the Z-Wave+ Info report.

func GetNodeProductID

func GetNodeProductID(homeID uint32, nodeID uint8) string

GetNodeProductID returns the product ID of a device.

The product ID is a four digit hex code and would normally be handled by the Manufacturer Specific commmand class, but not all devices support it. Although the value reported by this method will be an empty string if the command class is not supported and cannot be set by the user, the product ID is still stored with the node data (rather than being reported via a command class Value object) to retain a consistent approach with the other manufacturer specific data.

func GetNodeProductName

func GetNodeProductName(homeID uint32, nodeID uint8) string

GetNodeProductName returns the product name of a device.

The product name would normally be handled by the Manufacturer Specific commmand class, taking the product Type and ID reported by the device and using it to look up the name from the manufacturer_specific.xml file in the OpenZWave config folder. However, there are some devices that do not support the command class, so to enable the user to manually set the name, it is stored with the node data and accessed via this method rather than being reported via a command class Value object.

func GetNodeProductType

func GetNodeProductType(homeID uint32, nodeID uint8) string

GetNodeProductType returns the product type of a device.

The product type is a four digit hex code and would normally be handled by the Manufacturer Specific commmand class, but not all devices support it. Although the value reported by this method will be an empty string if the command class is not supported and cannot be set by the user, the product type is still stored with the node data (rather than being reported via a command class Value object) to retain a consistent approach with the other manufacturer specific data.

func GetNodeQueryStage

func GetNodeQueryStage(homeID uint32, nodeID uint8) string

GetNodeQueryStage returns the node's query stage as a string.

func GetNodeRole

func GetNodeRole(homeID uint32, nodeID uint8) uint8

GetNodeRole returns the node role as reported in the Z-Wave+ Info report.

func GetNodeRoleString

func GetNodeRoleString(homeID uint32, nodeID uint8) string

GetNodeRoleString returns a string of the node role as reported in the Z-Wave+ Info report.

func GetNodeSecurity

func GetNodeSecurity(homeID uint32, nodeID uint8) uint8

GetNodeSecurity returns the security byte of a node.

func GetNodeSpecificType

func GetNodeSpecificType(homeID uint32, nodeID uint8) uint8

GetNodeSpecificType returns the specific type of a node.

func GetNodeType

func GetNodeType(homeID uint32, nodeID uint8) string

GetNodeType returns a human-readable label describing the node.

The label is taken from the Z-Wave specific, generic or basic type, depending on which of those values are specified by the node.

func GetNodeVersion

func GetNodeVersion(homeID uint32, nodeID uint8) uint8

GetNodeVersion returns the version number of a node.

func GetNumGroups

func GetNumGroups(homeID uint32, nodeID uint8) uint8

GetNumGroups returns the number of association groups reported by this node.

In Z-Wave, groups are numbered starting from one. For example, if a call to GetNumGroups returns 4, the _groupIdx value to use in calls to GetAssociations, AddAssociation and RemoveAssociation will be a number between 1 and 4.

func GetNumScenes

func GetNumScenes() uint8

GetNumScenes returns the number of scenes that have been defined.

func GetNumSwitchPoints

func GetNumSwitchPoints(homeID uint32, valueID uint64) (uint8, error)

GetNumSwitchPoints returns the number of switch points defined in a schedule. It will return zero if the value if not of schedule type.

func GetPollIntensity

func GetPollIntensity(homeID uint32, valueID uint64) uint8

GetPollIntensity returns the polling intensity of a device's state.

func GetPollInterval

func GetPollInterval() int32

GetPollInterval returns the time period between polls of a node's state.

func GetSUCNodeID

func GetSUCNodeID(homeID uint32) uint8

GetSUCNodeID returns the node ID of the Static Update Controller.

func GetSceneLabel

func GetSceneLabel(sceneID uint8) string

GetSceneLabel returns a label for the particular scene.

func GetSceneValueAsBool

func GetSceneValueAsBool(sceneID uint8, homeID uint32, valueID uint64) (bool, error)

GetSceneValueAsBool returns a scene's value as a bool and returns an error if the value was not obtained.

func GetSceneValueAsByte

func GetSceneValueAsByte(sceneID uint8, homeID uint32, valueID uint64) (byte, error)

GetSceneValueAsByte returns a scene's value as a byte and returns an error if the value was not obtained.

func GetSceneValueAsFloat

func GetSceneValueAsFloat(sceneID uint8, homeID uint32, valueID uint64) (float32, error)

GetSceneValueAsFloat returns a scene's value as a float and returns an error if the value was not obtained.

func GetSceneValueAsInt

func GetSceneValueAsInt(sceneID uint8, homeID uint32, valueID uint64) (int32, error)

GetSceneValueAsInt returns a scene's value as a 32-bit signed integer and returns an error if the value was not obtained.

func GetSceneValueAsShort

func GetSceneValueAsShort(sceneID uint8, homeID uint32, valueID uint64) (int16, error)

GetSceneValueAsShort returns a scene's value as a 16-bit signed integer and returns an error if the value was not obtained.

func GetSceneValueAsString

func GetSceneValueAsString(sceneID uint8, homeID uint32, valueID uint64) (string, error)

GetSceneValueAsString returns a scene's value as a string and returns an error if the value was not obtained.

func GetSceneValueListSelectionInt32

func GetSceneValueListSelectionInt32(sceneID uint8, homeID uint32, valueID uint64) (int32, error)

GetSceneValueListSelectionInt32 returns a scene's value list as an integer and returns an error if the value was not obtained.

func GetSceneValueListSelectionString

func GetSceneValueListSelectionString(sceneID uint8, homeID uint32, valueID uint64) (string, error)

GetSceneValueListSelectionString returns a scene's value list as a string and returns an error if the value was not obtained.

func GetSendQueueCount

func GetSendQueueCount(homeID uint32) int32

GetSendQueueCount returns the count of messages in the outgoing send queue.

func GetSwitchPoint

func GetSwitchPoint(homeID uint32, valueID uint64, idx uint8) (uint8, uint8, int8, error)

GetSwitchPoint returns switch point data from the schedule. It will also return an error if the value is not of schedule type.

It retrieves the time and setback values from a switch point in the schedule.

func GetValueAsBool

func GetValueAsBool(homeID uint32, valueID uint64) (bool, error)

GetValueAsBool returns the value as a bool. It will also return an error if the value is not a bool type.

func GetValueAsByte

func GetValueAsByte(homeID uint32, valueID uint64) (byte, error)

GetValueAsByte returns the value as an 8-bit unsigned integer. It will also return an error if the value is not of byte type.

func GetValueAsFloat

func GetValueAsFloat(homeID uint32, valueID uint64) (float32, error)

GetValueAsFloat returns the value as a float. It will also return an error if the value is not a decimal type.

func GetValueAsInt

func GetValueAsInt(homeID uint32, valueID uint64) (int32, error)

GetValueAsInt returns the value as a 32-bit signed integer. It will also return an error if the value is not of 32-bit signed integer type.

func GetValueAsRaw

func GetValueAsRaw(homeID uint32, valueID uint64) ([]byte, error)

GetValueAsRaw returns the value as a raw byte slice. It will also return an error if the value is not of raw type.

func GetValueAsShort

func GetValueAsShort(homeID uint32, valueID uint64) (int16, error)

GetValueAsShort returns the value as a 16-bit signed integer. It will also return an error if the value is not of 16-bit signed integer type.

func GetValueAsString

func GetValueAsString(homeID uint32, valueID uint64) string

GetValueAsString returns the value as a string, regardless of its actual type.

func GetValueFloatPrecision

func GetValueFloatPrecision(homeID uint32, valueID uint64) (uint8, error)

GetValueFloatPrecision returns the float value's precision. It will also return an error if the value is not of decimal type.

func GetValueHelp

func GetValueHelp(homeID uint32, valueID uint64) string

GetValueHelp returns a help string describing the value's purpose and usage.

func GetValueLabel

func GetValueLabel(homeID uint32, valueID uint64) string

GetValueLabel returns the user-friendly label for the value.

func GetValueListItems

func GetValueListItems(homeID uint32, valueID uint64) ([]string, error)

GetValueListItems returns the list of items from a list value. It will also return an error if the value is not of list type.

func GetValueListSelectionAsInt32

func GetValueListSelectionAsInt32(homeID uint32, valueID uint64) (int32, error)

GetValueListSelectionAsInt32 returns selected item from a list as an integer. It will also return an error if the value is not of list type.

func GetValueListSelectionAsString

func GetValueListSelectionAsString(homeID uint32, valueID uint64) (string, error)

GetValueListSelectionAsString returns selected item from a list as a string. It will also return an error if the value is not of list type.

func GetValueMax

func GetValueMax(homeID uint32, valueID uint64) int32

GetValueMax returns the maximum that this value may contain.

func GetValueMin

func GetValueMin(homeID uint32, valueID uint64) int32

GetValueMin returns the minimum that this value may contain.

func GetValueUnits

func GetValueUnits(homeID uint32, valueID uint64) string

GetValueUnits returns the units that the value is measured in.

func GetVersionAsString

func GetVersionAsString() string

GetVersionAsString returns the Version Number of OZW as a string.

func GetVersionLongAsString

func GetVersionLongAsString() string

GetVersionLongAsString returns the Version Number including Git commit of OZW as a string.

func HasNodeFailed

func HasNodeFailed(homeID uint32, nodeID uint8) bool

HasNodeFailed checks if the Controller Believes a Node has Failed. The result is then communicated via a Notification. It will return true if the command was sent to the controller successfully.

This is different from the IsNodeFailed call in that we test the Controllers Failed Node List, whereas the IsNodeFailed is testing our list of Failed Nodes, which might be different. The Results will be communicated via Notifications. Specifically, you should monitor the ControllerCommand notifications.

func HealNetwork

func HealNetwork(homeID uint32, doRR bool)

HealNetwork heals a network by requesting node's rediscover their neighbors.

Sends a ControllerCommand_RequestNodeNeighborUpdate to every node. Can take a while on larger networks.

func HealNetworkNode

func HealNetworkNode(homeID uint32, nodeID uint8, doRR bool)

HealNetworkNode heals a network node by requesting that the node rediscovers their neighbors.

Sends a ControllerCommand_RequestNodeNeighborUpdate to the node.

func IsBridgeController

func IsBridgeController(homeID uint32) bool

IsBridgeController returns true if the controller is using the bridge controller library.

A bridge controller is able to create virtual nodes that can be associated with other controllers to enable events to be passed on.

func IsNodeAwake

func IsNodeAwake(homeID uint32, nodeID uint8) bool

IsNodeAwake returns true if the node is awake, otherwise false if it is asleep.

func IsNodeBeamingDevice

func IsNodeBeamingDevice(homeID uint32, nodeID uint8) bool

IsNodeBeamingDevice returns true if the node is a beam capable device.

func IsNodeFailed

func IsNodeFailed(homeID uint32, nodeID uint8) bool

IsNodeFailed returns true if the node is working, otherwise false if it has failed.

func IsNodeFrequentListeningDevice

func IsNodeFrequentListeningDevice(homeID uint32, nodeID uint8) bool

IsNodeFrequentListeningDevice returns true if the node is a frequent listening device that goes to sleep but can be woken up by a beam. Useful to determine node and controller consistency.

func IsNodeInfoReceived

func IsNodeInfoReceived(homeID uint32, nodeID uint8) bool

IsNodeInfoReceived returns whether the node information has been received.

func IsNodeListeningDevice

func IsNodeListeningDevice(homeID uint32, nodeID uint8) bool

IsNodeListeningDevice returns true if the node is a listening device that does not go to sleep.

func IsNodeRoutingDevice

func IsNodeRoutingDevice(homeID uint32, nodeID uint8) bool

IsNodeRoutingDevice returns true if the node is a routing device that passes messages to other nodes.

func IsNodeSecurityDevice

func IsNodeSecurityDevice(homeID uint32, nodeID uint8) bool

IsNodeSecurityDevice returns true if the node supports security features.

func IsNodeZWavePlus

func IsNodeZWavePlus(homeID uint32, nodeID uint8) bool

IsNodeZWavePlus returns true if this a ZWave+ Supported Node.

func IsPolled

func IsPolled(homeID uint32, valueID uint64) bool

IsPolled returns true if the device's state is being polled.

func IsPrimaryController

func IsPrimaryController(homeID uint32) bool

IsPrimaryController returns true if the controller is a primary controller.

The primary controller is the main device used to configure and control a Z-Wave network. There can only be one primary controller - all other controllers are secondary controllers.

func IsStaticUpdateController

func IsStaticUpdateController(homeID uint32) bool

IsStaticUpdateController returns true if the controller is a static update controller.

A Static Update Controller (SUC) is a controller that must never be moved in normal operation and which can be used by other nodes to receive information about network changes.

func IsValuePolled

func IsValuePolled(homeID uint32, valueID uint64) bool

IsValuePolled returns true if the value is currently being polled.

func IsValueReadOnly

func IsValueReadOnly(homeID uint32, valueID uint64) bool

IsValueReadOnly returns true if the value is read-only.

func IsValueSet

func IsValueSet(homeID uint32, valueID uint64) bool

IsValueSet returns true if the value has been set.

func IsValueWriteOnly

func IsValueWriteOnly(homeID uint32, valueID uint64) bool

IsValueWriteOnly returns true if the value is write-only.

func LogDriverStatistics

func LogDriverStatistics(homeID uint32)

LogDriverStatistics will send the current driver statistics to the log file.

func PressButton

func PressButton(homeID uint32, valueID uint64) error

PressButton starts an activity in a device. It will return an error if the value is not of button type.

Since buttons are write-only values that do not report a state, no notification callbacks are sent.

func ReceiveConfiguration

func ReceiveConfiguration(homeID uint32) bool

ReceiveConfiguration will receive network configuration information from the primary controller. Requires secondary. This command prepares the controller to recieve Network Configuration from a Secondary Controller. It will return true if the command was sent to the controller successfully.

func RefreshNodeInfo

func RefreshNodeInfo(homeID uint32, nodeID uint8) bool

RefreshNodeInfo triggers the fetching of fixed data about a node. Returns true if the request was sent successfully.

Causes the node's data to be obtained from the Z-Wave network in the same way as if it had just been added. This method would normally be called automatically by OpenZWave, but if you know that a node has been changed, calling this method will force a refresh of all of the data held by the library. This can be especially useful for devices that were asleep when the application was first run. This is the same as the query state starting from the beginning.

func RefreshValue

func RefreshValue(homeID uint32, valueID uint64) bool

RefreshValue refreshes the specified value from the Z-Wave network. It will return true if the driver and node were found, otherwise false.

A call to this function causes the library to send a message to the network to retrieve the current value of the specified ValueID (just like a poll, except only one-time, not recurring).

func ReleaseButton

func ReleaseButton(homeID uint32, valueID uint64) error

ReleaseButton stops an activity in a device. It will return an error if the value is not of button type.

Since buttons are write-only values that do not report a state, no notification callbacks are sent.

func RemoveAllScenes

func RemoveAllScenes(homeID uint32)

RemoveAllScenes removes all the SceneIds.

func RemoveAssociation

func RemoveAssociation(homeID uint32, nodeID uint8, groupIDx uint8, targetNodeID uint8, instance uint8)

RemoveAssociation removes a node from an association group.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the association data held in this class is updated directly. This will be reverted by a future Association message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func RemoveDriver

func RemoveDriver(controllerPath string) error

RemoveDriver removes the driver for a Z-Wave controller as specified, and closes the controller. It returns an error if the controller could not be found.

Drivers do not need to be explicitly removed before calling Destroy - this is handled automatically.

func RemoveFailedNode

func RemoveFailedNode(homeID uint32, nodeID uint8) bool

RemoveFailedNode removes a Failed Device from the Z-Wave Network. It will return true if the command was sent to the controller successfully.

This Command will remove a failed node from the network. The Node should be on the Controllers Failed Node List, otherwise this command will fail. You can use the HasNodeFailed function below to test if the Controller believes the Node has Failed. The Status of the Node Removal is communicated via Notifications. Specifically, you should monitor ControllerCommand Notifications.

func RemoveNode

func RemoveNode(homeID uint32) bool

RemoveNode removes a Device from the Z-Wave Network. It will return true if the command was sent to the controller successfully.

The Status of the Node Removal is communicated via Notifications. Specifically, you should monitor ControllerCommand Notifications.

func RemoveScene

func RemoveScene(sceneID uint8) bool

RemoveScene removes an existing Scene. Returns true if the scene was removed.

func RemoveSwitchPoint

func RemoveSwitchPoint(homeID uint32, valueID uint64, hours, minutes uint8) error

RemoveSwitchPoint removes a switch point from the schedule. It will return an error if the value is not of schedule type or there is no switch point with the specified time values.

func ReplaceFailedNode

func ReplaceFailedNode(homeID uint32, nodeID uint8) bool

ReplaceFailedNode will replace a failed device with another. If the node is not in the controller's failed nodes list, or the node responds, this command will fail. You can check if a Node is in the Controllers Failed node list by using the HasNodeFailed method. It will return true if the command was sent to the controller successfully.

func ReplicationSend

func ReplicationSend(homeID uint32, nodeID uint8) bool

ReplicationSend sends information from primary to secondary. It will return true if the command was sent to the controller successfully.

func RequestNetworkUpdate

func RequestNetworkUpdate(homeID uint32, nodeID uint8) bool

RequestNetworkUpdate updates the controller with network information from the SUC/SIS. It will return true if the command was sent to the controller successfully.

func RequestNodeAllConfigParam

func RequestNodeAllConfigParam(homeID uint32, nodeID uint8)

RequestNodeAllConfigParam requests the values of all known configurable parameters from a device.

func RequestNodeConfigParam

func RequestNodeConfigParam(homeID uint32, nodeID uint8, param uint8)

RequestNodeConfigParam requests the value of a configurable parameter from a device.

Some devices have various parameters that can be configured to control the device behaviour. These are not reported by the device over the Z-Wave network, but can usually be found in the device's user manual. This method requests the value of a parameter from the device, and then returns immediately, without waiting for a response. If the parameter index is valid for this device, and the device is awake, the value will eventually be reported via a ValueChanged notification callback. The ValueID reported in the callback will have an index set the same as _param and a command class set to the same value as returned by a call to Configuration::StaticGetCommandClassId.

func RequestNodeDynamic

func RequestNodeDynamic(homeID uint32, nodeID uint8) bool

RequestNodeDynamic triggers the fetching of just the dynamic value data for a node. Returns true if the request was sent successfully.

Causes the node's values to be requested from the Z-Wave network. This is the same as the query state starting from the dynamic state.

func RequestNodeNeighborUpdate

func RequestNodeNeighborUpdate(homeID uint32, nodeID uint8) bool

RequestNodeNeighborUpdate will ask a Node to update its Neighbor Tables. It will return true if the command was sent to the controller successfully.

This command will ask a Node to update its Neighbor Tables.

func RequestNodeState

func RequestNodeState(homeID uint32, nodeID uint8) bool

RequestNodeState triggers the fetching of dynamic value data for a node. Returns true if the request was sent successfully.

Causes the node's values to be requested from the Z-Wave network. This is the same as the query state starting from the associations state.

func ResetController

func ResetController(homeID uint32)

ResetController performs a hard reset on a PC Z-Wave Controller.

Resets a controller and erases its network configuration settings. The controller becomes a primary controller ready to add devices to a new network.

func SceneExists

func SceneExists(sceneID uint8) bool

SceneExists returns true if a Scene ID is defined.

func SendNodeInformation

func SendNodeInformation(homeID uint32, nodeID uint8) bool

SendNodeInformation sends a NIF frame from the Controller to a Node. It will return true if the command was sent to the controller successfully.

This command send a NIF frame from the Controller to a Node.

func SetChangeVerified

func SetChangeVerified(homeID uint32, valueID uint64, verify bool)

SetChangeVerified sets a flag indicating whether value changes noted upon a refresh should be verified. If so, the library will immediately refresh the value a second time whenever a change is observed. This helps to filter out spurious data reported occasionally by some devices.

func SetNodeConfigParam

func SetNodeConfigParam(homeID uint32, nodeID uint8, param uint8, value int32, size uint8) bool

SetNodeConfigParam sets the value of a configurable parameter in a device. Returns true if the message setting was sent to the device.

Some devices have various parameters that can be configured to control the device behaviour. These are not reported by the device over the Z-Wave network, but can usually be found in the device's user manual. This method returns immediately, without waiting for confirmation from the device that the change has been made.

func SetNodeLevel

func SetNodeLevel(homeID uint32, nodeID uint8, level uint8)

SetNodeLevel sets the basic level of a node.

This is a helper method to simplify basic control of a node. It is the equivalent of changing the value reported by the node's Basic command class and will generate a ValueChanged notification from that class.

func SetNodeLocation

func SetNodeLocation(homeID uint32, nodeID uint8, location string)

SetNodeLocation sets the location of a node.

The node location is a user-editable string that would normally be handled by the Node Naming commmand class, but many devices do not support it. So that a node can always report its location, OpenZWave stores it with the node data, and provides access through this method and GetNodeLocation, rather than reporting it via a command class Value object. If the device does support the Node Naming command class, the new location will be sent to the node.

func SetNodeManufacturerName

func SetNodeManufacturerName(homeID uint32, nodeID uint8, manufacturerName string)

SetNodeManufacturerName sets the manufacturer name of a device.

The manufacturer name would normally be handled by the Manufacturer Specific commmand class, taking the manufacturer ID reported by the device and using it to look up the name from the manufacturer_specific.xml file in the OpenZWave config folder. However, there are some devices that do not support the command class, so to enable the user to manually set the name, it is stored with the node data and accessed via this method rather than being reported via a command class Value object.

func SetNodeName

func SetNodeName(homeID uint32, nodeID uint8, nodeName string)

SetNodeName sets the name of a node.

The node name is a user-editable label for the node that would normally be handled by the Node Naming commmand class, but many devices do not support it. So that a node can always be named, OpenZWave stores it with the node data, and provides access through this method and GetNodeName, rather than reporting it via a command class Value object. If the device does support the Node Naming command class, the new name will be sent to the node. The maximum length of a node name is 16 characters.

func SetNodeOff

func SetNodeOff(homeID uint32, nodeID uint8)

SetNodeOff turns a node off.

This is a helper method to simplify basic control of a node. It is the equivalent of changing the level reported by the node's Basic command class to zero, and will generate a ValueChanged notification from that class.

func SetNodeOn

func SetNodeOn(homeID uint32, nodeID uint8)

SetNodeOn turns a node on.

This is a helper method to simplify basic control of a node. It is the equivalent of changing the level reported by the node's Basic command class to 255, and will generate a ValueChanged notification from that class. This command will turn on the device at its last known level, if supported by the device, otherwise it will turn it on at 100%.

func SetNodeProductName

func SetNodeProductName(homeID uint32, nodeID uint8, productName string)

SetNodeProductName sets the product name of a device.

The product name would normally be handled by the Manufacturer Specific commmand class, taking the product Type and ID reported by the device and using it to look up the name from the manufacturer_specific.xml file in the OpenZWave config folder. However, there are some devices that do not support the command class, so to enable the user to manually set the name, it is stored with the node data and accessed via this method rather than being reported via a command class Value object.

func SetPollIntensity

func SetPollIntensity(homeID uint32, valueID uint64, intensity uint8)

SetPollIntensity sets the frequency of polling.

- 0 = none
- 1 = every time through the list
- 2 = every other time
- etc.

func SetPollInterval

func SetPollInterval(milliseconds int32, intervalBetweenPolls bool)

SetPollInterval will set the time period between polls of a node's state.

Due to patent concerns, some devices do not report state changes automatically to the controller. These devices need to have their state polled at regular intervals. The length of the interval is the same for all devices. To even out the Z-Wave network traffic generated by polling, OpenZWave divides the polling interval by the number of devices that have polling enabled, and polls each in turn. It is recommended that if possible, the interval should not be set shorter than the number of polled devices in seconds (so that the network does not have to cope with more than one poll per second).

func SetSceneLabel

func SetSceneLabel(sceneID uint8, value string)

SetSceneLabel sets a label for the particular scene.

func SetSceneValueBool

func SetSceneValueBool(sceneID uint8, homeID uint32, valueID uint64, value bool) error

SetSceneValueBool sets a bool Value ID to an existing scene's ValueID. Returns an error if the Value ID was not added.

func SetSceneValueFloat

func SetSceneValueFloat(sceneID uint8, homeID uint32, valueID uint64, value float32) error

SetSceneValueFloat sets a decimal Value ID to an existing scene's ValueID. Returns an error if the Value ID was not added.

func SetSceneValueInt16

func SetSceneValueInt16(sceneID uint8, homeID uint32, valueID uint64, value int16) error

SetSceneValueInt16 sets a 16-bit integer Value ID to an existing scene's ValueID. Returns an error if the Value ID was not added.

func SetSceneValueInt32

func SetSceneValueInt32(sceneID uint8, homeID uint32, valueID uint64, value int32) error

SetSceneValueInt32 sets a 32-bit signed integer Value ID to an existing scene's ValueID. Returns an error if the Value ID was not added.

func SetSceneValueListSelectionInt32

func SetSceneValueListSelectionInt32(sceneID uint8, homeID uint32, valueID uint64, value int32) error

SetSceneValueListSelectionInt32 sets the list selected item Value ID to an existing scene's ValueID (as a integer). Returns an error if the Value ID was not added.

func SetSceneValueListSelectionString

func SetSceneValueListSelectionString(sceneID uint8, homeID uint32, valueID uint64, value string) error

SetSceneValueListSelectionString sets the list selected item Value ID to an existing scene's ValueID (as a string). Returns an error if the Value ID was not added.

func SetSceneValueString

func SetSceneValueString(sceneID uint8, homeID uint32, valueID uint64, value string) error

SetSceneValueString sets a string Value ID to an existing scene's ValueID. Returns an error if the Value ID was not added.

func SetSceneValueUint8

func SetSceneValueUint8(sceneID uint8, homeID uint32, valueID uint64, value uint8) error

SetSceneValueUint8 sets a byte Value ID to an existing scene's ValueID. Returns an error if the Value ID was not added.

func SetSwitchPoint

func SetSwitchPoint(homeID uint32, valueID uint64, hours, minutes uint8, setback int8) error

SetSwitchPoint sets a switch point in the schedule. It will return an error if the value is not of schedule type.

Inserts a new switch point into the schedule, unless a switch point already exists at the specified time in which case that switch point is updated with the new setback value instead. A maximum of nine switch points can be set in the schedule.

func SetValueBool

func SetValueBool(homeID uint32, valueID uint64, value bool) error

SetValueBool sets the state of a bool. It will return an error if the value is not of bool type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func SetValueBytes

func SetValueBytes(homeID uint32, valueID uint64, value []byte) error

SetValueBytes sets the value of a raw value. It will return an error if the value is not of raw type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func SetValueFloat

func SetValueFloat(homeID uint32, valueID uint64, value float32) error

SetValueFloat sets the value of a decimal. It will return an error if the value is not of decimal type.

It is usually better to handle decimal values using strings rather than floats, to avoid floating point accuracy issues. Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func SetValueHelp

func SetValueHelp(homeID uint32, valueID uint64, value string)

SetValueHelp sets a help string describing the value's purpose and usage.

func SetValueInt16

func SetValueInt16(homeID uint32, valueID uint64, value int16) error

SetValueInt16 sets the value of a 16-bit signed integer. It will return an error if the value is not of 16-bit signed integer type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func SetValueInt32

func SetValueInt32(homeID uint32, valueID uint64, value int32) error

SetValueInt32 sets the value of a 32-bit signed integer. It will return an error if the value is not of 32-bit signed integer type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func SetValueLabel

func SetValueLabel(homeID uint32, valueID uint64, value string)

SetValueLabel sets the user-friendly label for the value.

func SetValueListSelection

func SetValueListSelection(homeID uint32, valueID uint64, selection string) error

SetValueListSelection sets the selected item in a list. It will return an error if the value is not of list type or if the selection is not in the list.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func SetValueString

func SetValueString(homeID uint32, valueID uint64, value string) error

SetValueString sets the value from a string, regardless of type. It will return an error if the value could not be parsed into the correct type for the value.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func SetValueUint8

func SetValueUint8(homeID uint32, valueID uint64, value uint8) error

SetValueUint8 sets the value of a byte. It will return an error if the value is not of byte type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func SetValueUnits

func SetValueUnits(homeID uint32, valueID uint64, value string)

SetValueUnits sets the units that the value is measured in.

func SoftReset

func SoftReset(homeID uint32)

SoftReset performs a soft reset on a PC Z-Wave Controller.

Resets a controller without erasing its network configuration settings.

func Start

func Start(handler NotificationHandler) error

Start will create a new OpenZWave Manager, starting the library execution. The OpenZWave Options must be created and locked before calling this. See the Options struct. Also pass a NotificationHandler function to this as notifications will also be started.

func Stop

func Stop() error

Stop will stop notifications and destroy the manager. Do this just before you quit your app. Don't forget to destroy the Options object after calling this.

func SwitchAllOff

func SwitchAllOff(homeID uint32)

SwitchAllOff Switch all devices off. All devices that support the SwitchAll command class will be turned off.

func SwitchAllOn

func SwitchAllOn(homeID uint32)

SwitchAllOn Switch all devices on. All devices that support the SwitchAll command class will be turned on.

func TestNetwork

func TestNetwork(homeID uint32, count uint32)

TestNetwork tests the network.

Sends a series of messages to every node on the network for testing network reliability.

func TestNetworkNode

func TestNetworkNode(homeID uint32, nodeID uint8, count uint32)

TestNetworkNode tests the network node.

Sends a series of messages to a network node for testing network reliability.

func TransferPrimaryRole

func TransferPrimaryRole(homeID uint32) bool

TransferPrimaryRole adds a new controller to the network and make it the primary. The existing primary will become a secondary controller. It will return true if the command was sent to the controller successfully.

func WriteConfig

func WriteConfig(homeID uint32)

WriteConfig saves the Z-Wave network configuration. This is so that the entire network does not need to be polled every time the application starts.

Types

type LogLevel

type LogLevel int32

type Node

type Node struct {
	HomeID uint32
	NodeID uint8
}

Node contains all necessary information for a Node from the OpenZWave library. Create a new Node by using the `NewNode` function with the HomeID and NodeID as supplied from a Notification.

func NewNode

func NewNode(homeID uint32, nodeID uint8) *Node

NewNode will create a new Node object filled with the data available from the Manager based on the homeID and nodeID.

func (*Node) GetBasicType

func (n *Node) GetBasicType() uint8

GetBasicType Get the basic type of a node.

func (*Node) GetClassInformation

func (n *Node) GetClassInformation(commandClassID uint8) (bool, string, uint8)

GetClassInformation Get whether the node has the defined class available or not.

func (*Node) GetDeviceType

func (n *Node) GetDeviceType() uint16

GetDeviceType Get the node device type as reported in the Z-Wave+ Info report.

func (*Node) GetDeviceTypeString

func (n *Node) GetDeviceTypeString() string

GetDeviceTypeString Get the node device type as reported in the Z-Wave+ Info report.

func (*Node) GetGenericType

func (n *Node) GetGenericType() uint8

GetGenericType Get the generic type of a node.

func (*Node) GetLocation

func (n *Node) GetLocation() string

GetLocation Get the location of a node The node location is a user-editable string that would normally be handled by the Node Naming commmand class, but many devices do not support it. So that a node can always report its location, OpenZWave stores it with the node data, and provides access through this method and SetNodeLocation, rather than reporting it via a command class Value object.

func (*Node) GetManufacturerID

func (n *Node) GetManufacturerID() string

GetManufacturerID Get the manufacturer ID of a device The manufacturer ID is a four digit hex code and would normally be handled by the Manufacturer Specific commmand class, but not all devices support it. Although the value reported by this method will be an empty string if the command class is not supported and cannot be set by the user, the manufacturer ID is still stored with the node data (rather than being reported via a command class Value object) to retain a consistent approach with the other manufacturer specific data.

func (*Node) GetManufacturerName

func (n *Node) GetManufacturerName() string

GetManufacturerName Get the manufacturer name of a device The manufacturer name would normally be handled by the Manufacturer Specific commmand class, taking the manufacturer ID reported by the device and using it to look up the name from the manufacturer_specific.xml file in the OpenZWave config folder. However, there are some devices that do not support the command class, so to enable the user to manually set the name, it is stored with the node data and accessed via this method rather than being reported via a command class Value object.

func (*Node) GetMaxBaudRate

func (n *Node) GetMaxBaudRate() uint32

GetMaxBaudRate Get the maximum baud rate of a node's communications.

func (*Node) GetName

func (n *Node) GetName() string

GetName Get the name of a node The node name is a user-editable label for the node that would normally be handled by the Node Naming commmand class, but many devices do not support it. So that a node can always be named, OpenZWave stores it with the node data, and provides access through this method and SetNodeName, rather than reporting it via a command class Value object. The maximum length of a node name is 16 characters.

func (*Node) GetPlusType

func (n *Node) GetPlusType() uint8

GetPlusType Get the node PlusType as reported in the Z-Wave+ Info report.

func (*Node) GetPlusTypeString

func (n *Node) GetPlusTypeString() string

GetPlusTypeString Get the node PlusType as reported in the Z-Wave+ Info report.

func (*Node) GetProductID

func (n *Node) GetProductID() string

GetProductID Get the product ID of a device The product ID is a four digit hex code and would normally be handled by the Manufacturer Specific commmand class, but not all devices support it. Although the value reported by this method will be an empty string if the command class is not supported and cannot be set by the user, the product ID is still stored with the node data (rather than being reported via a command class Value object) to retain a consistent approach with the other manufacturer specific data.

func (*Node) GetProductName

func (n *Node) GetProductName() string

GetProductName Get the product name of a device The product name would normally be handled by the Manufacturer Specific commmand class, taking the product Type and ID reported by the device and using it to look up the name from the manufacturer_specific.xml file in the OpenZWave config folder. However, there are some devices that do not support the command class, so to enable the user to manually set the name, it is stored with the node data and accessed via this method rather than being reported via a command class Value object.

func (*Node) GetProductType

func (n *Node) GetProductType() string

GetProductType Get the product type of a device The product type is a four digit hex code and would normally be handled by the Manufacturer Specific commmand class, but not all devices support it. Although the value reported by this method will be an empty string if the command class is not supported and cannot be set by the user, the product type is still stored with the node data (rather than being reported via a command class Value object) to retain a consistent approach with the other manufacturer specific data.

func (*Node) GetQueryStage

func (n *Node) GetQueryStage() string

GetQueryStage Get whether the node's query stage as a string.

func (*Node) GetRole

func (n *Node) GetRole() uint8

GetRole Get the node device type as reported in the Z-Wave+ Info report.

func (*Node) GetRoleString

func (n *Node) GetRoleString() string

GetRoleString Get the node role as reported in the Z-Wave+ Info report.

func (*Node) GetSecurity

func (n *Node) GetSecurity() uint8

GetSecurity Get the security byte of a node.

func (*Node) GetSpecificType

func (n *Node) GetSpecificType() uint8

GetSpecificType Get the specific type of a node.

func (*Node) GetType

func (n *Node) GetType() string

GetType Get a human-readable label describing the node The label is taken from the Z-Wave specific, generic or basic type, depending on which of those values are specified by the node.

func (*Node) GetVersion

func (n *Node) GetVersion() uint8

GetVersion Get the version number of a node.

func (*Node) IsAwake

func (n *Node) IsAwake() bool

IsAwake Get whether the node is awake or asleep.

func (*Node) IsBeamingDevice

func (n *Node) IsBeamingDevice() bool

IsBeamingDevice Get whether the node is a beam capable device.

func (*Node) IsFailed

func (n *Node) IsFailed() bool

IsFailed Get whether the node is working or has failed.

func (*Node) IsFrequentListeningDevice

func (n *Node) IsFrequentListeningDevice() bool

IsFrequentListeningDevice Get whether the node is a frequent listening device that goes to sleep but can be woken up by a beam. Useful to determine node and controller consistency.

func (*Node) IsInfoReceived

func (n *Node) IsInfoReceived() bool

IsInfoReceived Get whether the node information has been received.

func (*Node) IsListeningDevice

func (n *Node) IsListeningDevice() bool

IsListeningDevice Get whether the node is a listening device that does not go to sleep.

func (*Node) IsRoutingDevice

func (n *Node) IsRoutingDevice() bool

IsRoutingDevice Get whether the node is a routing device that passes messages to other nodes.

func (*Node) IsSecurityDevice

func (n *Node) IsSecurityDevice() bool

IsSecurityDevice Get the security attribute for a node. True if node supports security features.

func (*Node) IsZWavePlus

func (n *Node) IsZWavePlus() bool

IsZWavePlus Is this a ZWave+ Supported Node?

func (*Node) RefeshInfo

func (n *Node) RefeshInfo() bool

RefeshInfo Trigger the fetching of fixed data about a node. Causes the node's data to be obtained from the Z-Wave network in the same way as if it had just been added. This method would normally be called automatically by OpenZWave, but if you know that a node has been changed, calling this method will force a refresh of all of the data held by the library. This can be especially useful for devices that were asleep when the application was first run. This is the same as the query state starting from the beginning.

func (*Node) RequestDynamic

func (n *Node) RequestDynamic() bool

RequestDynamic Trigger the fetching of just the dynamic value data for a node. Causes the node's values to be requested from the Z-Wave network. This is the same as the query state starting from the dynamic state.

func (*Node) RequestState

func (n *Node) RequestState() bool

RequestState Trigger the fetching of dynamic value data for a node. Causes the node's values to be requested from the Z-Wave network. This is the same as the query state starting from the associations state.

func (*Node) SetLevel

func (n *Node) SetLevel(level uint8)

SetLevel Sets the basic level of a node This is a helper method to simplify basic control of a node. It is the equivalent of changing the value reported by the node's Basic command class and will generate a ValueChanged notification from that class.

func (*Node) SetLocation

func (n *Node) SetLocation(location string)

SetLocation Set the location of a node The node location is a user-editable string that would normally be handled by the Node Naming commmand class, but many devices do not support it. So that a node can always report its location, OpenZWave stores it with the node data, and provides access through this method and GetNodeLocation, rather than reporting it via a command class Value object. If the device does support the Node Naming command class, the new location will be sent to the node.

func (*Node) SetManufacturerName

func (n *Node) SetManufacturerName(name string)

SetManufacturerName Set the manufacturer name of a device The manufacturer name would normally be handled by the Manufacturer Specific commmand class, taking the manufacturer ID reported by the device and using it to look up the name from the manufacturer_specific.xml file in the OpenZWave config folder. However, there are some devices that do not support the command class, so to enable the user to manually set the name, it is stored with the node data and accessed via this method rather than being reported via a command class Value object.

func (*Node) SetName

func (n *Node) SetName(name string)

SetName Set the name of a node The node name is a user-editable label for the node that would normally be handled by the Node Naming commmand class, but many devices do not support it. So that a node can always be named, OpenZWave stores it with the node data, and provides access through this method and GetNodeName, rather than reporting it via a command class Value object. If the device does support the Node Naming command class, the new name will be sent to the node. The maximum length of a node name is 16 characters.

func (*Node) SetOff

func (n *Node) SetOff()

SetOff Turns a node off This is a helper method to simplify basic control of a node. It is the equivalent of changing the level reported by the node's Basic command class to zero, and will generate a ValueChanged notification from that class.

func (*Node) SetOn

func (n *Node) SetOn()

SetOn Turns a node on This is a helper method to simplify basic control of a node. It is the equivalent of changing the level reported by the node's Basic command class to 255, and will generate a ValueChanged notification from that class. This command will turn on the device at its last known level, if supported by the device, otherwise it will turn it on at 100%.

func (*Node) SetProductName

func (n *Node) SetProductName(name string)

SetProductName Set the product name of a device The product name would normally be handled by the Manufacturer Specific commmand class, taking the product Type and ID reported by the device and using it to look up the name from the manufacturer_specific.xml file in the OpenZWave config folder. However, there are some devices that do not support the command class, so to enable the user to manually set the name, it is stored with the node data and accessed via this method rather than being reported via a command class Value object.

func (*Node) String

func (n *Node) String() string

String will return a string containing some useful information about the Node.

type Notification

type Notification struct {
	Type         NotificationType
	HomeID       uint32
	NodeID       uint8
	ValueID      *ValueID
	GroupIDX     *uint8
	Event        *uint8
	ButtonID     *uint8
	SceneID      *uint8
	Notification *NotificationCode
}

Notification is a container for the C++ OpenZWave library Notification class.

func (*Notification) String

func (n *Notification) String() string

type NotificationCode

type NotificationCode int

NotificationCode defines a type for the notification code enum.

const (
	NotificationCodeMsgComplete NotificationCode = iota // C.notification_code_msgComplete
	NotificationCodeTimeout                             // C.notification_code_timeout
	NotificationCodeNoOperation                         // C.notification_code_noOperation
	NotificationCodeAwake                               // C.notification_code_awake
	NotificationCodeSleep                               // C.notification_code_sleep
	NotificationCodeDead                                // C.notification_code_dead
	NotificationCodeAlive                               // C.notification_code_alive
)

func (NotificationCode) String

func (nc NotificationCode) String() string

type NotificationHandler

type NotificationHandler func(notification *Notification)

NotificationHandler defines the format for a function that will handle new Notification's as they arrive.

type NotificationType

type NotificationType int

NotificationType defines a type for the notification type enum.

const (
	NotificationTypeValueAdded NotificationType = iota
	NotificationTypeValueRemoved
	NotificationTypeValueChanged
	NotificationTypeValueRefreshed
	NotificationTypeGroup
	NotificationTypeNodeNew
	NotificationTypeNodeAdded
	NotificationTypeNodeRemoved
	NotificationTypeNodeProtocolInfo
	NotificationTypeNodeNaming
	NotificationTypeNodeEvent
	NotificationTypePollingDisabled
	NotificationTypePollingEnabled
	NotificationTypeSceneEvent
	NotificationTypeCreateButton
	NotificationTypeDeleteButton
	NotificationTypeButtonOn
	NotificationTypeButtonOff
	NotificationTypeDriverReady
	NotificationTypeDriverFailed
	NotificationTypeDriverReset
	NotificationTypeEssentialNodeQueriesComplete
	NotificationTypeNodeQueriesComplete
	NotificationTypeAwakeNodesQueried
	NotificationTypeAllNodesQueriedSomeDead
	NotificationTypeAllNodesQueried
	NotificationTypeNotification
	NotificationTypeDriverRemoved
	NotificationTypeControllerCommand
	NotificationTypeNodeReset
)

func (NotificationType) String

func (nt NotificationType) String() string

type Options

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

Options is a container for the C++ OpenZWave library Options class.

func CreateOptions

func CreateOptions(configPath, userPath, commandLine string) *Options

CreateOptions creates an object to manage the program options.

func GetOptions

func GetOptions() *Options

GetOptions gets a pointer to the Options singleton object.

func (*Options) AddOptionBool

func (o *Options) AddOptionBool(name string, value bool) bool

AddOptionBool add a boolean option to the program. Adds an option to the program whose value can then be read from a file or command line. All calls to AddOptionInt must be made before Lock.

func (*Options) AddOptionInt

func (o *Options) AddOptionInt(name string, value int32) bool

AddOptionInt add an integer option to the program. Adds an option to the program whose value can then be read from a file or command line. All calls to AddOptionInt must be made before Lock.

func (*Options) AddOptionLogLevel

func (o *Options) AddOptionLogLevel(name string, value LogLevel) bool

AddOptionLogLevel add a log level option to the program. Adds an option to the program whose value can then be read from a file or command line. All calls to AddOptionLogLevel must be made before Lock.

func (*Options) AddOptionString

func (o *Options) AddOptionString(name string, value string, append bool) bool

AddOptionString add a string option to the program. Adds an option to the program whose value can then be read from a file or command line. All calls to AddOptionString must be made before Lock.

func (*Options) AreLocked

func (o *Options) AreLocked() bool

AreLocked test whether the options have been locked.

func (*Options) GetOptionAsBool

func (o *Options) GetOptionAsBool(name string) (bool, bool)

GetOptionAsBool get the value of a boolean option.

func (*Options) GetOptionAsInt

func (o *Options) GetOptionAsInt(name string) (bool, int32)

GetOptionAsInt get the value of an integer option.

func (*Options) GetOptionAsString

func (o *Options) GetOptionAsString(name string) (bool, string)

GetOptionAsString get the value of a string option.

func (*Options) Lock

func (o *Options) Lock() bool

Lock locks the options. Reads in option values from the XML options file and command line string and marks the options as locked. Once locked, no more calls to AddOption can be made. The options must be locked before the Manager::Create method is called.

type ValueID

type ValueID struct {
	HomeID         uint32
	NodeID         uint8
	Genre          ValueIDGenre
	CommandClassID uint8
	Instance       uint8
	Index          uint8
	Type           ValueIDType
	ID             uint64
}

ValueID contains all appropriate information available for a ValueID from the OpenZWave library. You should not create a new ValueID manually, but receive it from the goopenzwave package after a Notification has been received from the OpenZWave library.

func (*ValueID) DisablePoll

func (v *ValueID) DisablePoll() bool

DisablePoll disables the polling of a device's state. Returns true if polling was disabled.

func (*ValueID) EnablePoll

func (v *ValueID) EnablePoll(intensity uint8) bool

EnablePoll enables the polling of a device's state. Returns true if polling was enabled.

func (*ValueID) GetAsBool

func (v *ValueID) GetAsBool() (bool, error)

GetAsBool returns the value as a bool. It will also return an error if the value is not a bool type.

func (*ValueID) GetAsByte

func (v *ValueID) GetAsByte() (byte, error)

GetAsByte returns the value as an 8-bit unsigned integer. It will also return an error if the value is not of byte type.

func (*ValueID) GetAsFloat

func (v *ValueID) GetAsFloat() (float32, error)

GetAsFloat returns the value as a float. It will also return an error if the value is not a decimal type.

func (*ValueID) GetAsInt

func (v *ValueID) GetAsInt() (int32, error)

GetAsInt returns the value as a 32-bit signed integer. It will also return an error if the value is not of 32-bit signed integer type.

func (*ValueID) GetAsRaw

func (v *ValueID) GetAsRaw() ([]byte, error)

GetAsRaw returns the value as a raw byte slice. It will also return an error if the value is not of raw type.

func (*ValueID) GetAsShort

func (v *ValueID) GetAsShort() (int16, error)

GetAsShort returns the value as a 16-bit signed integer. It will also return an error if the value is not of 16-bit signed integer type.

func (*ValueID) GetAsString

func (v *ValueID) GetAsString() string

GetAsString returns the value as a string, regardless of its actual type.

func (*ValueID) GetChangeVerified

func (v *ValueID) GetChangeVerified() bool

GetChangeVerified returns true if value changes upon a refresh should be verified. If so, the library will immediately refresh the value a second time whenever a change is observed. This helps to filter out spurious data reported occasionally by some devices.

func (*ValueID) GetFloatPrecision

func (v *ValueID) GetFloatPrecision() (uint8, error)

GetFloatPrecision returns the float value's precision. It will also return an error if the value is not of decimal type.

func (*ValueID) GetHelp

func (v *ValueID) GetHelp() string

GetHelp returns a help string describing the value's purpose and usage.

func (*ValueID) GetLabel

func (v *ValueID) GetLabel() string

GetLabel returns the user-friendly label for the value.

func (*ValueID) GetListItems

func (v *ValueID) GetListItems() ([]string, error)

GetListItems returns the list of items from a list value. It will also return an error if the value is not of list type.

func (*ValueID) GetListSelectionAsInt32

func (v *ValueID) GetListSelectionAsInt32() (int32, error)

GetListSelectionAsInt32 returns selected item from a list as an integer. It will also return an error if the value is not of list type.

func (*ValueID) GetListSelectionAsString

func (v *ValueID) GetListSelectionAsString() (string, error)

GetListSelectionAsString returns selected item from a list as a string. It will also return an error if the value is not of list type.

func (*ValueID) GetMax

func (v *ValueID) GetMax() int32

GetMax returns the maximum that this value may contain.

func (*ValueID) GetMin

func (v *ValueID) GetMin() int32

GetMin returns the minimum that this value may contain.

func (*ValueID) GetPollIntensity

func (v *ValueID) GetPollIntensity() uint8

GetPollIntensity returns the polling intensity of a device's state.

func (*ValueID) GetUnits

func (v *ValueID) GetUnits() string

GetUnits returns the units that the value is measured in.

func (*ValueID) IDString

func (v *ValueID) IDString() string

IDString will create a string representation of the ID for use as a key.

func (*ValueID) IsPolled

func (v *ValueID) IsPolled() bool

IsPolled returns true if the value is currently being polled.

func (*ValueID) IsReadOnly

func (v *ValueID) IsReadOnly() bool

IsReadOnly returns true if the value is read-only.

func (*ValueID) IsSet

func (v *ValueID) IsSet() bool

IsSet returns true if the value has been set.

func (*ValueID) IsWriteOnly

func (v *ValueID) IsWriteOnly() bool

IsWriteOnly returns true if the value is write-only.

func (*ValueID) PressButton

func (v *ValueID) PressButton() error

PressButton starts an activity in a device. It will return an error if the value is not of button type.

Since buttons are write-only values that do not report a state, no notification callbacks are sent.

func (*ValueID) Refresh

func (v *ValueID) Refresh() bool

Refresh refreshes the specified value from the Z-Wave network. It will return true if the driver and node were found, otherwise false.

A call to this function causes the library to send a message to the network to retrieve the current value of the specified ValueID (just like a poll, except only one-time, not recurring).

func (*ValueID) ReleaseButton

func (v *ValueID) ReleaseButton() error

ReleaseButton stops an activity in a device. It will return an error if the value is not of button type.

Since buttons are write-only values that do not report a state, no notification callbacks are sent.

func (*ValueID) SetBool

func (v *ValueID) SetBool(value bool) error

SetBool sets the state of a bool. It will return an error if the value is not of bool type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func (*ValueID) SetBytes

func (v *ValueID) SetBytes(value []byte) error

SetBytes sets the value of a raw value. It will return an error if the value is not of raw type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func (*ValueID) SetChangeVerified

func (v *ValueID) SetChangeVerified(verify bool)

SetChangeVerified sets a flag indicating whether value changes noted upon a refresh should be verified. If so, the library will immediately refresh the value a second time whenever a change is observed. This helps to filter out spurious data reported occasionally by some devices.

func (*ValueID) SetFloat

func (v *ValueID) SetFloat(value float32) error

SetFloat sets the value of a decimal. It will return an error if the value is not of decimal type.

It is usually better to handle decimal values using strings rather than floats, to avoid floating point accuracy issues. Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func (*ValueID) SetHelp

func (v *ValueID) SetHelp(help string)

SetHelp sets a help string describing the value's purpose and usage.

func (*ValueID) SetInt16

func (v *ValueID) SetInt16(value int16) error

SetInt16 sets the value of a 16-bit signed integer. It will return an error if the value is not of 16-bit signed integer type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func (*ValueID) SetInt32

func (v *ValueID) SetInt32(value int32) error

SetInt32 sets the value of a 32-bit signed integer. It will return an error if the value is not of 32-bit signed integer type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func (*ValueID) SetLabel

func (v *ValueID) SetLabel(label string)

SetLabel sets the user-friendly label for the value.

func (*ValueID) SetListSelection

func (v *ValueID) SetListSelection(selectedItem string) error

SetListSelection sets the selected item in a list. It will return an error if the value is not of list type or if the selection is not in the list.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func (*ValueID) SetPollIntensity

func (v *ValueID) SetPollIntensity(intensity uint8)

SetPollIntensity sets the frequency of polling.

- 0 = none
- 1 = every time through the list
- 2 = every other time
- etc.

func (*ValueID) SetString

func (v *ValueID) SetString(value string) error

SetString sets the value from a string, regardless of type. It will return an error if the value could not be parsed into the correct type for the value.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func (*ValueID) SetUint8

func (v *ValueID) SetUint8(value uint8) error

SetUint8 sets the value of a byte. It will return an error if the value is not of byte type.

Due to the possibility of a device being asleep, the command is assumed to succeed, and the value held by the node is updated directly. This will be reverted by a future status message from the device if the Z-Wave message actually failed to get through. Notification callbacks will be sent in both cases.

func (*ValueID) SetUnits

func (v *ValueID) SetUnits(units string)

SetUnits sets the units that the value is measured in.

func (*ValueID) String

func (v *ValueID) String() string

func (*ValueID) StringFull

func (v *ValueID) StringFull() string

type ValueIDGenre

type ValueIDGenre int

ValueIDGenre defines a type for the valueid genre enum.

const (
	ValueIDGenreBasic ValueIDGenre = iota
	ValueIDGenreUser
	ValueIDGenreConfig
	ValueIDGenreSystem
	ValueIDGenreCount
)

func (ValueIDGenre) String

func (v ValueIDGenre) String() string

type ValueIDType

type ValueIDType int

ValueIDType defines a type for the valueid type enum.

const (
	ValueIDTypeBool ValueIDType = iota
	ValueIDTypeByte
	ValueIDTypeDecimal
	ValueIDTypeInt
	ValueIDTypeList
	ValueIDTypeSchedule
	ValueIDTypeShort
	ValueIDTypeString
	ValueIDTypeButton
	ValueIDTypeRaw
	ValueIDTypeMax
)

func (ValueIDType) String

func (v ValueIDType) String() string

type Version

type Version struct {
	Major int
	Minor int
}

Version represents the OpenZWave library version as major and minor integers.

func GetVersion

func GetVersion() Version

GetVersion returns the Version Number as the Version Struct (Only Major/Minor returned).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL