C# Class OSAE.Tellstick.Tellstick

Inheritance: OSAEPluginBase
Show file Open project: opensourceautomation/Open-Source-Automation

Public Methods

Method Description
ProcessCommand ( OSAEMethod method ) : void

ProcessCommand will be called by OSA everytime a method is run on an OSA object. Will send the apropriate commands to Tellstick and update the object properties accordingly.

RunInterface ( string pluginName ) : void

RunInterface will be called everytime the plugin starts. Will discover all devices existing in Telldus center. New OSA objects will be created for each device if they are not already existing, unless the property AddDevices is set to FALSE.

Shutdown ( ) : void

Shutdown will be called everytime when OSA stops the plugin. Will clean up the Telldus class and stop the timer

decodeChangeEvent ( int deviceId, int changeEvent, int changeType, int callbackId, Object obj ) : int

decodeChangeEvent is the callback function for device change messages from the Tellstick. The function is registered with the Telldus service and will then be called from Telldus everytime a device is changed. This can for example be a new name or address for a device. The object properties will be updated with the new values.

decodeEvent ( int deviceId, int method, string data, int callbackId, Object obj ) : int

decodeEvent is the callback function for messages from the Tellstick. The function is registered with the Telldus service and will then be called from Telldus everytime a device changes its state

decodeRawEvent ( string data, int controllerId, int callbackId, Object obj ) : int

decodeRawEvent is the callback function for raw messages from the Tellstick. The function is registered with the Telldus service and will then be called from Telldus everytime a device is changed. Nothing will be done with the message, will only create an entry in the logfile.

decodeSensorEvent ( string protocol, string model, int deviceId, int dataType, string value, int timestamp, int callbackId, Object obj ) : int

decodeSensorEvent is the callback function for sensor messages, humidity or temperature, from the Tellstick. The function is registered with the Telldus service and will then be called from Telldus everytime a device is changed. The object properties will be updated with the new values.

Private Methods

Method Description
MethodToString ( int mtd ) : string
OnAverageEvent ( object source, System e ) : void

OnAverageEvent will be called regulary to calculate average values for sensors. The timer will be started from RunInterface.

StatusDefault ( OSAEObject o ) : void
changeEventToString ( int changeEvent ) : string
changeEventTypeToString ( int changeType ) : string
createSensorObject ( int deviceId, int dataType, string protocol, string model ) : OSAEObject
dataTypeToString ( int dataType ) : string

Translates a Telldus data type into a readable string.

deviceTypeToString ( int deviceType ) : string
doCommand ( OSAEObject o, string addr, OSAEMethod method ) : int
getObject ( int deviceId ) : OSAEObject

getObject will try to find an exsisting object from the deviceId or from the Telldus name of this deviceId. If not found a new one will be created, otherwise the existing object is updated.

getObjectType ( string methods ) : string

Translates a string with supported methods into an object type

getPropertyValue ( OSAEObject o, string p ) : string
getSensorObject ( int deviceId, int dataType, string protocol, string model ) : OSAEObject

getSensorObject will try to find an exsisting object from the deviceId, if not found a new one will be created but only if the property AddSensors is TRUE.

getSensorParameter ( int deviceId, string parameter ) : string
initPlugin ( string Name ) : void

initPlugin is called just after plugin start to initialise the plugin. Will create the Tellstick object and its properties if they are missing.

log ( string procedur, string value, string text ) : void
logD ( string procedur, string value, string text ) : void
logD ( string procedur, string value, string text, OSAEObject o ) : void
logE ( string procedur, string value, string text, Exception ex ) : void
logResult ( string methodName, int result, OSAEObject o ) : void
logW ( string procedur, string value, string text ) : void
pluginCommands ( OSAEObject o, string addr, OSAEMethod method ) : int
restoreBinarySwitchObjectType ( string Name ) : void
restoreHumidityMeterObjectType ( string Name ) : void
restoreMultiLevelSwitchObjectType ( string Name ) : void
restoreObjectTypes ( string Name ) : void
restoreTellstickBellObjectType ( string Name ) : void
restoreTellstickBinarySwitchObjectType ( string Name ) : void
restoreTellstickGroupDeviceObjectType ( string Name ) : void
restoreTellstickHumiditySensorObjectType ( string Name ) : void
restoreTellstickMultiLevelswitchObjectType ( string Name ) : void
restoreTellstickObjectType ( string Name ) : void
restoreTellstickTempHumiditySensorObjectType ( string Name ) : void
restoreTellstickTemperatureSensorObjectType ( string Name ) : void
restoreTellstickUpDownDeviceObjectType ( string Name ) : void
restoreTempHumMeterObjectType ( string Name ) : void
restoreTemperatureSensorObjectType ( string Name ) : void
restoreUpDownDeviceObjectType ( string Name ) : void
setLastProperties ( OSAEObject o, int deviceId, int lastCmd ) : void
setMethods ( int deviceId, OSAEObject o ) : void
setOSAProperties ( OSAEObject o, int deviceId ) : void
setPropertyValue ( OSAEObject o, string p, string v ) : void

Method Details

ProcessCommand() public method

ProcessCommand will be called by OSA everytime a method is run on an OSA object. Will send the apropriate commands to Tellstick and update the object properties accordingly.
public ProcessCommand ( OSAEMethod method ) : void
method OSAEMethod Name of executed method
return void

RunInterface() public method

RunInterface will be called everytime the plugin starts. Will discover all devices existing in Telldus center. New OSA objects will be created for each device if they are not already existing, unless the property AddDevices is set to FALSE.
public RunInterface ( string pluginName ) : void
pluginName string Name of the plugin, i.e. Tellstick
return void

Shutdown() public method

Shutdown will be called everytime when OSA stops the plugin. Will clean up the Telldus class and stop the timer
public Shutdown ( ) : void
return void

decodeChangeEvent() public method

decodeChangeEvent is the callback function for device change messages from the Tellstick. The function is registered with the Telldus service and will then be called from Telldus everytime a device is changed. This can for example be a new name or address for a device. The object properties will be updated with the new values.
public decodeChangeEvent ( int deviceId, int changeEvent, int changeType, int callbackId, Object obj ) : int
deviceId int Tellstick Id of device who changed
changeEvent int Type of change, added, deleted, changed etc.
changeType int Specifies which property who changed.
callbackId int Id given by Telldus when function was registered
obj Object Optional object given to Telldus when callback function was registered. (Not used)
return int

decodeEvent() public method

decodeEvent is the callback function for messages from the Tellstick. The function is registered with the Telldus service and will then be called from Telldus everytime a device changes its state
public decodeEvent ( int deviceId, int method, string data, int callbackId, Object obj ) : int
deviceId int Tellstick Id of device who changed state
method int This is the Telldus name of the new state
data string Data value given by Telldus, for example DIM value
callbackId int Id given by Telldus when function was registered
obj Object Optional object given to Telldus when callback function was registered. (Not used)
return int

decodeRawEvent() public method

decodeRawEvent is the callback function for raw messages from the Tellstick. The function is registered with the Telldus service and will then be called from Telldus everytime a device is changed. Nothing will be done with the message, will only create an entry in the logfile.
public decodeRawEvent ( string data, int controllerId, int callbackId, Object obj ) : int
data string New sensor value.
controllerId int Tellstick timestamp in number of seconds since 1/1 1970.
callbackId int Id given by Telldus when function was registered
obj Object Optional object given to Telldus when callback function was registered. (Not used)
return int

decodeSensorEvent() public method

decodeSensorEvent is the callback function for sensor messages, humidity or temperature, from the Tellstick. The function is registered with the Telldus service and will then be called from Telldus everytime a device is changed. The object properties will be updated with the new values.
public decodeSensorEvent ( string protocol, string model, int deviceId, int dataType, string value, int timestamp, int callbackId, Object obj ) : int
protocol string Name of protocol used by Tellstick
model string Sensor model
deviceId int Tellstick Id of device who changed
dataType int Type of value from this sensor
value string New sensor value.
timestamp int Tellstick timestamp in number of seconds since 1/1 1970.
callbackId int Id given by Telldus when function was registered
obj Object Optional object given to Telldus when callback function was registered. (Not used)
return int