Lesser Than the mean value

class knx_plugin.trigger.mean.LesserThan

A trigger triggered when

  1. it has some ASAPs in common with the compared Description and

  2. the knx_stack.datapointtypes.DPT value contained into the trigger is lesser than the mean value of knx_stack.datapointtypes.DPT values received from bus

The mean is calculated using last num of samples Descriptions.

Use it when changes has to be slow down otherwise use knx_plugin.trigger.definition.LesserThan().

More high is num of samples more slow are changes.

DPT Value Lux

class knx_plugin.trigger.dpt_value_lux.DeepDark
>>> import io
>>> import json
>>> import knx_stack
>>> import knx_plugin
>>> deepdark = knx_plugin.trigger.dpt_value_lux.DeepDark.make_from_yaml(addresses=[1234])
>>> address_table = knx_stack.layer.AddressTable(knx_stack.Address(4098), [], 255)
>>> association_table = knx_stack.layer.AssociationTable(address_table, [])
>>> groupobject_table = knx_stack.GroupObjectTable()
>>> deepdark.associate(association_table, groupobject_table)
>>> bus_event = '''
...        {"name": "DPT_Value_Lux",
...         "addresses": [1234],
...         "fields": {"decoded_value": 4001}}
... '''
>>> another_description = knx_plugin.Description(json.loads(bus_event))
>>> another_description.associate_with(association_table)
>>> deepdark.is_triggered(another_description)
False
>>> bus_event = '''
...        {"name": "DPT_Value_Lux",
...         "addresses": [1234],
...         "fields": {"decoded_value": 1000}}
... '''
>>> another_description = knx_plugin.Description(json.loads(bus_event))
>>> another_description.associate_with(association_table)
>>> deepdark.is_triggered(another_description)
True
DEFAULT_EVENTS = [<Event.DeepDark: 'DeepDark'>]
NUM_OF_SAMPLES = 50
DPT = {'addresses': [], 'fields': {'decoded_value': 4000}, 'name': 'DPT_Value_Lux', 'type': 'knx'}

DPT Value Wsp

class knx_plugin.trigger.dpt_value_wsp.Weak
>>> import io
>>> import json
>>> import knx_stack
>>> import knx_plugin
>>> weak = knx_plugin.trigger.dpt_value_wsp.Weak.make_from_yaml(addresses=[1234])
>>> address_table = knx_stack.AddressTable(knx_stack.Address(4098), [], 255)
>>> association_table = knx_stack.AssociationTable(address_table, [])
>>> groupobject_table = knx_stack.GroupObjectTable()
>>> weak.associate(association_table, groupobject_table)
>>> bus_event = '''
...        {"name": "DPT_Value_Wsp",
...         "addresses": [1234],
...         "fields": {"decoded_value": 1.2}}
... '''
>>> another_description = knx_plugin.Description(json.loads(bus_event))
>>> another_description.associate_with(association_table)
>>> weak.is_triggered(another_description)
True
>>> bus_event = '''
...        {"name": "DPT_Value_Wsp",
...         "addresses": [1234],
...         "fields": {"decoded_value": 2.1}}
... '''
>>> fd = io.StringIO(bus_event)
>>> another_description = knx_plugin.Description(json.loads(bus_event))
>>> another_description.associate_with(association_table)
>>> weak.is_triggered(another_description)
True
DPT = {'addresses': [], 'fields': {'decoded_value': 2.0}, 'name': 'DPT_Value_Wsp', 'type': 'knx'}
DEFAULT_EVENTS = [<Event.Weak: 'Weak'>]
NUM_OF_SAMPLES = 30