Entity Component to no longer generate automatic groups (#23789)
This commit is contained in:
parent
13e6479b6e
commit
9aa02e35a7
41 changed files with 149 additions and 377 deletions
|
@ -5,7 +5,6 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import group
|
||||
from homeassistant.const import (
|
||||
SERVICE_TOGGLE,
|
||||
SERVICE_TURN_OFF,
|
||||
|
@ -38,11 +37,8 @@ ATTR_TIMEOUT = "timeout"
|
|||
DOMAIN = "remote"
|
||||
SCAN_INTERVAL = timedelta(seconds=30)
|
||||
|
||||
ENTITY_ID_ALL_REMOTES = group.ENTITY_ID_FORMAT.format("all_remotes")
|
||||
ENTITY_ID_FORMAT = DOMAIN + ".{}"
|
||||
|
||||
GROUP_NAME_ALL_REMOTES = "all remotes"
|
||||
|
||||
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=10)
|
||||
|
||||
SERVICE_SEND_COMMAND = "send_command"
|
||||
|
@ -61,17 +57,14 @@ REMOTE_SERVICE_ACTIVITY_SCHEMA = make_entity_service_schema(
|
|||
|
||||
|
||||
@bind_hass
|
||||
def is_on(hass, entity_id=None):
|
||||
def is_on(hass, entity_id):
|
||||
"""Return if the remote is on based on the statemachine."""
|
||||
entity_id = entity_id or ENTITY_ID_ALL_REMOTES
|
||||
return hass.states.is_state(entity_id, STATE_ON)
|
||||
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Track states and offer events for remotes."""
|
||||
component = EntityComponent(
|
||||
_LOGGER, DOMAIN, hass, SCAN_INTERVAL, GROUP_NAME_ALL_REMOTES
|
||||
)
|
||||
component = EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
|
||||
await component.async_setup(config)
|
||||
|
||||
component.async_register_entity_service(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue