Datapointtypes

class knx_stack.datapointtypes.DPT

An abstract KNX DPT

class Length(value)

An enumeration.

LESS_THAN_A_BYTE = 'less_than_a_byte'
A_BYTE_OR_MORE = 'a_byte_or_more'
length = 'a_byte_or_more'

DPT Factory

class knx_stack.datapointtypes.DPT_Factory
static make(dpt: str, fields_values: dict) knx_stack.datapointtypes.DPT

Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.

Parameters
  • dpt – a DPT name

  • fields_values – a dictionary of values for the DPT’s fields

Returns

a knx_stack.datapointtypes.DPT instance

>>> import knx_stack
>>> factory = knx_stack.datapointtypes.DPT_Factory()
>>> dpt = factory.make("DPT_Control_Dimming", {"step": 7, "direction": "up"})
>>> dpt.step
7
>>> dpt.direction == knx_stack.datapointtypes.DPT_Control_Dimming.Direction.up
True
>>> dpt = factory.make("DPT_Value_Temp", {"decoded_value": -1.0})
>>> dpt.decode()
-1.0

Description Factory

class knx_stack.datapointtypes.Description_Factory
static make(dpt)

Build a Description from a knx_stack.datapointtypes.DPT

A Description is a tuple (dpt name, dictionary with dpt fields values)

Parameters

dpt – knx_stack.datapointtypes.DPT

Returns

a tuple (dpt name, dictionary with dpt fields values)

>>> import knx_stack
>>> factory = knx_stack.datapointtypes.Description_Factory()
>>> switch = knx_stack.datapointtypes.DPT_Switch()
>>> factory.make(switch)
('DPT_Switch', {'action': 'off'})
>>> brightness = knx_stack.datapointtypes.DPT_Value_Lux()
>>> brightness.encode(10000)
>>> factory.make(brightness)
('DPT_Value_Lux', {'decoded_value': 9999.36})

1.001 DPT Switch

class knx_stack.datapointtypes.DPT_Switch
>>> import knx_stack
>>> dpt = knx_stack.datapointtypes.DPT_Switch()
>>> dpt.value = 0x80
>>> dpt.action == dpt.Action.off
True
>>> dpt.value = 0x81
>>> dpt.action == dpt.Action.on
True
>>> dpt.action = "off"
>>> dpt.bits.action
0
length = 'less_than_a_byte'
class Action(value)

An enumeration.

off = 0
on = 1
property action
bits

Structure/Union member

value

Structure/Union member

1.005 DPT Alarm

class knx_stack.datapointtypes.DPT_Alarm
>>> import knx_stack
>>> dpt = knx_stack.datapointtypes.DPT_Alarm()
>>> dpt.value = 0x80
>>> dpt.action == dpt.Action.no_alarm
True
>>> dpt.value = 0x81
>>> dpt.action == dpt.Action.alarm
True
>>> dpt.action = "no_alarm"
>>> dpt.bits.action
0
length = 'less_than_a_byte'
class Action(value)

An enumeration.

no_alarm = 0
alarm = 1
bits

Structure/Union member

value

Structure/Union member

1.008 DPT UpDown

class knx_stack.datapointtypes.DPT_UpDown
>>> import knx_stack
>>> updown = knx_stack.datapointtypes.DPT_UpDown()
>>> updown.value = 0x80
>>> updown.direction == updown.Direction.up
True
>>> updown.value = 0x81
>>> updown.direction == updown.Direction.down
True
>>> updown.direction = "up"
>>> updown.bits.direction
0
length = 'less_than_a_byte'
class Direction(value)

An enumeration.

up = 0
down = 1
property direction
bits

Structure/Union member

value

Structure/Union member

1.010 DPT Start

class knx_stack.datapointtypes.DPT_Start
>>> import knx_stack
>>> start = knx_stack.datapointtypes.DPT_Start()
>>> start.value = 0x80
>>> start.action == start.Action.stop
True
>>> start.value = 0x81
>>> start.action == start.Action.start
True
>>> start.action = "stop"
>>> start.bits.action
0
length = 'less_than_a_byte'
class Action(value)

An enumeration.

stop = 0
start = 1
property action
bits

Structure/Union member

value

Structure/Union member

3.007 DPT Control Dimming

class knx_stack.datapointtypes.DPT_Control_Dimming
>>> import knx_stack
>>> c = knx_stack.datapointtypes.DPT_Control_Dimming()
>>> c.value = 0x0F
>>> c.step == 7
True
>>> c.direction == 1
True
>>> c.direction = "down"
>>> c.value
7
class Direction(value)

An enumeration.

down = 0
up = 1
property step
property direction
bits

Structure/Union member

value

Structure/Union member

7.013 DPT Brightness

class knx_stack.datapointtypes.DPT_Brightness
>>> import knx_stack
>>> brightness = knx_stack.datapointtypes.DPT_Brightness()
>>> brightness.value = 0x32
>>> brightness.value
50
bits

Structure/Union member

value

Structure/Union member

9.001 DPT Value Temp

class knx_stack.datapointtypes.DPT_Value_Temp
>>> import knx_stack
>>> f = knx_stack.datapointtypes.DPT_Value_Temp()
>>> f.value = 1000
>>> f.decode()
10.0
>>> f.value = 1900
>>> f.decode()
19.0

9.004 DPT Value Lux

class knx_stack.datapointtypes.DPT_Value_Lux
>>> import knx_stack
>>> f = knx_stack.datapointtypes.DPT_Value_Lux()
>>> f.value = 1000
>>> f.decode()
10.0
>>> f.encode(30000)
>>> f.value
23992
>>> f.encode(25000)
>>> f.value
23748
>>> f.encode(800)
>>> f.value
13538

9.005 DPT Value Wsp

class knx_stack.datapointtypes.DPT_Value_Wsp
>>> import knx_stack
>>> f = knx_stack.datapointtypes.DPT_Value_Wsp()
>>> f.value = 1000
>>> f.decode()
10.0
>>> f.value = 600
>>> f.decode()
6.0

14.056 DPT Value Power

class knx_stack.datapointtypes.DPT_Value_Power
>>> import knx_stack
>>> f = knx_stack.datapointtypes.DPT_Value_Power()