device/Switch

class aaa_modules.layout_model.switch.Fan(switchItem, timerItem)[source]

Represents a fan switch.

__init__(switchItem, timerItem)[source]

Ctor

Parameters:
  • switchItem (org.eclipse.smarthome.core.library.items.SwitchItem) –
  • timerItem (org.eclipse.smarthome.core.library.items.SwitchItem) –
  • disableTrigeringFromMotionSensor (bool) – a flag to indicate whether the switch should be turned on when motion sensor is triggered. There is no logic associate with this value in this class; it is used by external classes through the getter.
Raises:

ValueError – if any parameter is invalid

class aaa_modules.layout_model.switch.Light(switchItem, timerItem, illuminanceLevel=None, disableTrigeringFromMotionSensor=False)[source]

Represents a regular light.

__init__(switchItem, timerItem, illuminanceLevel=None, disableTrigeringFromMotionSensor=False)[source]
Parameters:illuminanceLevel (int) – the illuminance level in LUX unit. The light should only be turned on if the light level is below this unit.
getIlluminanceThreshold()[source]

Returns the illuminance level in LUX unit. Returns None if not applicable.

Return type:int or None
isLowIlluminance(currentIlluminance)[source]

Returns False if this light has no illuminance threshold or if currentIlluminance is less than 0. Otherwise returns True if the currentIlluminance is less than threshold. @override

class aaa_modules.layout_model.switch.Switch(switchItem, timerItem, disableTrigeringFromMotionSensor=False)[source]

Represents a light or fan switch. Each switch is associated with a timer item. When the switch is turned on, the timer is turned on as well. As the timer expires, the switch is turned off (if it is not off already). If the switch is turned off not by the timer, the timer is cancelled.

__init__(switchItem, timerItem, disableTrigeringFromMotionSensor=False)[source]

Ctor

Parameters:
  • switchItem (org.eclipse.smarthome.core.library.items.SwitchItem) –
  • timerItem (org.eclipse.smarthome.core.library.items.SwitchItem) –
  • disableTrigeringFromMotionSensor (bool) – a flag to indicate whether the switch should be turned on when motion sensor is triggered. There is no logic associate with this value in this class; it is used by external classes through the getter.
Raises:

ValueError – if any parameter is invalid

canBeTriggeredByMotionSensor()[source]

Returns True if this switch can be turned on when a motion sensor is triggered. A False value might be desired if two switches share the same motion sensor, and only one switch shall be turned on when the motion sensor is triggered.

Return type:bool
getLastOffTimestampInSeconds()[source]

Returns the timestamp in epoch seconds the switch was last turned off.

Returns:-1 if the timestamp is not available, or an integer presenting the epoch seconds
getTimerItem()[source]
Return type:str the underlying item name
isLowIlluminance(currentIlluminance)[source]

Always return False.

isOn()[source]

Returns true if the switch is turned on; false otherwise.

onSwitchTurnedOff(events, itemName)[source]

Invoked when a switch off event is triggered. Note that a switch can be turned off through this class’ turnOff method, or through the event bus, or manually by the user. The following actions are done: - the timer item is set to OFF.

Parameters:
  • events (scope.events) –
  • itemName (string) – the name of the item triggering the event
Returns:

True if itemName refers to this switch; False otherwise

onSwitchTurnedOn(events, itemName)[source]

Invoked when a switch on event is triggered. Note that a switch can be turned on through this class’ turnOn method, or through the event bus, or manually by the user. The following actions are done: - the on timestamp is set; - the timer item is set to ON.

:param scope.events events :param string itemName: the name of the item triggering the event :return True: if itemName refers to this switch; False otherwise

turnOff(events)[source]

Turn off this light.

turnOn(events)[source]

Turns on this light, if it is not on yet. In either case, the associated timer item is also turned on.