Builtin Statusobject Types

Here are the definitions for the builtin statusobject types (sensors and actuators). More types are available in Extensions.

Builtin Sensors

Module for various Sensor classes.

class automate.sensors.builtin_sensors.UserAnySensor(*args, **kwargs)[source]

User editable sensor type that accepts values of any types

class automate.sensors.builtin_sensors.UserBoolSensor(*args, **kwargs)[source]

Boolean-valued user-editable sensor

class automate.sensors.builtin_sensors.UserEventSensor(*args, **kwargs)[source]

Boolean-valued user-editable sensor suitable for using for singular events.

After status has been changed to True, it changes automatically its status back to False.

class automate.sensors.builtin_sensors.AbstractNumericSensor(*args, **kwargs)[source]

Abstract class for numeric sensor types, that allows limiting value within a specific range.

If limiting values (value_min, value_max) are used, value that exceeds these limits, is clipped to the range.

value_min = None

Minimum allowed value for status

value_max = None

Maximum allowed value for status

class automate.sensors.builtin_sensors.UserIntSensor(*args, **kwargs)[source]

Integer-valued user-editable sensor

class automate.sensors.builtin_sensors.UserFloatSensor(*args, **kwargs)[source]

Float-valued user-editable sensor

class automate.sensors.builtin_sensors.UserStrSensor(*args, **kwargs)[source]

String-valued user-editable sensor

class automate.sensors.builtin_sensors.CronTimerSensor(*args, **kwargs)[source]

Scheduled start/stop timer. Both start and stop times are configured by cron-type string (see man 5 crontab for description of the definition format).

timer_on = None

Semicolon separated lists of cron-compatible strings that indicate when to switch status to True

timer_off = None

Semicolon separated lists of cron-compatible strings that indicate when to switch status to False

class automate.sensors.builtin_sensors.FileChangeSensor(*args, **kwargs)[source]

Sensor that detects file changes on filesystem. Integer valued status is incremented by each change.

filename = None

Name of file or directory to monitor

watch_flags = None

PyInotify flags to configure what file change events to monitor

class automate.sensors.builtin_sensors.AbstractPollingSensor(*args, **kwargs)[source]

Abstract baseclass for sensor that polls periodically its status

interval = None

How often to do polling

poll_active = None

This can be used to enable/disable polling

class automate.sensors.builtin_sensors.PollingSensor(*args, **kwargs)[source]

Polling sensor that uses a Callable when setting the status of the sensor.

status_updater = None

Return value of this Callable is used to set the status of the sensor when polling

type = None

If set, typeconversion to this is used. Can be any function or type.

class automate.sensors.builtin_sensors.IntervalTimerSensor(*args, **kwargs)[source]

Sensor that switches status between True and False periodically.

class automate.sensors.builtin_sensors.SocketSensor(*args, **kwargs)[source]

Sensor that reads a TCP socket.

Over TCP port, it reads data per lines and tries to set the status of the sensor to the value specified by the line. If content of the line is ‘close’, then connection is dropped.

host = None

Hostname/IP to listen. Use '0.0.0.0' to listen all interfaces.

port = None

Port to listen

stop = None

set to True to tell SocketSensor to stop listening to port

class automate.sensors.builtin_sensors.ShellSensor(*args, **kwargs)[source]

Run a shell command and follow its output. Status is set according to output, which is filtered through custome filter function.

cmd = None

Command can be, for example, ‘tail -f logfile.log’, which is convenient approach to follow log files.

caller = None

If this is set to true, caller object is passed to the filter function as second argument

filter = None

Filter function, which must be a generator, such as for example:

def filter(queue):
    while True:
        line = queue.get()
        if line == 'EOF':
            break
        yield line

or a simple line-by-line filter:

def filter(line):
    return processed(line)

Builtin Actuators

Module for builtin Actuator classes

class automate.actuators.builtin_actuators.BoolActuator(*args, **kwargs)[source]

Boolean valued actuator

class automate.actuators.builtin_actuators.IntActuator(*args, **kwargs)[source]

Integer valued actuator

class automate.actuators.builtin_actuators.FloatActuator(*args, **kwargs)[source]

Floating point valued actuator

class automate.actuators.builtin_actuators.AbstractInterpolatingActuator(*args, **kwargs)[source]

Abstract base class for interpolating actuators.

change_frequency = None

How often to update status (as frequency)

slave_actuator = None

Slave actuator, that does the actual work (set .slave attribute to True in slave actuator)

class automate.actuators.builtin_actuators.ConstantSpeedActuator(*args, **kwargs)[source]

Change slave status with constant speed

speed = None

Status change speed (change / second)

class automate.actuators.builtin_actuators.ConstantTimeActuator(*args, **kwargs)[source]

Change slave status in constant time

change_time = None

Time that is needed for change