upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Types | Public Member Functions

UPM API for Aeotec Door/Window Sensor 2nd Edition. More...

Detailed Description

This module allows for monitoring certain elements of an Aeotec Door/Window Sensor 2nd Edition Z-Wave device.

NOTE: This is a battery powered device that spends most of it's time sleeping (sort of like a cat). This means that on initial startup, there is not enough information known about the device to reliably query anything. Use isDeviceAvailable() to test whether the device has responded to OZW's probe request before requesting information for it.

The device information should become known once the device has awakened, either via it's configuration, or manually via the include button on the device. By default the device will never wake on it's own, so you should use the openzwave control panel or similar software to configure a periodic wakeup time.

string defaultDev = "/dev/ttyACM0";
// if an argument was specified, use it as the device instead
if (argc > 1)
defaultDev = string(argv[1]);
// Instantiate an Aeotec Door/Window 2nd Edition sensor instance, on
// device node 10. You will almost certainly need to change this to
// reflect your own network. Use the ozwdump example to see what
// nodes are available.
upm::AeotecDW2E sensor(10);
// The first thing to do is create options, then lock them when done.
sensor.optionsCreate();
sensor.optionsLock();
// Next, initialize it.
cout << "Initializing, this may take awhile depending on your ZWave network" << endl;
sensor.init(defaultDev);
cout << "Initialization complete" << endl;
cout << "Querying data..." << endl;
while (shouldRun) {
if (sensor.isDeviceAvailable()) {
cout << "Alarm status: " << sensor.isAlarmTripped() << endl;
cout << "Tamper Switch status: " << sensor.isTamperTripped() << endl;
cout << "Battery Level: " << sensor.getBatteryLevel() << "%" << endl;
cout << endl;
} else {
cout << "Device has not yet responded to probe." << endl;
cout << "Try waking it, or wait until it wakes itself if configured"
<< " to do so." << endl;
cout << endl;
}
upm_delay(1);
}
cout << "Exiting..." << endl;

Public Types

enum  INDEX_VALUES_T : int { INDEX_Alarm = 0, INDEX_AlarmLevel = 2, INDEX_BatteryLevel = 3 }
 

Public Member Functions

 AeotecDW2E (int nodeID)
 
 ~AeotecDW2E ()
 
bool isDeviceAvailable ()
 
bool isAlarmTripped ()
 
bool isTamperTripped ()
 
int getBatteryLevel ()
 
- Public Member Functions inherited from ozwInterface
 ozwInterface (int nodeID)
 
virtual ~ozwInterface ()
 
virtual void setDebug (bool enable)
 
virtual void optionsCreate (std::string configPath="/etc/openzwave", std::string userConfigDir="", std::string cmdLine="")
 
virtual void optionAddInt (std::string name, int val)
 
virtual void optionAddBool (std::string name, bool val)
 
virtual void optionAddString (std::string name, std::string val, bool append)
 
virtual void optionsLock ()
 
virtual void init (std::string devicePath, bool isHID=false)
 
virtual void dumpNodes (bool all=false)
 
virtual std::string getValueUnits (int index)
 
virtual std::string getValueLabel (int index)
 

Additional Inherited Members

- Protected Attributes inherited from ozwInterface
bool m_debugging
 
uint32_t m_nodeID
 
OZWm_instance
 
bool m_initialized
 

Member Enumeration Documentation

enum INDEX_VALUES_T : int

These values correspond to the index values of the given node

Constructor & Destructor Documentation

AeotecDW2E ( int  nodeID)

AeotecDW2E constructor

Parameters
nodeIDThe ZWave node number of the device we are interested in. Use the ozwdump example to see what nodes you have available.
~AeotecDW2E ( )

AeotecDW2E Destructor

Member Function Documentation

bool isDeviceAvailable ( )

Returns true if the node (device) information has been received yet, false otherwise. A sleeping node (like this device) will not be available for monitoring until all node info has been received. This will occur once the device has been awakened and has responded to OZW's probe request.

Returns
true if the node is available, false otherwise.

Here is the call graph for this function:

Here is the caller graph for this function:

bool isAlarmTripped ( )

Return the alarm value. If the device is not available yet (see isDeviceAvailable()), false will always be returned.

Returns
true if in the tripped state, false otherwise.

Here is the call graph for this function:

bool isTamperTripped ( )

Return the alarm's tamper switch valu. If the device is not available yet (see isDeviceAvailable()), false will always be returned.

Returns
true if in the tripped state, false otherwise.

Here is the call graph for this function:

int getBatteryLevel ( )

Return the current bettery level of the sensor as a percentage. The number returned will be between 0-100. If the device is not available yet (see isDeviceAvailable()), 0 will always be returned.

Returns
The Battery power level.

Here is the call graph for this function:

Inheritance diagram for AeotecDW2E:
Inheritance graph
[legend]
Collaboration diagram for AeotecDW2E:
Collaboration graph
[legend]

The documentation for this class was generated from the following files: