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

UPM API for Aeotec Smart Switch 6. More...

Detailed Description

This module allows for controlling and monitoring certain elements of an Aeotec Smart Switch 6.

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 SS6 instance, on device node 11. You will
// almost certainly need to change this to reflect your own network.
// Use the ozwdump example to see what nodes are available.
upm::AeotecSS6 sensor(11);
// 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;
// turn light on
cout << "Turning switch on, then upm_delaying for 5 secs" << endl;
sensor.on();
upm_delay(5);
cout << "Querying data..." << endl;
while (shouldRun) {
sensor.update();
cout << "Switch status: " << sensor.isOn() << endl;
cout << "Volts: " << sensor.getVolts() << " volts" << endl;
cout << "Energy Consumption: " << sensor.getEnergy() << " kWh" << endl;
cout << "Watts: " << sensor.getWatts() << endl;
cout << "Current: " << sensor.getCurrent() << " amps" << endl;
cout << endl;
upm_delay(3);
}
cout << "Turning switch off and upm_delaying for 5 seconds..." << endl;
sensor.off();
upm_delay(5);
cout << "Exiting..." << endl;

Public Types

enum  INDEX_VALUES_T : int {
  INDEX_SwitchCtrl = 0, INDEX_Energy_kWh = 4, INDEX_Power_Watts = 7, INDEX_Volts = 8,
  INDEX_Current = 9
}
 

Public Member Functions

 AeotecSS6 (int nodeID)
 
 ~AeotecSS6 ()
 
void on ()
 
void off ()
 
bool isOn ()
 
void update ()
 
float getEnergy ()
 
float getWatts ()
 
float getVolts ()
 
float getCurrent ()
 
- 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

AeotecSS6 ( int  nodeID)

AeotecSS6 constructor

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

AeotecSS6 Destructor

Member Function Documentation

void on ( )

Turn the switch on.

Here is the call graph for this function:

void off ( )

Turn the switch off.

Here is the call graph for this function:

bool isOn ( )

Check to see if the switch is on or off.

Returns
true if the switch is on, false otherwise.

Here is the call graph for this function:

void update ( void  )

Query the device and update internal state. Strictly speaking, this is not really neccessary – a device may send this data on it's own at periodic intervals. This method causes OZW to specifically query the device for it's current Energy, Watts, Volts, Current, and Switch status. The device may take some time to respond.

Here is the call graph for this function:

float getEnergy ( )

Return the device's accumulated energy usage in kilo-watt-hours (kWh).

Returns
The energy usage in kWh.

Here is the call graph for this function:

float getWatts ( )

Return the device's current power consumption in Watts.

Returns
The current power consumption in Watts.

Here is the call graph for this function:

float getVolts ( )

Return the device's current voltage measurement in Volts.

Returns
The volts measurement.

Here is the call graph for this function:

float getCurrent ( )

Return the device's current consumption in Amps.

Returns
The current consumption measurement in Amps.

Here is the call graph for this function:

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

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