File: sensor_property.py

package info (click to toggle)
devolo-home-control-api 0.19.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 804 kB
  • sloc: python: 3,167; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 787 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
"""Generic Sensors."""
from abc import ABC
from datetime import tzinfo

from .property import Property


class SensorProperty(Property, ABC):
    """
    Abstract object for sensors. It stores the sensor and sub type.

    :param element_uid: Element UID
    :param tz: Timezone the last activity is recorded in
    :key sensor_type: Type of the sensor sensor, something like 'alarm'
    :type sensor_type: str
    :key sub_type: Subtype of the sensor, something like 'overload'
    :type sub_type: str
    """

    def __init__(self, element_uid: str, tz: tzinfo, **kwargs: str) -> None:
        """Initialize the sensor."""
        super().__init__(element_uid, tz)

        self.sensor_type: str = kwargs.pop("sensor_type", "")
        self.sub_type: str = kwargs.pop("sub_type", "")