In Between the mean value plus a range
- class knx_plugin.trigger.mean.InBetween
A trigger triggered when
it has some ASAPs in common with the compared Description and
the knx_stack.datapointtypes.DPT value contained into the trigger is greater than the mean value of knx_stack.datapointtypes.DPT values received from bus and lesser than the mean vlaue plus a given range
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.InBetween().More high is num of samples more slow are changes.
DPT Value Lux
- class knx_plugin.trigger.dpt_value_lux.Dark
>>> import io >>> import json >>> import knx_stack >>> import knx_plugin
>>> dark = knx_plugin.trigger.dpt_value_lux.Dark.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() >>> dark.associate(association_table, groupobject_table)
>>> bus_event = ''' ... {"name": "DPT_Value_Lux", ... "addresses": [1234], ... "fields": {"decoded_value": 9000}} ... ''' >>> another_description = knx_plugin.Description(json.loads(bus_event)) >>> another_description.associate_with(association_table) >>> dark.is_triggered(another_description) True
>>> bus_event = ''' ... {"name": "DPT_Value_Lux", ... "addresses": [1234], ... "fields": {"decoded_value": 60000}} ... ''' >>> another_description = knx_plugin.Description(json.loads(bus_event)) >>> another_description.associate_with(association_table) >>> dark.is_triggered(another_description) False
- DPT = {'addresses': [], 'fields': {'decoded_value': 4000}, 'name': 'DPT_Value_Lux', 'type': 'knx'}
- DEFAULT_EVENTS = [<Event.Dark: 'Dark'>]
- NUM_OF_SAMPLES = 50
- RANGE = 15000
DPT Value Power
- class knx_plugin.trigger.dpt_value_power.consumption.Low
>>> import io >>> import json >>> import knx_stack >>> import knx_plugin
>>> addresses = [knx_stack.GroupAddress(free_style=1234),] >>> low = knx_plugin.trigger.dpt_value_power.consumption.Low.make(addresses=addresses)
>>> address_table = knx_stack.layer.AddressTable(knx_stack.Address(4098), [], 255) >>> association_table = knx_stack.layer.AssociationTable(address_table, []) >>> groupobject_table = knx_stack.GroupObjectTable() >>> low.associate(association_table, groupobject_table)
>>> bus_event = ''' ... {"name": "DPT_Value_Power", ... "addresses": [1234], ... "fields": {"decoded_value": 2}} ... ''' >>> another_description = knx_plugin.Description(json.loads(bus_event)) >>> another_description.associate_with(association_table) >>> low.is_triggered(another_description) True
>>> bus_event = ''' ... {"name": "DPT_Value_Power", ... "addresses": [1234], ... "fields": {"decoded_value": 4000}} ... ''' >>> another_description = knx_plugin.Description(json.loads(bus_event)) >>> another_description.associate_with(association_table) >>> low.is_triggered(another_description) False
- DPT = {'addresses': [], 'fields': {'decoded_value': 1}, 'name': 'DPT_Value_Power', 'type': 'knx'}
- DEFAULT_EVENTS = [<Event.Low: 'Low'>]
- NUM_OF_SAMPLES = 1
- RANGE = 3300
- class knx_plugin.trigger.dpt_value_power.consumption.High
>>> import io >>> import json >>> import knx_stack >>> import knx_plugin
>>> addresses = [knx_stack.GroupAddress(free_style=1234),] >>> low = knx_plugin.trigger.dpt_value_power.consumption.High.make(addresses=addresses)
>>> address_table = knx_stack.AddressTable(knx_stack.Address(4098), [], 255) >>> association_table = knx_stack.AssociationTable(address_table, []) >>> groupobject_table = knx_stack.GroupObjectTable() >>> low.associate(association_table, groupobject_table)
>>> bus_event = ''' ... {"name": "DPT_Value_Power", ... "addresses": [1234], ... "fields": {"decoded_value": 7001}} ... ''' >>> another_description = knx_plugin.Description(json.loads(bus_event)) >>> another_description.associate_with(association_table) >>> low.is_triggered(another_description) True
>>> bus_event = ''' ... {"name": "DPT_Value_Power", ... "addresses": [1234], ... "fields": {"decoded_value": 8000}} ... ''' >>> another_description = knx_plugin.Description(json.loads(bus_event)) >>> another_description.associate_with(association_table) >>> low.is_triggered(another_description) False
- DPT = {'addresses': [], 'fields': {'decoded_value': 7000}, 'name': 'DPT_Value_Power', 'type': 'knx'}
- DEFAULT_EVENTS = [<Event.High: 'High'>]
- NUM_OF_SAMPLES = 1
- RANGE = 699