mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 01:37:08 +00:00
Add area support to input boolean service schemas (#25429)
This commit is contained in:
parent
bd2b107575
commit
a5c2a80db3
@ -4,10 +4,11 @@ import logging
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
ATTR_ENTITY_ID, CONF_ICON, CONF_NAME, SERVICE_TURN_OFF, SERVICE_TURN_ON,
|
CONF_ICON, CONF_NAME, SERVICE_TURN_OFF, SERVICE_TURN_ON, SERVICE_TOGGLE,
|
||||||
SERVICE_TOGGLE, STATE_ON)
|
STATE_ON)
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
import homeassistant.helpers.config_validation as cv
|
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 import ToggleEntity
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
@ -20,10 +21,6 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
CONF_INITIAL = 'initial'
|
CONF_INITIAL = 'initial'
|
||||||
|
|
||||||
SERVICE_SCHEMA = vol.Schema({
|
|
||||||
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
|
|
||||||
})
|
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({
|
CONFIG_SCHEMA = vol.Schema({
|
||||||
DOMAIN: cv.schema_with_slug_keys(
|
DOMAIN: cv.schema_with_slug_keys(
|
||||||
vol.Any({
|
vol.Any({
|
||||||
@ -61,17 +58,17 @@ async def async_setup(hass, config):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
component.async_register_entity_service(
|
component.async_register_entity_service(
|
||||||
SERVICE_TURN_ON, SERVICE_SCHEMA,
|
SERVICE_TURN_ON, ENTITY_SERVICE_SCHEMA,
|
||||||
'async_turn_on'
|
'async_turn_on'
|
||||||
)
|
)
|
||||||
|
|
||||||
component.async_register_entity_service(
|
component.async_register_entity_service(
|
||||||
SERVICE_TURN_OFF, SERVICE_SCHEMA,
|
SERVICE_TURN_OFF, ENTITY_SERVICE_SCHEMA,
|
||||||
'async_turn_off'
|
'async_turn_off'
|
||||||
)
|
)
|
||||||
|
|
||||||
component.async_register_entity_service(
|
component.async_register_entity_service(
|
||||||
SERVICE_TOGGLE, SERVICE_SCHEMA,
|
SERVICE_TOGGLE, ENTITY_SERVICE_SCHEMA,
|
||||||
'async_toggle'
|
'async_toggle'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user