File: dpt_29.py

package info (click to toggle)
python-xknx 3.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,044 kB
  • sloc: python: 40,087; javascript: 8,556; makefile: 32; sh: 12
file content (52 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""Implementation of Basic KNX 8-Byte signed (2's complement) values."""

from __future__ import annotations

from .dpt import DPTNumeric, DPTStructIntMixin


class DPT8ByteSigned(DPTStructIntMixin, DPTNumeric):
    """
    Abstraction for KNX 8 Byte "64-bit signed".

    DPT 29.***
    """

    dpt_main_number = 29
    dpt_sub_number: int | None = None
    payload_length = 8
    value_type = "8byte_signed"

    value_min = -9_223_372_036_854_775_808
    value_max = 9_223_372_036_854_775_807
    resolution = 1

    _struct_format = ">q"


class DPTActiveEnergy8Byte(DPT8ByteSigned):
    """DPT 29.010 DPT_Active_Energy_V64."""

    dpt_main_number = 29
    dpt_sub_number = 10
    value_type = "active_energy_8byte"
    unit = "Wh"
    ha_device_class = "energy"


class DPTApparantEnergy8Byte(DPT8ByteSigned):
    """DPT 29.011 DPT_Apparant_Energy_V64 (VAh)."""

    dpt_main_number = 29
    dpt_sub_number = 11
    value_type = "apparant_energy_8byte"
    unit = "VAh"


class DPTReactiveEnergy8Byte(DPT8ByteSigned):
    """DPT 29.012 DPT_Reactive_Energy_V64 (VARh)."""

    dpt_main_number = 29
    dpt_sub_number = 12
    value_type = "reactive_energy_8byte"
    unit = "VARh"