2024-02-22 22:09:38 +00:00
|
|
|
"""Implementation of report module."""
|
2024-04-16 18:21:20 +00:00
|
|
|
|
2024-04-17 13:39:24 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2024-02-22 22:09:38 +00:00
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
|
|
|
|
from ...feature import Feature
|
|
|
|
from ..smartmodule import SmartModule
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
from ..smartdevice import SmartDevice
|
|
|
|
|
|
|
|
|
2024-05-11 18:28:18 +00:00
|
|
|
class ReportMode(SmartModule):
|
2024-02-22 22:09:38 +00:00
|
|
|
"""Implementation of report module."""
|
|
|
|
|
|
|
|
REQUIRED_COMPONENT = "report_mode"
|
|
|
|
QUERY_GETTER_NAME = "get_report_mode"
|
|
|
|
|
2024-04-17 13:39:24 +00:00
|
|
|
def __init__(self, device: SmartDevice, module: str):
|
2024-02-22 22:09:38 +00:00
|
|
|
super().__init__(device, module)
|
|
|
|
self._add_feature(
|
|
|
|
Feature(
|
|
|
|
device,
|
2024-05-07 09:13:35 +00:00
|
|
|
id="report_interval",
|
|
|
|
name="Report interval",
|
2024-02-22 22:09:38 +00:00
|
|
|
container=self,
|
|
|
|
attribute_getter="report_interval",
|
2024-06-21 16:42:43 +00:00
|
|
|
unit="s",
|
2024-04-23 17:20:12 +00:00
|
|
|
category=Feature.Category.Debug,
|
2024-06-25 16:30:36 +00:00
|
|
|
type=Feature.Type.Sensor,
|
2024-02-22 22:09:38 +00:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def report_interval(self):
|
|
|
|
"""Reporting interval of a sensor device."""
|
|
|
|
return self._device.sys_info["report_interval"]
|