mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Tidy up service call for bosch_alarm (#145306)
tidy up service call for bosch_alarm
This commit is contained in:
parent
e39c8e350c
commit
d15a1a6711
@ -38,15 +38,12 @@ SET_DATE_TIME_SCHEMA = vol.Schema(
|
||||
)
|
||||
|
||||
|
||||
def setup_services(hass: HomeAssistant) -> None:
|
||||
"""Set up the services for the bosch alarm integration."""
|
||||
|
||||
async def async_set_panel_date(call: ServiceCall) -> None:
|
||||
async def async_set_panel_date(call: ServiceCall) -> None:
|
||||
"""Set the date and time on a bosch alarm panel."""
|
||||
config_entry: BoschAlarmConfigEntry | None
|
||||
value: dt.datetime = call.data.get(ATTR_DATETIME, dt_util.now())
|
||||
entry_id = call.data[ATTR_CONFIG_ENTRY_ID]
|
||||
if not (config_entry := hass.config_entries.async_get_entry(entry_id)):
|
||||
if not (config_entry := call.hass.config_entries.async_get_entry(entry_id)):
|
||||
raise ServiceValidationError(
|
||||
translation_domain=DOMAIN,
|
||||
translation_key="integration_not_found",
|
||||
@ -68,6 +65,10 @@ def setup_services(hass: HomeAssistant) -> None:
|
||||
translation_placeholders={"target": config_entry.title},
|
||||
) from err
|
||||
|
||||
|
||||
def setup_services(hass: HomeAssistant) -> None:
|
||||
"""Set up the services for the bosch alarm integration."""
|
||||
|
||||
hass.services.async_register(
|
||||
DOMAIN,
|
||||
SERVICE_SET_DATE_TIME,
|
||||
|
Loading…
x
Reference in New Issue
Block a user