Entity Component to no longer generate automatic groups (#23789)
This commit is contained in:
1 parent
13e6479b6e
commit
9aa02e35a7
41 files changed
+149
-377
No files matched your search
@@ -6,7 +6,6 @@ from typing import Optional
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import group
|
||||
from homeassistant.const import SERVICE_TOGGLE, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.config_validation import ( # noqa: F401
|
||||
@@ -22,9 +21,6 @@ _LOGGER = logging.getLogger(__name__)
|
||||
DOMAIN = "fan"
|
||||
SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
||||
GROUP_NAME_ALL_FANS = "all fans"
|
||||
ENTITY_ID_ALL_FANS = group.ENTITY_ID_FORMAT.format(GROUP_NAME_ALL_FANS)
|
||||
|
||||
ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
||||
|
||||
# Bitfield of features supported by the fan entity
|
||||
@@ -58,9 +54,8 @@ PROP_TO_ATTR = {
|
||||
|
||||
|
||||
@bind_hass
|
||||
def is_on(hass, entity_id: Optional[str] = None) -> bool:
|
||||
def is_on(hass, entity_id: str) -> bool:
|
||||
"""Return if the fans are on based on the statemachine."""
|
||||
entity_id = entity_id or ENTITY_ID_ALL_FANS
|
||||
state = hass.states.get(entity_id)
|
||||
return state.attributes[ATTR_SPEED] not in [SPEED_OFF, None]
|
||||
|
||||
@@ -68,7 +63,7 @@ def is_on(hass, entity_id: Optional[str] = None) -> bool:
|
||||
async def async_setup(hass, config: dict):
|
||||
"""Expose fan control via statemachine and services."""
|
||||
component = hass.data[DOMAIN] = EntityComponent(
|
||||
_LOGGER, DOMAIN, hass, SCAN_INTERVAL, GROUP_NAME_ALL_FANS
|
||||
_LOGGER, DOMAIN, hass, SCAN_INTERVAL
|
||||
)
|
||||
|
||||
await component.async_setup(config)
|
||||
|
||||
Reference in new issue
Block a user