Move feature initialization from __init__ to _initialize_features (#1140)

This commit is contained in:
Teemu R.
2024-09-28 20:14:31 +02:00
committed by GitHub
parent 2922c3f574
commit d897503b58
11 changed files with 41 additions and 84 deletions

View File

@@ -2,14 +2,9 @@
from __future__ import annotations
from typing import TYPE_CHECKING
from ...feature import Feature
from ..smartmodule import SmartModule
if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class HumiditySensor(SmartModule):
"""Implementation of humidity module."""
@@ -17,11 +12,11 @@ class HumiditySensor(SmartModule):
REQUIRED_COMPONENT = "humidity"
QUERY_GETTER_NAME = "get_comfort_humidity_config"
def __init__(self, device: SmartDevice, module: str):
super().__init__(device, module)
def _initialize_features(self):
"""Initialize features after the initial update."""
self._add_feature(
Feature(
device,
self._device,
id="humidity",
name="Humidity",
container=self,
@@ -34,7 +29,7 @@ class HumiditySensor(SmartModule):
)
self._add_feature(
Feature(
device,
self._device,
id="humidity_warning",
name="Humidity warning",
container=self,