UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

OZW Class

Module: common

Methods

optionsCreate

(
  • configPath
  • userConfigDir
  • cmdLine
)

Start configuration with basic options. This must be called prior to init() , after the OZW() constructor is called.

Parameters:

  • configPath String

    Set the location of the OpenZWave config directory, default is /etc/openzwave

  • userConfigDir String

    Set the path to the user configuration directory. This is the location of the zwcfg*.xml and option.xml files for the user (probably created by the OpenZWave Control Panel example application). The default is the current directory ("").

  • cmdLine String

    Specify command line formatted options to OpenZWave. The default is "".

optionAddInt

(
  • name
  • val
)

Add an integer Option. See the OpenZWave documentation for valid values.

Parameters:

  • name String

    The name of the configuration option

  • val Number

    The value to set it to

optionAddBool

(
  • name
  • val
)

Add a boolean Option. See the OpenZWave documentation for valid values.

Parameters:

  • name String

    The name of the configuration option

  • val Boolean

    The value to set it to

optionAddString

(
  • name
  • val
  • append
)

Add a string Option. See the OpenZWave documentation for valid values.

Parameters:

  • name String

    The name of the configuration option

  • val String

    The value to set it to true to append to the option, false to override

  • append Boolean

    undefined

optionsLock

()

Lock the Options. This must be called after all options have been set, and before init() is called. If init() is called without locking the Options, init() will lock them itself. After the options have been locked, no further options can be specified.

init

(
  • devicePath
  • isHID
)
Boolean

Initialize the ZWave network. This method will start a probe of all defined devices on the ZWave network and query essential information about them. This function will not return until either initialization has failed, or has succeeded far enough along for the following methods to work. Depending on the size an complexity of the ZWave network, this may take anywhere from seconds to several minutes to complete.
All Options (via option*()) must have been specified before this function is called. If the Options have not been locked via optionsLock() prior to calling init() , this method will lock them for you before proceeding.

Parameters:

  • devicePath String

    The device path for the ZWave controller, typically something like /dev/ttyACM0, or similiar

  • isHID Boolean

    true if this is a HID device, false otherwise (ie: a serial port like /dev/ttyACM0, /dev/ttyUSB0, etc). Default is false.

Returns:

Boolean:

true if init succeeded, false otherwise

dumpNodes

(
  • all
)

Dump information about all configured nodes (devices) and their available values to stdout. This is useful to determine what nodes are available, and the index (used for querying and seting values for them). In addition, it includes information about each value (type, current value, etc).

Parameters:

  • all Boolean

    set to true to dump information about all values available for each node. If false, only information about 'user' values (ignoring 'system' and 'configuration') are output. The default is false ('user' values only).

getValueUnits

(
  • nodeId
  • index
)
String

Return a string (which may be empty) indicating the Units of measure for a given value. For example, querying a temperature value may return "F" to indicate Fahrenheit.

Parameters:

  • nodeId Number

    The node ID to query

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

String:

A string containing the Unit of measure for the value

setValueUnits

(
  • nodeId
  • index
  • text
)

Set the text for the Units of measure for a value.

Parameters:

  • nodeId Number

    The node ID to query

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • text String

    The text to set

getValueLabel

(
  • nodeId
  • index
)
String

Return a string (which may be empty) containing the user-freindly Label for a value.

Parameters:

  • nodeId Number

    The node ID to query

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

String:

A string containing the Value's label

setValueLabel

(
  • nodeId
  • index
  • text
)

Set the text for a Value's label.

Parameters:

  • nodeId Number

    The node ID to query

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • text String

    The text to set

getValueHelp

(
  • nodeId
  • index
)
String

Return a string (which may be empty) indicating the Help text of a value, if available.

Parameters:

  • nodeId Number

    The node ID to query

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

String:

A string containing the Help text, if available

setValueHelp

(
  • nodeId
  • index
  • text
)

Set the text for a Value's help text.

Parameters:

  • nodeId Number

    The node ID to query

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • text String

    The text to set

setValueAsString

(
  • nodeId
  • index
  • val
)

Set the contents of a Value to a string. This should always succeed if the supplied content makes sense for a given value, regardless of the value's actual type.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • val String

    the content to assign to the value referenced by nodeId, and index.

setValueAsBool

(
  • nodeId
  • index
  • val
)

Set the contents of a Value, to a bool. This will fail, and an error message printed if the value type is not a boolean value.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • val Boolean

    the boolean content to assign to the value referenced by nodeId, and index.

setValueAsByte

(
  • nodeId
  • index
  • val
)

Set the contents of a Value, to a byte. This will fail, and an error message printed if the value type is not a byte value.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • val Number

    the byte content to assign to the value referenced by nodeId, and index.

setValueAsFloat

(
  • nodeId
  • index
  • val
)

Set the contents of a Value, to a float. This will fail, and an error message printed if the value type is not a float value.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • val Number

    the float content to assign to the value referenced by nodeId, and index.

setValueAsInt32

(
  • nodeId
  • index
  • val
)

Set the contents of a Value, to a 32 bit integer (int32). This will fail, and an error message printed if the value type is not an int32.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • val Number

    the int32 content to assign to the value referenced by nodeId, and index.

setValueAsInt16

(
  • nodeId
  • index
  • val
)

Set the contents of a Value, to a 16 bit integer (int16). This will fail, and an error message printed if the value type is not an int16.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • val Number

    the int16 content to assign to the value referenced by nodeId, and index.

setValueAsBytes

(
  • nodeId
  • index
  • val
  • len
)

Set the contents of a Value, to an array of bytes. This will fail, and an error message printed if the value type is not settable as an array of bytes.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

  • val Uint8_t *

    the byte array content to assign to the value referenced by nodeId, and index.

  • len Number

    The length of the byte array

getValueMin

(
  • nodeId
  • index
)
Number

Get the minimum allowed value for a node's Value.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Number:

The minumum allowed value

getValueMax

(
  • nodeId
  • index
)
Number

Get the maximum allowed value for a node's Value.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Number:

The maximum allowed value

isValueReadOnly

(
  • nodeId
  • index
)
Boolean

Test whether a value is read-only.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Boolean:

true if the value is read-only, false otherwise

isValueWriteOnly

(
  • nodeId
  • index
)
Boolean

Test whether a value is write only.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Boolean:

true if the value is write-only, false otherwise

isValueSet

(
  • nodeId
  • index
)
Boolean

Test whether a value is really set on a node, and not a default value chosen by the OpenZWave library.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Boolean:

true if the value is really set, false if a default value is being reported

isValuePolled

(
  • nodeId
  • index
)
Boolean

Test whether a value is being manually polled by the OpenZWave library. Most modern devices are never polled, rather they are configured to report changing values to the controller on their own at device specific intervals or when appropriate events (depending the device) have occurred.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Boolean:

true if the value is being maually polled, false otherwise being reported

getValueAsString

(
  • nodeId
  • index
)
String

Return the content of a value as a string. This should always succeed, regardless of the actual value type.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

String:

A string representing the current contents of a value.

getValueAsBool

(
  • nodeId
  • index
)
Boolean

Return the content of a value as a booleang. This will fail, and an error message printed if the value type is not boolean.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Boolean:

A boolean representing the current contents of a value.

getValueAsByte

(
  • nodeId
  • index
)
Number

Return the content of a value as a byte. This will fail, and an error message printed if the value type is not a byte.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Number:

A byte representing the current contents of a value.

getValueAsFloat

(
  • nodeId
  • index
)
Number

Return the content of a value as a float. This will fail, and an error message printed if the value type is not a floating point value.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Number:

A float representing the current contents of a value.

getValueAsInt32

(
  • nodeId
  • index
)
Number

Return the content of a value as an int32. This will fail, and an error message printed if the value type is not an int32.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Number:

An int32 representing the current contents of a value.

getValueAsInt16

(
  • nodeId
  • index
)
Number

Return the content of a value as an int16. This will fail, and an error message printed if the value type is not an int16.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

Returns:

Number:

An int16 representing the current contents of a value.

refreshValue

(
  • nodeId
  • index
)

Issue a refresh request for a value on a node. OpenZWave will query the value and update it's internal state when the device responds. Note, this happens asynchronously - it may take some time before the current value is reported to OpenZWave by the node. If the node is asleep, you may not get a current value for some time (or at all, depending on the device). This method will return immediately after the request has been queued.

Parameters:

  • nodeId Number

    The node ID

  • index Number

    The value index (see dumpNodes() ) of the value to query.

setDebug

(
  • enable
)

Enable or disable some debugging output. Note, this will not affect OpenZWave's own debugging, which is usually set in the option.xml file.

Parameters:

  • enable Boolean

    true to enable debugging, false otherwise

isNodeListeningDevice

(
  • nodeId
)
Boolean

Determine if a node is a listening device b in other words, the node never sleeps.

Parameters:

  • nodeId Number

    The node ID

Returns:

Boolean:

true if the node never sleeps, false otherwise

isNodeFrequentListeningDevice

(
  • nodeId
)
Boolean

Determine if a node is a frequent listening device b in other words, if the node is asleep, can it be woken by a beam.

Parameters:

  • nodeId Number

    The node ID

Returns:

Boolean:

true if the node is a frequent listening device, false otherwise

isNodeAwake

(
  • nodeId
)
Boolean

Determine if a node is awake.

Parameters:

  • nodeId Number

    The node ID

Returns:

Boolean:

true if the node is awake, false otherwise

isNodeInfoReceived

(
  • nodeId
)
Boolean

Determine whether a Node's information has been received. For sleeping nodes, this may take a while (until the node wakes).

Parameters:

  • nodeId Number

    The node ID

Returns:

Boolean:

true if the node information is known, false otherwise

isInitialized

() Boolean

Determine if the Z-Wave network has been initialized yet.

Returns:

Boolean:

true if the network is initialized, false otherwise