Module: telldus

class telldus.DeviceManager

The devicemanager holds and manages all the devices in the server

addDevice(**kwargs)

Call this function to register a new device to the device manager.

Note

The Device.localId() function in the device must return a unique id for the transport type returned by Device.typeString()

Note

Calls to this method are threadsafe.

device(deviceId)

Retrieves a device.

Parameters:deviceId (int) – The id of the device to be returned.
Returns:the device specified by deviceId or None of no device was found
finishedLoading(**kwargs)

Finished loading all devices of this type. If there are any unconfirmed, these should be deleted

Note

Calls to this method are threadsafe.

removeDevice(**kwargs)

Removes a device.

Warning

This function may only be called by the module supplying the device since removing of a device may be transport specific.

Note

Calls to this method are threadsafe.

removeDevicesByType(**kwargs)

New in version 1.1.0.

Remove all devices of a specific device type

Parameters:deviceType (str) – The type of devices to remove

Note

Calls to this method are threadsafe.

retrieveDevices(deviceType=None)

Retrieve a list of devices.

Parameters:deviceType (str or None) – If this parameter is set only devices with this type is returned
Returns:a list of devices
class telldus.IDeviceChange

Bases: base.Plugin.IInterface

Implement this IInterface to recieve notifications on device changes

deviceAdded()

This method is called when a device is added

deviceConfirmed()

This method is called when a device is confirmed on the network, not only loaded from storage (not applicable to all device types)

deviceRemoved()

This method is called when a device is removed

sensorValueUpdated(valueType, value, scale)

This method is called when a new sensor value is received from a sensor

stateChanged(state, statevalue)

Called when the state of a device changed

class telldus.Device

A base class for a device. Any plugin adding devices must subclass this class.

BAROMETRIC_PRESSURE = 2048

Sensor type flag for barometric pressure

BELL = 4

Device flag for devices supporting the bell method.

DEW_POINT = 1024

Sensor type flag for dew point

DIM = 16

Device flag for devices supporting the dim method.

DOWN = 256

Device flag for devices supporting the down method.

EXECUTE = 64

Device flag for devices supporting the execute method.

HUMIDITY = 2

Sensor type flag for humidity

LEARN = 32

Device flag for devices supporting the learn method.

LUMINANCE = 512

Sensor type flag for luminance

RAINRATE = 4

Sensor type flag for rain rate

RAINTOTAL = 8

Sensor type flag for rain total

RGB = 1024

Device flag for devices supporting the rgb method.

RGBW = 1024

Device flag for devices supporting the rgb method, this is depricated, use RGB.

STOP = 512

Device flag for devices supporting the stop method.

TEMPERATURE = 1

Sensor type flag for temperature

THERMOSTAT = 2048

Device flag for devices supporting thermostat methods.

TOGGLE = 8

Device flag for devices supporting the toggle method.

TURNOFF = 2

Device flag for devices supporting the off method.

TURNON = 1

Device flag for devices supporting the on method.

UNKNOWN = 0

Sensor type flag for an unknown type

UP = 128

Device flag for devices supporting the up method.

UV = 128

Sensor type flag for uv

WATT = 256

Sensor type flag for watt

WINDAVERAGE = 32

Sensor type flag for wind average

WINDDIRECTION = 16

Sensor type flag for wind direction

WINDGUST = 64

Sensor type flag for wind gust

_command(action, value, success, failure, **_Device__kwargs)

Reimplement this method to execute an action to this device.

allParameters()

Similar as parameters() but this returnes more values such as the device type

battery()

Returns the current battery value

command(action, value=None, origin=None, success=None, failure=None, callbackArgs=None, ignore=None)

This method executes a method with the device. This method must not be subclassed. Please subclass _command() instead.

Parameters:action – description
Returns:return description

Here below is the results of the Device.methods() docstring.

isDevice()

Return True if this is a device.

isSensor()

Return True if this is a sensor.

localId()

This method must be reimplemented in the subclass. Return a unique id for this device type.

metadata(key=None, default=None)

Returns a metadata value set by the user. If key is none then all values are returned as a dictionary.

static methodStrToInt(method)

Convenience method to convert method string to constants.

Example: “turnon” => Device.TURNON

methods()

This function returns the methods this device supports.

Returns:An or-ed integer of device method flags.

Example:

return Device.TURNON | Device.TURNOFF
parameters()
Returns:a static dictionary of paramters describing the device. These should not containd the current state of the device, only descriptive parameters.
sensorValue(valueType, scale)
Returns:a sensor value of a the specified valueType and scale. Returns None is no such value exists
sensorValues()
Returns:a list of all sensor values this device has received.
state()
Returns:a tuple of the device state and state value

Example:

state, stateValue = device.state()
typeString()

Must be reimplemented by subclass. Return the type (transport) of this device. All devices from a plugin must have the same type.

class telldus.Sensor

Bases: telldus.Device.Device

A convenience class for sensors.

isDevice()

Return True if this is a device.

isSensor()

Return True if this is a sensor.