Almond SDK
 All Classes Functions Variables Enumerations Enumerator
Public Types | Public Member Functions | List of all members
Device Class Reference

Public Types

enum  DevType {
  UnknownDeviceType = 0, BinarySwitch, MultilevelSwitch, BinarySensor,
  MultilevelSwitchOnOff, DoorLock, Alarm, Thermostat,
  Gateway, SceneController, StandardCIE, MotionSensor,
  ContactSwitch, FireSensor, WaterSensor, GasSensor,
  PersonalEmergencyDevice, VibrationOrMovementSensor, RemoteControl, KeyFob,
  Keypad, StandardWarningDevice, SmartACSwitch, SmartDCSwitch,
  OccupancySensor, LightSensor, WindowCovering, TemperatureSensor,
  SimpleMetering, ColorControl, PressureSensor, FlowSensor,
  ColorDimmableLight, HAPump, Shade
}
 A detailed list of all the supported device types available via the libAlmondHA library in the Almond SDK. More...
 
enum  DevTech { UnknownTechnology = 0, ZigBeeTechnology = 1, ZWaveTechnology = 2 }
 Defines the underlying Technology used by the physical device represented by an object of the Device Class. More...
 

Public Member Functions

 Device ()
 
 Device (int DevID)
 
 ~Device ()
 
int getID (void)
 
char * getValue (int index)
 
char * getValue (char *name)
 
char * getValueName (int index)
 
void setValue (char *, char *)
 
void setValue (int, char *)
 
DevType getDeviceType (void)
 
DevTech getDeviceTechnology (void)
 
int getOZWNode (void)
 
int getShortID (void)
 
char * getZigBeeEUI64 (void)
 
char * getDeviceName (void)
 
char * getDeviceLocation (void)
 
char * getFriendlyDeviceType (void)
 
bool getAllowNotificiation (void)
 
int getValueCount (void)
 
void setAllowNotification (bool)
 
void fromDeviceID (int DevID)
 
void setSwitchLevel (int level)
 
void setSwitchOn (bool val)
 
void setSwitchAll (bool val)
 
void setSwitchToggle (void)
 
void setThermostatHeatingTemp (int temp)
 
void setThermostatCoolingTemp (int temp)
 
void setThermostatFanMode (char *mode)
 
void setThermostatMode (char *mode)
 
void setDoorLock (int val)
 
void setDoorLockConf (int val)
 
void setBasic (int val)
 
void getBasic (void)
 
void wakeUpDevice (void)
 
void startAlarm (bool val)
 
void startWindowCovering (bool val)
 
void stopWindowCovering (bool val)
 
void setSceneControllerConf (int val)
 
void startDimming (bool val)
 
void startBrightning (bool val)
 
int getBatterLevel (void)
 
int getLastNotificationIndex (void)
 
char * getLastNotificationIndexName (void)
 
char * getLastNotificationIndexValue (void)
 
void RefreshDevice (void)
 
void setLocation (char *data)
 
void setName (char *data)
 
void clearTamper (void)
 
char * getTamper (void)
 
char * getRemovedeviceid (void)
 
void testserver (void)
 

Detailed Description

Device Class A Class whose object represents a physical HA capable device connected to the Almond's HA Network.

Member Enumeration Documentation

Defines the underlying Technology used by the physical device represented by an object of the Device Class.

Enumerator
UnknownTechnology 

Unknown Technology

ZigBeeTechnology 

A ZigBee HA 1.2 Profile Device sssss

ZWaveTechnology 

A Z-Wave Device

A detailed list of all the supported device types available via the libAlmondHA library in the Almond SDK.

Enumerator
UnknownDeviceType 

The default device type, in the case of Z-Wave this kind of device will provide only the "Basic Get", "Basic Set" and "Basic Report" command classes

BinarySwitch 

A simple on/off switch. This kind of device provides only binary on/off operation. For Z-Wave it will use the COMMAND_CLASS_SWITCH_BINARY, for Zigbee it uses the ZigBeeHA 1.2 ON/OFF-CLUSTER.

MultilevelSwitch 

A Multilevel switch which has binary on/off operation as well as level control fuctionality. For Z-Wave it will use the COMMAND_CLASS_SWITCH_MULTILEVEL and for ZigBee it will use ON/OFF-CLUSTER and LEVEL-CONTROL-CLUSTER

BinarySensor 

A basic sensor which returns a true or false state. For Z-Wave it uses the COMMAND_CLASS_SENSOR_BINARY and for ZigBee it uses the IAS Zone Cluster

MultilevelSwitchOnOff 

Same as MultilevelSwitch

DoorLock 

A Connected Door Lock, uses the Z-Wave COMMAND_CLASS_SECURITY and COMMAND_CLASS_DOOR_LOCK, ZigBee Door Lock Cluster

Alarm 

A connected Siren or Security Alarm, uses the Z-Wave COMMAND_CLASS_SECURITY and COMMAND_CLASS_ALARM, ZigBee Alarm Cluster

Thermostat 

A connected thermostat, uses the Z-Wave COMMAND_CLASS_THERMOSTAT_MODE, COMMAND_CLASS_THERMOSTAT_FAN_MODE, COMMAND_CLASS_THERMOSTAT_FAN_STATE, COMMAND_CLASS_THERMOSTAT_OPERATING_STATE, COMMAND_CLASS_THERMOSTAT_SETBACK, COMMAND_CLASS_THERMOSTAT_SETPOINT and COMMAND_CLASS_SENSOR_MULTILEVEL and for ZigBee it will use Thermostat Cluster

Gateway 

A Z-Wave device defined as a Primary or Secondary Controller. Uses the Z-Wave COMMAND_CLASS_VERSION, COMMAND_CLASS_BASIC and COMMAND_CLASS_MANUFACTURER_SPECIFIC

SceneController 

A Z-Wave Scene Controller device. Uses Z-Wave COMMAND_CLASS_SCENE_ACTIVATION and COMMAND_CLASS_CONTROLLER_CONF

StandardCIE 

A ZigBee device CIE (Control and Indicating Equipment). Uses ZigBee IAS Zone Cluster

MotionSensor 

A connected Motion Sensor. Uses Z-Wave COMMAND_CLASS_SENSOR_BINARY and ZigBee IAS Zone Cluster

ContactSwitch 

A connected Contact Switch (Door/Window Sensor). Uses Z-Wave COMMAND_CLASS_SENSOR_BINARY and ZigBee IAS Zone Cluster

FireSensor 

A connected Fire Sensor (or Smoke Alarm). Uses Z-Wave COMMAND_CLASS_SENSOR_BINARY and ZigBee IAS Zone Cluster

WaterSensor 

A connected Water Sensor (Flood Sensor). Uses Z-Wave COMMAND_CLASS_SENSOR_BINARY and ZigBee IAS Zone Cluster

GasSensor 

A connected Gas Sensor. Uses Z-Wave COMMAND_CLASS_SENSOR_BINARY and ZigBee IAS Zone Cluster

PersonalEmergencyDevice 
VibrationOrMovementSensor 

A connected Vibration or Movement Sensor. Uses Z-Wave COMMAND_CLASS_SENSOR_BINARY and ZigBee IAS Zone Cluster

RemoteControl 

Same as Gateway

KeyFob 

A connected Keyfob or Presence Sensor. Uses Z-Wave COMMAND_CLASS_CONFIGURATION and ZigBee IAS Zone Cluster

Keypad 
StandardWarningDevice 

See Alarm

SmartACSwitch 

A ZigBee switch with intigerated AC Electrical Measurment. Uses ZigBee On/Off Cluster and Electrical Measurement Cluster

SmartDCSwitch 

A ZigBee switch with intigerated AC Electrical Measurment. Uses ZigBee On/Off Cluster and Electrical Measurement Cluster

OccupancySensor 

A connected Occupancy Sensor. Uses Z-Wave COMMAND_CLASS_SENSOR_BINARY and ZigBee Occupancy Sensing Cluster

LightSensor 

A connected Light Sensor. Uses Z-Wave COMMAND_CLASS_SENSOR_BINARY and ZigBee Illuminance Measurement Cluster and Illuminance Level Sensing Cluster

WindowCovering 

A connected Window Cover Actuator. Uses Z-Wave COMMAND_CLASS_MULTILEVEL and COMMAND_CLASS_BASIC_WINDOW_COVERING and ZigBee Window Covering Cluster

TemperatureSensor 

A connected Temperature Sensor. Uses Z-Wave COMMAND_CLASS_SENSOR_MULTILEVEL and ZigBee Temperature Measurement Cluster

SimpleMetering 

A connected Meter. Uses Z-Wave COMMAND_CLASS_METER and ZigBee Simple Metering Cluster

ColorControl 

A ZigBee connected Color Controllable Light. Uses ZigBee Color Control Cluster

PressureSensor 

A connected Pressure Sensor. Uses Z-Wave COMMAND_CLASS_SENSOR_MULTILEVEL and ZigBee Pressure Measurement Cluster

FlowSensor 

A connected Flow Sensor. Uses Z-Wave COMMAND_CLASS_SENSOR_MULTILEVEL and ZigBee IAS Zone Cluster

ColorDimmableLight 

See Color Control

HAPump 

A ZigBee Device for HVAC Pump Configuration and Control. Uses ZigBee Pump Configuration and Control Cluster

Shade 

A connected Shade Control. Uses Z-Wave COMMAND_CLASS_MULTILEVEL and ZigBee Shade Configuration Cluster

Constructor & Destructor Documentation

Device::Device ( )

Default Contructor The Default Constructor for the Device Class. The default constructor should only be used in the event that a new Device is being created. For all other purposes use Device(int DevID)

See Also
Device(int DevID);
Device::Device ( int  DevID)

Contructor Use this constructor to point the device object to a specific device by passing an integer Device ID as a parameter.

Parameters
DevIDThe Device ID of the Physical Device that the object of this Device Class should point to.
Device::~Device ( )

Auto Destructor The Destructor for the Device Class. This does not need to be manually called.

Member Function Documentation

void Device::clearTamper ( void  )
void Device::fromDeviceID ( int  DevID)

fromDeviceID(int DevID) Create this device with the device id provided as parameter

Example:

Device switch1(); //New Device using default constructor
switch1.fromDeviceID(5); //Point this device to device at ID 5
//
//Do Something
//
Parameters
Integervalue representing the DeviceID of this device
bool Device::getAllowNotificiation ( void  )

getAllowNotificiation(void) Get whether or not the device is allowed to show notifications.

Example:

if(objectName.getAllowNotificiation() == true) {
//Do Something
}
Returns
bool true or false.
void Device::getBasic ( void  )

getBasic(void); Sends a Basic Get command to the Z-Wave device and initiates a Basic Report

Example:

Device zwDev(2); //New Device at Device ID 2
zwDev.getBasic(); //Send a Basic Get command to the Z-Wave device and initiate a basic report.
int Device::getBatterLevel ( void  )
char* Device::getDeviceLocation ( void  )

getDeviceLocation(void) Get the user provided location for the HA device.

Example:

printf("Device Location: %s", objectName.getDeviceLocation());
Returns
The user provided location for this device.
char* Device::getDeviceName ( void  )

getDeviceName(void) Get the user provided name for the HA device.

Example:

printf("Device Name: %s", objectName.getDeviceName());
Returns
The user provided name for this device.
DevTech Device::getDeviceTechnology ( void  )

getDeviceTechnology(void) Get The DevTech that represents the device pointed to by this object.

Example:

if(objectName.getDeviceTechnology == ZigBeeTechnology) {
//Do Something.
}
Returns
DevTech that represents this device.
See Also
DevTech
DevType Device::getDeviceType ( void  )

getDeviceType(void) Get The DevType that represents the device pointed to by this object.

Example:

if(objectName.getDeviceType == BinarySwitch) {
//Do Something.
}
Returns
DevType that represents this device.
See Also
DevType
char* Device::getFriendlyDeviceType ( void  )

getFriendlyDeviceType(void) Get the DevType for the HA device in a friendly string.

Example:

printf("Device Type: %s", objectName.getFriendlyDeviceType());
Returns
The DevType for the HA device in a friendly string.
See Also
DevType
int Device::getID ( void  )

getID() Returns the Device ID of the physical HA device that this object currently points to.

Returns
The DeviceID of the physical HA device that this object currently points to.
int Device::getLastNotificationIndex ( void  )
char* Device::getLastNotificationIndexName ( void  )
char* Device::getLastNotificationIndexValue ( void  )
int Device::getOZWNode ( void  )

getOZWNode(void) Get The Z-Wave Node ID that represents the device pointed to by this object.

Example:

if(objectName.getDeviceTechnology == ZWaveTechnology) {
printf("Z-Wave Node ID = %d\n",objectName.getOZWNode()); //Print Z-Wave Node ID on the Console
}
Returns
Z-Wave Node ID that represents this device.
See Also
DevTech
char* Device::getRemovedeviceid ( void  )
int Device::getShortID ( void  )

getShortID(void) Get The ZigBee Short ID that represents the device pointed to by this object.

Example:

if(objectName.getDeviceTechnology == ZigBeeTechnology) {
printf("ZigBee Short ID = %d\n",objectName.getShortID()); //Print ZigBee Short ID on the Console
}
Returns
ZigBee Short ID that represents this device.
See Also
DevTech
char* Device::getTamper ( void  )
char* Device::getValue ( int  index)

getValue(int index) Returns the value of the DeviceValuePair at the index index from the physical HA device that this object currently points to.

Example:

int myValue = objectName.getValue(1); //Get Value at Index 1
Parameters
indexThe index of the DeviceValuePair of which the value should be returned.
Returns
The value of the DeviceValuePair having index index.
char* Device::getValue ( char *  name)

getValue(char* name) Returns the value of the DeviceValuePair having the name name from the physical HA device that this object currently points to.

Example:

int myValue = objectName.getValue("setpoint"); //Get Setpoint Temperature for Thermostat
Parameters
nameThe name of the DeviceValuePair of which the value should be returned.
Returns
The value of the DeviceValuePair having name name.
int Device::getValueCount ( void  )

getValueCount(void) Get the total nuber of DeviceValuePair for this device.

Example:

for (int count = 0; count < objectName.getValueCount(); count++) {
//Do Something
}
Returns
The total nuber of DeviceValuePair for this device.
See Also
DeviceValuePair
char* Device::getValueName ( int  index)

getValueName(int index) Returns the name representing the value in the DeviceValuePair.

Example:

printf("%s\n", objectName.getValueName(3)); //Returns the name of index 3
Parameters
indexThe index of the value in DeviceValuePair of which the name should be returned.
Returns
The name representing the value in the DeviceValuePair.
char* Device::getZigBeeEUI64 ( void  )

getZigBeeEUI64(void) Get The ZigBee EUI64 (MAC Address) that represents the device pointed to by this object.

Example:

if(objectName.getDeviceTechnology == ZigBeeTechnology) {
printf("ZigBee EUI64 = %s\n",objectName.getZigBeeEUI64()); //Print ZigBee EUI64 MAC address on the Console
}
Returns
ZigBee Short ID that represents this device.
See Also
DevTech
void Device::RefreshDevice ( void  )
void Device::setAllowNotification ( bool  )

setAllowNotification(bool) Set whether or not the device is allowed to show notifications.

Example:

Device switch1(5); //Device at DeviceID 5
switch1.setAllowNotification(false); //Device is not allowed to send any notifications
//
//Do Something
//
switch1.setAllowNotification(true); //Device is allowed to send any notifications again
Parameters
boolvalue true or false, which determines whether or not the device should send notifications
void Device::setBasic ( int  val)

setBasic(int val); Used for Z-Wave Basic Set Command Class.

Example:

Device zwDev(2); //New Device at Device ID 2
zwDev.setBasic(0); //Send a value of 0 to Z-Wave device as Basic Set
Parameters
valAn Integer value to Basic Set for the Z-Wave Device
void Device::setDoorLock ( int  val)

setDoorLock(int val); Sets lock/unlock state for a door lock.

Example:

Device lock(7); //New Device at Device ID 7
lock.setDoorLock(0); //Unlock the door
Parameters
valAn Integer value representing the state of the door lock
void Device::setDoorLockConf ( int  val)
void Device::setLocation ( char *  data)
void Device::setName ( char *  data)
void Device::setSceneControllerConf ( int  val)
void Device::setSwitchAll ( bool  val)

setSwitchAll(bool val) Sets the binary switch (On/Off Switch) state for all the associated binary switches.

Example:

Device switch1(4); //New Device at Device ID 4
switch1.setSwitchAll(false); //Set all the switches to off state
//
//Do Something
//
switch1.setSwitchOn(true); //Set the Switch at DeviceID 4 to on state
Parameters
valA boolean value (true or false) representing on and off states for the binary switchs
void Device::setSwitchLevel ( int  level)

setSwitchLevel(int level) Sets the Percentage level for a multilevel switch (Dimmer switch).

Example:

Device dimmer(4); //New Device at Device ID 4
dimmer.setSwitchLevel(100); //Set the Multilevel Switch at DeviceID 4 to 100% brightness
//
//Do Something
//
Parameters
Integervalue representing the percentage level for a multilevel switch (Dimmer switch).
void Device::setSwitchOn ( bool  val)

setSwitchOn(bool val) Sets the binary switch (On/Off Switch) state.

Example:

Device switch1(4); //New Device at Device ID 4
switch1.setSwitchOn(false); //Set the Switch at DeviceID 4 to off state
//
//Do Something
//
switch1.setSwitchOn(true); //Set the Switch at DeviceID 4 to on state
Parameters
valA boolean value (true or false) representing on and off states for the binary switch
void Device::setSwitchToggle ( void  )

setSwitchToggle(void) Toggles the state of a binary switch (On/Off Switch).

Example:

Device switch1(4); //New Device at Device ID 4
switch1.setSwitchOn(false); //Set all the switches to off state
//
//Do Something
//
switch1.setSwitchToggle(); //Set the Switch at DeviceID 4 to on state
void Device::setThermostatCoolingTemp ( int  temp)

setThermostatCoolingTemp(int temp) Sets the Cooling target temperature for the thermostat.

Example:

Device therm(9); //New Device at Device ID 9
therm.setThermostatCoolingTemp(36); //Set the Cooling target temperature for the thermostat to 36F
Parameters
tempAn Integer value representing the target temperature in farenhiet.
void Device::setThermostatFanMode ( char *  mode)

setThermostatFanMode(char* mode) Sets the Fan Mode for the thermostat.

Example:

Device therm(9); //New Device at Device ID 9
therm.setThermostatFanMode("Auto"); //Set the fan mode for the thermostat to "Auto"
Parameters
modeA char* string representing the Fan Mode of the Thermostat
void Device::setThermostatHeatingTemp ( int  temp)

setThermostatHeatingTemp(int temp) Sets the Heating target temperature for the thermostat.

Example:

Device therm(9); //New Device at Device ID 9
therm.setThermostatHeatingTemp(90); //Set the Heating target temperature for the thermostat to 90F
Parameters
tempAn Integer value representing the target temperature in farenhiet.
void Device::setThermostatMode ( char *  mode)

setThermostatMode(char* mode) Sets the Fan Mode for the thermostat.

Example:

Device therm(9); //New Device at Device ID 9
therm.setThermostatMode("Off"); //Set the mode for the thermostat to "Off"
Parameters
modeA char* string representing the Mode of the Thermostat
void Device::setValue ( char *  ,
char *   
)

setValue(char* indexName, char* value) Sets the value of an index within a device using the name of the index.

Example:

objectName.setValue("setpoint","80"); //Set the thermostat Setpoint Temperature to 80F
Parameters
indexNameThe name of the index in DeviceValuePair.
valueThe value to be set.
void Device::setValue ( int  ,
char *   
)

setValue(int index, char* value) Sets the value of an index within a device using the index.

Example:

objectName.setValue(1,"true"); //Turn the switch on.
Parameters
indexThe index of the value to be set in DeviceValuePair.
valueThe value to be set.
void Device::startAlarm ( bool  val)
void Device::startBrightning ( bool  val)
void Device::startDimming ( bool  val)
void Device::startWindowCovering ( bool  val)
void Device::stopWindowCovering ( bool  val)
void Device::testserver ( void  )
void Device::wakeUpDevice ( void  )