Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

knx: Add dpt 5003 #844

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion knx/dpts.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ def de5001(payload):
return round(struct.unpack('>B', payload)[0] * 100.0 / 255, 1)


def en5003(value):
value = value % 360
return [0, int(value * 255.0 / 360) & 0xff]


def de5003(payload):
if len(payload) != 1:
return None
return round(struct.unpack('>B', payload)[0] * 360.0 / 255, 1)


def en5999(value):
# artificial data point for tebis TS systems
if value < 0:
Expand Down Expand Up @@ -545,6 +556,8 @@ def dega(string):
'5': de5,
'5001': de5001,
'5.001': de5001,
'5003': de5003, #DPT_Angle [0..360] °
'5.003': de5003, #DPT_Angle [0..360] °
'5999': de5999,
'5.999': de5999,
'6': de6,
Expand Down Expand Up @@ -591,7 +604,8 @@ def dega(string):
'5': en5, #One Byte: unsigned value
'5001': en5001, #DPT_Scaling [0 ... 100] %
'5.001': en5001, #DPT_Scaling [0 ... 100] %
# 5.003 -> DPT_Angle [0..360] °
'5003': en5003, #DPT_Angle [0..360] °
'5.003': en5003, #DPT_Angle [0..360] °
# 5.004 -> DPT_Percent_U8 [0..255] %
# 5.005 -> DPT_DecimalFactor
'5999': en5999, #artificial data point for tebis TS systems
Expand Down
12 changes: 12 additions & 0 deletions knx/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ item_attributes:
- '5'
- '5001'
- '5.001'
- '5003'
- '5.003'
- '5999'
- '5.999'
- '6'
Expand Down Expand Up @@ -210,6 +212,8 @@ item_attributes:
- 'Relativwert, 0 … 255 (8 Bit) -> num'
- 'Relativwert, 0 … 100 % (8 Bit) -> num'
- 'Relativwert, 0 … 100 % (8 Bit) -> num'
- 'Winkel, 0 … 360 ° (8 Bit) -> num'
- 'Winkel, 0 … 360 ° (8 Bit) -> num'
- 'Spezial DPT für Tebis TS Systeme, (8 Bit) -> num'
- 'Spezial DPT für Tebis TS Systeme, (8 Bit) -> num'
- 'Ganzzahl -128 - 127 (8 Bit) -> num'
Expand Down Expand Up @@ -246,6 +250,8 @@ item_attributes:
- 'Relative value, 0 … 255 (8 Bit) -> num'
- 'Relative value, 0 … 100 % (8 Bit) -> num'
- 'Relative value, 0 … 100 % (8 Bit) -> num'
- 'Angle value, 0 … 360 ° (8 Bit) -> num'
- 'Angle value, 0 … 360 ° (8 Bit) -> num'
- 'Special DPT for Tebis TS systems, (8 Bit) -> num'
- 'Special DPT for Tebis TS systems, (8 Bit) -> num'
- 'Integer -128 - 127 (8 Bit) -> num'
Expand Down Expand Up @@ -385,6 +391,8 @@ plugin_functions:
- '5'
- '5001'
- '5.001'
- '5003'
- '5.003'
- '5999'
- '5.999'
- '6'
Expand Down Expand Up @@ -421,6 +429,8 @@ plugin_functions:
- 'Relativwert, 0 … 255 (8 Bit) -> num'
- 'Relativwert, 0 … 100 % (8 Bit) -> num'
- 'Relativwert, 0 … 100 % (8 Bit) -> num'
- 'Winkel, 0 … 360 ° (8 Bit) -> num'
- 'Winkel, 0 … 360 ° (8 Bit) -> num'
- 'Spezial DPT für Tebis TS Systeme, (8 Bit) -> num'
- 'Spezial DPT für Tebis TS Systeme, (8 Bit) -> num'
- 'Ganzzahl -128 - 127 (8 Bit) -> num'
Expand Down Expand Up @@ -456,6 +466,8 @@ plugin_functions:
- 'Relative value, 0 … 255 (8 Bit) -> num'
- 'Relative value, 0 … 100 % (8 Bit) -> num'
- 'Relative value, 0 … 100 % (8 Bit) -> num'
- 'Angle value, 0 … 360 ° (8 Bit) -> num'
- 'Angle value, 0 … 360 ° (8 Bit) -> num'
- 'Special DPT for Tebis TS systems, (8 Bit) -> num'
- 'Special DPT for Tebis TS systems, (8 Bit) -> num'
- 'Integer -128 - 127 (8 Bit) -> num'
Expand Down