diff --git a/custom_components/daily_schedule/binary_sensor.py b/custom_components/daily_schedule/binary_sensor.py index 5831c4f..f9cf468 100644 --- a/custom_components/daily_schedule/binary_sensor.py +++ b/custom_components/daily_schedule/binary_sensor.py @@ -1,4 +1,5 @@ """Support for representing daily schedule as binary sensors.""" + from __future__ import annotations from collections.abc import Callable, MutableMapping @@ -39,7 +40,7 @@ def remove_micros_and_tz(time: datetime.time) -> str: }, extra=vol.ALLOW_EXTRA, ) -SERVICE_SET_SCHEMA = vol.Schema( +SERVICE_SET_SCHEMA = cv.make_entity_service_schema( { vol.Required(CONF_SCHEDULE): vol.All(cv.ensure_list, [ENTRY_SCHEMA]), }, diff --git a/tests/test_binary_sensor.py b/tests/test_binary_sensor.py index 1a469e2..68dfed3 100644 --- a/tests/test_binary_sensor.py +++ b/tests/test_binary_sensor.py @@ -1,4 +1,5 @@ """The tests for the daily schedule sensor component.""" + from __future__ import annotations import datetime @@ -275,7 +276,8 @@ async def test_set(hass): await hass.services.async_call( DOMAIN, SERVICE_SET, - {ATTR_ENTITY_ID: entity_id, CONF_SCHEDULE: schedule2}, + {CONF_SCHEDULE: schedule2}, + target={ATTR_ENTITY_ID: entity_id}, ) await hass.async_block_till_done() assert hass.states.get(entity_id).attributes[CONF_SCHEDULE] == schedule2