From b26928878f037987a261afd831575deee725ab3a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 15 Mar 2024 14:51:21 -1000 Subject: [PATCH] Remove group integration platforms that use the default states (#113562) Remove group integration platforms that use the default There is no need to register platforms that use the defaults as the group code already uses STATE_ON/STATE_OFF when there are no on/off states in the GroupIntegrationRegistry --- homeassistant/components/air_quality/group.py | 8 ++++++-- .../components/alarm_control_panel/group.py | 9 +++++++-- homeassistant/components/binary_sensor/__init__.py | 2 -- homeassistant/components/binary_sensor/group.py | 13 ------------- homeassistant/components/climate/group.py | 8 ++++++-- homeassistant/components/cover/group.py | 8 ++++++-- homeassistant/components/device_tracker/group.py | 8 ++++++-- homeassistant/components/fan/__init__.py | 2 -- homeassistant/components/fan/group.py | 13 ------------- homeassistant/components/humidifier/__init__.py | 1 - homeassistant/components/humidifier/group.py | 13 ------------- homeassistant/components/light/__init__.py | 2 -- homeassistant/components/light/group.py | 13 ------------- homeassistant/components/lock/group.py | 8 ++++++-- homeassistant/components/media_player/group.py | 8 ++++++-- homeassistant/components/person/group.py | 8 ++++++-- homeassistant/components/plant/group.py | 8 ++++++-- homeassistant/components/remote/__init__.py | 2 -- homeassistant/components/remote/group.py | 13 ------------- homeassistant/components/sensor/group.py | 8 ++++++-- homeassistant/components/switch/__init__.py | 1 - homeassistant/components/switch/group.py | 13 ------------- homeassistant/components/vacuum/group.py | 7 +++++-- homeassistant/components/water_heater/group.py | 7 +++++-- homeassistant/components/weather/group.py | 8 ++++++-- 25 files changed, 77 insertions(+), 114 deletions(-) delete mode 100644 homeassistant/components/binary_sensor/group.py delete mode 100644 homeassistant/components/fan/group.py delete mode 100644 homeassistant/components/humidifier/group.py delete mode 100644 homeassistant/components/light/group.py delete mode 100644 homeassistant/components/remote/group.py delete mode 100644 homeassistant/components/switch/group.py diff --git a/homeassistant/components/air_quality/group.py b/homeassistant/components/air_quality/group.py index 162457d336f..13a70cc4b6b 100644 --- a/homeassistant/components/air_quality/group.py +++ b/homeassistant/components/air_quality/group.py @@ -1,12 +1,16 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.exclude_domain() diff --git a/homeassistant/components/alarm_control_panel/group.py b/homeassistant/components/alarm_control_panel/group.py index 69a5e6d367e..3ef1ff96cda 100644 --- a/homeassistant/components/alarm_control_panel/group.py +++ b/homeassistant/components/alarm_control_panel/group.py @@ -1,6 +1,8 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry + +from typing import TYPE_CHECKING + from homeassistant.const import ( STATE_ALARM_ARMED_AWAY, STATE_ALARM_ARMED_CUSTOM_BYPASS, @@ -12,10 +14,13 @@ from homeassistant.const import ( ) from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/binary_sensor/__init__.py b/homeassistant/components/binary_sensor/__init__.py index b9f612257b6..4fd99c309bc 100644 --- a/homeassistant/components/binary_sensor/__init__.py +++ b/homeassistant/components/binary_sensor/__init__.py @@ -28,8 +28,6 @@ from homeassistant.helpers.entity import Entity, EntityDescription from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.typing import ConfigType -from . import group as group_pre_import # noqa: F401 - if TYPE_CHECKING: from functools import cached_property else: diff --git a/homeassistant/components/binary_sensor/group.py b/homeassistant/components/binary_sensor/group.py deleted file mode 100644 index e1a0b18dd08..00000000000 --- a/homeassistant/components/binary_sensor/group.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Describe group states.""" - -from homeassistant.components.group import GroupIntegrationRegistry -from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.core import HomeAssistant, callback - - -@callback -def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry -) -> None: - """Describe group on off states.""" - registry.on_off_states({STATE_ON}, STATE_OFF) diff --git a/homeassistant/components/climate/group.py b/homeassistant/components/climate/group.py index 45d6a9b5fcb..f0b7a748740 100644 --- a/homeassistant/components/climate/group.py +++ b/homeassistant/components/climate/group.py @@ -1,15 +1,19 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import STATE_OFF from homeassistant.core import HomeAssistant, callback from .const import HVAC_MODES, HVACMode +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/cover/group.py b/homeassistant/components/cover/group.py index 78335286d10..a4b682b84ff 100644 --- a/homeassistant/components/cover/group.py +++ b/homeassistant/components/cover/group.py @@ -1,13 +1,17 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import STATE_CLOSED, STATE_OPEN from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" # On means open, Off means closed diff --git a/homeassistant/components/device_tracker/group.py b/homeassistant/components/device_tracker/group.py index 97e9556eaeb..e1b93696aa9 100644 --- a/homeassistant/components/device_tracker/group.py +++ b/homeassistant/components/device_tracker/group.py @@ -1,13 +1,17 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import STATE_HOME, STATE_NOT_HOME from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states({STATE_HOME}, STATE_NOT_HOME) diff --git a/homeassistant/components/fan/__init__.py b/homeassistant/components/fan/__init__.py index d39e38f8e25..aeb3a6c89df 100644 --- a/homeassistant/components/fan/__init__.py +++ b/homeassistant/components/fan/__init__.py @@ -40,8 +40,6 @@ from homeassistant.util.percentage import ( ranged_value_to_percentage, ) -from . import group as group_pre_import # noqa: F401 - if TYPE_CHECKING: from functools import cached_property else: diff --git a/homeassistant/components/fan/group.py b/homeassistant/components/fan/group.py deleted file mode 100644 index e1a0b18dd08..00000000000 --- a/homeassistant/components/fan/group.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Describe group states.""" - -from homeassistant.components.group import GroupIntegrationRegistry -from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.core import HomeAssistant, callback - - -@callback -def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry -) -> None: - """Describe group on off states.""" - registry.on_off_states({STATE_ON}, STATE_OFF) diff --git a/homeassistant/components/humidifier/__init__.py b/homeassistant/components/humidifier/__init__.py index 5dba7d8e32c..97f78aba21c 100644 --- a/homeassistant/components/humidifier/__init__.py +++ b/homeassistant/components/humidifier/__init__.py @@ -34,7 +34,6 @@ from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass -from . import group as group_pre_import # noqa: F401 from .const import ( # noqa: F401 _DEPRECATED_DEVICE_CLASS_DEHUMIDIFIER, _DEPRECATED_DEVICE_CLASS_HUMIDIFIER, diff --git a/homeassistant/components/humidifier/group.py b/homeassistant/components/humidifier/group.py deleted file mode 100644 index e1a0b18dd08..00000000000 --- a/homeassistant/components/humidifier/group.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Describe group states.""" - -from homeassistant.components.group import GroupIntegrationRegistry -from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.core import HomeAssistant, callback - - -@callback -def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry -) -> None: - """Describe group on off states.""" - registry.on_off_states({STATE_ON}, STATE_OFF) diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 610dc662369..0a41ca2a84e 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -34,8 +34,6 @@ from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass import homeassistant.util.color as color_util -from . import group as group_pre_import # noqa: F401 - if TYPE_CHECKING: from functools import cached_property else: diff --git a/homeassistant/components/light/group.py b/homeassistant/components/light/group.py deleted file mode 100644 index e1a0b18dd08..00000000000 --- a/homeassistant/components/light/group.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Describe group states.""" - -from homeassistant.components.group import GroupIntegrationRegistry -from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.core import HomeAssistant, callback - - -@callback -def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry -) -> None: - """Describe group on off states.""" - registry.on_off_states({STATE_ON}, STATE_OFF) diff --git a/homeassistant/components/lock/group.py b/homeassistant/components/lock/group.py index 03e576af307..99109e852f6 100644 --- a/homeassistant/components/lock/group.py +++ b/homeassistant/components/lock/group.py @@ -1,13 +1,17 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import STATE_LOCKED, STATE_UNLOCKED from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states({STATE_UNLOCKED}, STATE_LOCKED) diff --git a/homeassistant/components/media_player/group.py b/homeassistant/components/media_player/group.py index 2194f71edf4..f4d465922af 100644 --- a/homeassistant/components/media_player/group.py +++ b/homeassistant/components/media_player/group.py @@ -1,6 +1,7 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import ( STATE_IDLE, STATE_OFF, @@ -10,10 +11,13 @@ from homeassistant.const import ( ) from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/person/group.py b/homeassistant/components/person/group.py index 97e9556eaeb..e1b93696aa9 100644 --- a/homeassistant/components/person/group.py +++ b/homeassistant/components/person/group.py @@ -1,13 +1,17 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import STATE_HOME, STATE_NOT_HOME from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states({STATE_HOME}, STATE_NOT_HOME) diff --git a/homeassistant/components/plant/group.py b/homeassistant/components/plant/group.py index 0a29f748a76..96d4166fe1f 100644 --- a/homeassistant/components/plant/group.py +++ b/homeassistant/components/plant/group.py @@ -1,13 +1,17 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import STATE_OK, STATE_PROBLEM from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states({STATE_PROBLEM}, STATE_OK) diff --git a/homeassistant/components/remote/__init__.py b/homeassistant/components/remote/__init__.py index e8f100a1e8c..fffbc913fe8 100644 --- a/homeassistant/components/remote/__init__.py +++ b/homeassistant/components/remote/__init__.py @@ -37,8 +37,6 @@ from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass -from . import group as group_pre_import # noqa: F401 - if TYPE_CHECKING: from functools import cached_property else: diff --git a/homeassistant/components/remote/group.py b/homeassistant/components/remote/group.py deleted file mode 100644 index e1a0b18dd08..00000000000 --- a/homeassistant/components/remote/group.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Describe group states.""" - -from homeassistant.components.group import GroupIntegrationRegistry -from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.core import HomeAssistant, callback - - -@callback -def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry -) -> None: - """Describe group on off states.""" - registry.on_off_states({STATE_ON}, STATE_OFF) diff --git a/homeassistant/components/sensor/group.py b/homeassistant/components/sensor/group.py index 162457d336f..13a70cc4b6b 100644 --- a/homeassistant/components/sensor/group.py +++ b/homeassistant/components/sensor/group.py @@ -1,12 +1,16 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.exclude_domain() diff --git a/homeassistant/components/switch/__init__.py b/homeassistant/components/switch/__init__.py index e8fcaf1223e..86c67248eea 100644 --- a/homeassistant/components/switch/__init__.py +++ b/homeassistant/components/switch/__init__.py @@ -33,7 +33,6 @@ from homeassistant.helpers.entity_component import EntityComponent from homeassistant.helpers.typing import ConfigType from homeassistant.loader import bind_hass -from . import group as group_pre_import # noqa: F401 from .const import DOMAIN if TYPE_CHECKING: diff --git a/homeassistant/components/switch/group.py b/homeassistant/components/switch/group.py deleted file mode 100644 index e1a0b18dd08..00000000000 --- a/homeassistant/components/switch/group.py +++ /dev/null @@ -1,13 +0,0 @@ -"""Describe group states.""" - -from homeassistant.components.group import GroupIntegrationRegistry -from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.core import HomeAssistant, callback - - -@callback -def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry -) -> None: - """Describe group on off states.""" - registry.on_off_states({STATE_ON}, STATE_OFF) diff --git a/homeassistant/components/vacuum/group.py b/homeassistant/components/vacuum/group.py index e856bd460c0..3e874ec22e7 100644 --- a/homeassistant/components/vacuum/group.py +++ b/homeassistant/components/vacuum/group.py @@ -1,15 +1,18 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry from .const import STATE_CLEANING, STATE_ERROR, STATE_RETURNING @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/water_heater/group.py b/homeassistant/components/water_heater/group.py index 7ae13131210..72347c8a442 100644 --- a/homeassistant/components/water_heater/group.py +++ b/homeassistant/components/water_heater/group.py @@ -1,9 +1,12 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.const import STATE_OFF from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry from .const import ( STATE_ECO, STATE_ELECTRIC, @@ -16,7 +19,7 @@ from .const import ( @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/weather/group.py b/homeassistant/components/weather/group.py index 162457d336f..13a70cc4b6b 100644 --- a/homeassistant/components/weather/group.py +++ b/homeassistant/components/weather/group.py @@ -1,12 +1,16 @@ """Describe group states.""" -from homeassistant.components.group import GroupIntegrationRegistry +from typing import TYPE_CHECKING + from homeassistant.core import HomeAssistant, callback +if TYPE_CHECKING: + from homeassistant.components.group import GroupIntegrationRegistry + @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: GroupIntegrationRegistry + hass: HomeAssistant, registry: "GroupIntegrationRegistry" ) -> None: """Describe group on off states.""" registry.exclude_domain()