mirror of
https://github.com/home-assistant/core.git
synced 2026-10-01 09:47:53 +01:00
17 lines
618 B
Python
17 lines
618 B
Python
"""Services for the Switch integration."""
|
|
|
|
from homeassistant.const import SERVICE_TOGGLE, SERVICE_TURN_OFF, SERVICE_TURN_ON
|
|
from homeassistant.core import HomeAssistant, callback
|
|
|
|
from .const import DATA_COMPONENT
|
|
|
|
|
|
@callback
|
|
def async_setup_services(hass: HomeAssistant) -> None:
|
|
"""Register the switch services."""
|
|
component = hass.data[DATA_COMPONENT]
|
|
|
|
component.async_register_entity_service(SERVICE_TURN_OFF, None, "async_turn_off")
|
|
component.async_register_entity_service(SERVICE_TURN_ON, None, "async_turn_on")
|
|
component.async_register_entity_service(SERVICE_TOGGLE, None, "async_toggle")
|