Do not select all entities when omitting entity ID in service call (#29178)
* Do not select all entities when omitting entity ID * Address comments Matthew * Require either area_id or entity_id * Fix tests * Fix test
This commit is contained in:
parent
9587afc5ce
commit
02d9ed5e36
47 changed files with 538 additions and 626 deletions
|
@ -13,7 +13,6 @@ from homeassistant.const import (
|
|||
)
|
||||
from homeassistant.loader import bind_hass
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.config_validation import ENTITY_SERVICE_SCHEMA
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
|
@ -68,17 +67,11 @@ async def async_setup(hass, config):
|
|||
if not entities:
|
||||
return False
|
||||
|
||||
component.async_register_entity_service(
|
||||
SERVICE_TURN_ON, ENTITY_SERVICE_SCHEMA, "async_turn_on"
|
||||
)
|
||||
component.async_register_entity_service(SERVICE_TURN_ON, {}, "async_turn_on")
|
||||
|
||||
component.async_register_entity_service(
|
||||
SERVICE_TURN_OFF, ENTITY_SERVICE_SCHEMA, "async_turn_off"
|
||||
)
|
||||
component.async_register_entity_service(SERVICE_TURN_OFF, {}, "async_turn_off")
|
||||
|
||||
component.async_register_entity_service(
|
||||
SERVICE_TOGGLE, ENTITY_SERVICE_SCHEMA, "async_toggle"
|
||||
)
|
||||
component.async_register_entity_service(SERVICE_TOGGLE, {}, "async_toggle")
|
||||
|
||||
await component.async_add_entities(entities)
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue