Make module names consistent and remove redundant module casting (#909)

Address the inconsistent naming of smart modules by removing all "Module" suffixes and aligning filenames with class names. Removes the casting of modules to the correct module type now that is is redundant. Update the adding of iot modules to use the ModuleName class rather than a free string.
This commit is contained in:
Steven B
2024-05-11 19:28:18 +01:00
committed by GitHub
parent 9473d97ad2
commit f259a8f162
34 changed files with 162 additions and 171 deletions

View File

@@ -1,51 +1,51 @@
"""Modules for SMART devices."""
from .alarmmodule import AlarmModule
from .autooffmodule import AutoOffModule
from .battery import BatterySensor
from .alarm import Alarm
from .autooff import AutoOff
from .batterysensor import BatterySensor
from .brightness import Brightness
from .childdevicemodule import ChildDeviceModule
from .cloudmodule import CloudModule
from .colormodule import ColorModule
from .colortemp import ColorTemperatureModule
from .contact import ContactSensor
from .childdevice import ChildDevice
from .cloud import Cloud
from .color import Color
from .colortemperature import ColorTemperature
from .contactsensor import ContactSensor
from .devicemodule import DeviceModule
from .energymodule import EnergyModule
from .fanmodule import FanModule
from .energy import Energy
from .fan import Fan
from .firmware import Firmware
from .frostprotection import FrostProtectionModule
from .humidity import HumiditySensor
from .ledmodule import LedModule
from .lighteffectmodule import LightEffectModule
from .lighttransitionmodule import LightTransitionModule
from .reportmodule import ReportModule
from .temperature import TemperatureSensor
from .frostprotection import FrostProtection
from .humiditysensor import HumiditySensor
from .led import Led
from .lighteffect import LightEffect
from .lighttransition import LightTransition
from .reportmode import ReportMode
from .temperaturecontrol import TemperatureControl
from .timemodule import TimeModule
from .waterleak import WaterleakSensor
from .temperaturesensor import TemperatureSensor
from .time import Time
from .waterleaksensor import WaterleakSensor
__all__ = [
"AlarmModule",
"TimeModule",
"EnergyModule",
"Alarm",
"Time",
"Energy",
"DeviceModule",
"ChildDeviceModule",
"ChildDevice",
"BatterySensor",
"HumiditySensor",
"TemperatureSensor",
"TemperatureControl",
"ReportModule",
"AutoOffModule",
"LedModule",
"ReportMode",
"AutoOff",
"Led",
"Brightness",
"FanModule",
"Fan",
"Firmware",
"CloudModule",
"LightEffectModule",
"LightTransitionModule",
"ColorTemperatureModule",
"ColorModule",
"Cloud",
"LightEffect",
"LightTransition",
"ColorTemperature",
"Color",
"WaterleakSensor",
"ContactSensor",
"FrostProtectionModule",
"FrostProtection",
]

View File

@@ -6,7 +6,7 @@ from ...feature import Feature
from ..smartmodule import SmartModule
class AlarmModule(SmartModule):
class Alarm(SmartModule):
"""Implementation of alarm module."""
REQUIRED_COMPONENT = "alarm"

View File

@@ -12,7 +12,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class AutoOffModule(SmartModule):
class AutoOff(SmartModule):
"""Implementation of auto off module."""
REQUIRED_COMPONENT = "auto_off"

View File

@@ -3,7 +3,7 @@
from ..smartmodule import SmartModule
class ChildDeviceModule(SmartModule):
class ChildDevice(SmartModule):
"""Implementation for child devices."""
REQUIRED_COMPONENT = "child_device"

View File

@@ -12,7 +12,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class CloudModule(SmartModule):
class Cloud(SmartModule):
"""Implementation of cloud module."""
QUERY_GETTER_NAME = "get_connect_cloud_state"

View File

@@ -12,7 +12,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class ColorModule(SmartModule):
class Color(SmartModule):
"""Implementation of color module."""
REQUIRED_COMPONENT = "color"

View File

@@ -18,7 +18,7 @@ _LOGGER = logging.getLogger(__name__)
DEFAULT_TEMP_RANGE = [2500, 6500]
class ColorTemperatureModule(SmartModule):
class ColorTemperature(SmartModule):
"""Implementation of color temp module."""
REQUIRED_COMPONENT = "color_temperature"

View File

@@ -12,7 +12,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class EnergyModule(SmartModule):
class Energy(SmartModule):
"""Implementation of energy monitoring module."""
REQUIRED_COMPONENT = "energy_monitoring"

View File

@@ -11,7 +11,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class FanModule(SmartModule):
class Fan(SmartModule):
"""Implementation of fan_control module."""
REQUIRED_COMPONENT = "fan_control"

View File

@@ -12,7 +12,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class FrostProtectionModule(SmartModule):
class FrostProtection(SmartModule):
"""Implementation for frost protection module.
This basically turns the thermostat on and off.

View File

@@ -2,11 +2,11 @@
from __future__ import annotations
from ...interfaces.led import Led
from ...interfaces.led import Led as LedInterface
from ..smartmodule import SmartModule
class LedModule(SmartModule, Led):
class Led(SmartModule, LedInterface):
"""Implementation of led controls."""
REQUIRED_COMPONENT = "led"

View File

@@ -6,14 +6,14 @@ import base64
import copy
from typing import TYPE_CHECKING, Any
from ...interfaces.lighteffect import LightEffect
from ...interfaces.lighteffect import LightEffect as LightEffectInterface
from ..smartmodule import SmartModule
if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class LightEffectModule(SmartModule, LightEffect):
class LightEffect(SmartModule, LightEffectInterface):
"""Implementation of dynamic light effects."""
REQUIRED_COMPONENT = "light_effect"

View File

@@ -12,7 +12,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class LightTransitionModule(SmartModule):
class LightTransition(SmartModule):
"""Implementation of gradual on/off."""
REQUIRED_COMPONENT = "on_off_gradually"

View File

@@ -11,7 +11,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class ReportModule(SmartModule):
class ReportMode(SmartModule):
"""Implementation of report module."""
REQUIRED_COMPONENT = "report_mode"

View File

@@ -13,7 +13,7 @@ if TYPE_CHECKING:
from ..smartdevice import SmartDevice
class TimeModule(SmartModule):
class Time(SmartModule):
"""Implementation of device_local_time."""
REQUIRED_COMPONENT = "time"