mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-08 11:44:02 +00:00
Move feature initialization from __init__ to _initialize_features (#1140)
This commit is contained in:
@@ -2,27 +2,21 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from ...feature import Feature
|
||||
from ...interfaces.fan import Fan as FanInterface
|
||||
from ..smartmodule import SmartModule
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..smartdevice import SmartDevice
|
||||
|
||||
|
||||
class Fan(SmartModule, FanInterface):
|
||||
"""Implementation of fan_control module."""
|
||||
|
||||
REQUIRED_COMPONENT = "fan_control"
|
||||
|
||||
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="fan_speed_level",
|
||||
name="Fan speed level",
|
||||
container=self,
|
||||
@@ -36,7 +30,7 @@ class Fan(SmartModule, FanInterface):
|
||||
)
|
||||
self._add_feature(
|
||||
Feature(
|
||||
device,
|
||||
self._device,
|
||||
id="fan_sleep_mode",
|
||||
name="Fan sleep mode",
|
||||
container=self,
|
||||
|
Reference in New Issue
Block a user