From db2dfbbc4126de612c26b4444d60f437a1a290ff Mon Sep 17 00:00:00 2001 From: "A. Gideonse" Date: Mon, 4 May 2026 14:53:02 +0200 Subject: [PATCH] Refactored generation variable for indevolt (#169396) --- homeassistant/components/indevolt/button.py | 4 ++-- homeassistant/components/indevolt/number.py | 12 ++++++------ homeassistant/components/indevolt/select.py | 2 +- homeassistant/components/indevolt/switch.py | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/homeassistant/components/indevolt/button.py b/homeassistant/components/indevolt/button.py index 4dfa0fd83d7..53461602315 100644 --- a/homeassistant/components/indevolt/button.py +++ b/homeassistant/components/indevolt/button.py @@ -1,6 +1,6 @@ """Button platform for Indevolt integration.""" -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import Final from indevolt_api import IndevoltRealtimeAction @@ -20,7 +20,7 @@ PARALLEL_UPDATES = 0 class IndevoltButtonEntityDescription(ButtonEntityDescription): """Custom entity description class for Indevolt button entities.""" - generation: list[int] = field(default_factory=lambda: [1, 2]) + generation: tuple[int, ...] = (1, 2) BUTTONS: Final = ( diff --git a/homeassistant/components/indevolt/number.py b/homeassistant/components/indevolt/number.py index efcd13ce643..5458245f6d9 100644 --- a/homeassistant/components/indevolt/number.py +++ b/homeassistant/components/indevolt/number.py @@ -1,6 +1,6 @@ """Number platform for Indevolt integration.""" -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import Final from indevolt_api import IndevoltConfig @@ -27,15 +27,15 @@ PARALLEL_UPDATES = 0 class IndevoltNumberEntityDescription(NumberEntityDescription): """Custom entity description class for Indevolt number entities.""" - generation: list[int] = field(default_factory=lambda: [1, 2]) read_key: str write_key: str + generation: tuple[int, ...] = (1, 2) NUMBERS: Final = ( IndevoltNumberEntityDescription( key="discharge_limit", - generation=[2], + generation=(2,), translation_key="discharge_limit", read_key=IndevoltConfig.READ_DISCHARGE_LIMIT, write_key=IndevoltConfig.WRITE_DISCHARGE_LIMIT, @@ -46,7 +46,7 @@ NUMBERS: Final = ( ), IndevoltNumberEntityDescription( key="max_ac_output_power", - generation=[2], + generation=(2,), translation_key="max_ac_output_power", read_key=IndevoltConfig.READ_MAX_AC_OUTPUT_POWER, write_key=IndevoltConfig.WRITE_MAX_AC_OUTPUT_POWER, @@ -58,7 +58,7 @@ NUMBERS: Final = ( ), IndevoltNumberEntityDescription( key="inverter_input_limit", - generation=[2], + generation=(2,), translation_key="inverter_input_limit", read_key=IndevoltConfig.READ_INVERTER_INPUT_LIMIT, write_key=IndevoltConfig.WRITE_INVERTER_INPUT_LIMIT, @@ -70,7 +70,7 @@ NUMBERS: Final = ( ), IndevoltNumberEntityDescription( key="feedin_power_limit", - generation=[2], + generation=(2,), translation_key="feedin_power_limit", read_key=IndevoltConfig.READ_FEEDIN_POWER_LIMIT, write_key=IndevoltConfig.WRITE_FEEDIN_POWER_LIMIT, diff --git a/homeassistant/components/indevolt/select.py b/homeassistant/components/indevolt/select.py index 9db9790ef43..31b6f09b9d3 100644 --- a/homeassistant/components/indevolt/select.py +++ b/homeassistant/components/indevolt/select.py @@ -25,7 +25,7 @@ class IndevoltSelectEntityDescription(SelectEntityDescription): write_key: str value_to_option: dict[IndevoltEnergyMode, str] unavailable_values: list[IndevoltEnergyMode] = field(default_factory=list) - generation: list[int] = field(default_factory=lambda: [1, 2]) + generation: tuple[int, ...] = (1, 2) SELECTS: Final = ( diff --git a/homeassistant/components/indevolt/switch.py b/homeassistant/components/indevolt/switch.py index a9b11f47219..203f8ba4195 100644 --- a/homeassistant/components/indevolt/switch.py +++ b/homeassistant/components/indevolt/switch.py @@ -1,6 +1,6 @@ """Switch platform for Indevolt integration.""" -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import Any, Final from indevolt_api import IndevoltConfig @@ -29,14 +29,14 @@ class IndevoltSwitchEntityDescription(SwitchEntityDescription): write_key: str read_on_value: int = 1 read_off_value: int = 0 - generation: list[int] = field(default_factory=lambda: [1, 2]) + generation: tuple[int, ...] = (1, 2) SWITCHES: Final = ( IndevoltSwitchEntityDescription( key="grid_charging", translation_key="grid_charging", - generation=[2], + generation=(2,), read_key=IndevoltConfig.READ_GRID_CHARGING, write_key=IndevoltConfig.WRITE_GRID_CHARGING, read_on_value=1001, @@ -46,7 +46,7 @@ SWITCHES: Final = ( IndevoltSwitchEntityDescription( key="light", translation_key="light", - generation=[2], + generation=(2,), read_key=IndevoltConfig.READ_LIGHT, write_key=IndevoltConfig.WRITE_LIGHT, device_class=SwitchDeviceClass.SWITCH, @@ -54,7 +54,7 @@ SWITCHES: Final = ( IndevoltSwitchEntityDescription( key="bypass", translation_key="bypass", - generation=[2], + generation=(2,), read_key=IndevoltConfig.READ_BYPASS, write_key=IndevoltConfig.WRITE_BYPASS, device_class=SwitchDeviceClass.SWITCH,