mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Refactored generation variable for indevolt (#169396)
This commit is contained in:
@@ -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 = (
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = (
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user