Skip to content

Commit

Permalink
Merge pull request #92 from amitfin/make_entity_service_schema
Browse files Browse the repository at this point in the history
make_entity_service_schema
  • Loading branch information
amitfin authored Sep 2, 2024
2 parents 263003c + 7de64e7 commit 2f469cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion custom_components/daily_schedule/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Support for representing daily schedule as binary sensors."""

from __future__ import annotations

from collections.abc import Callable, MutableMapping
Expand Down Expand Up @@ -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]),
},
Expand Down
4 changes: 3 additions & 1 deletion tests/test_binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The tests for the daily schedule sensor component."""

from __future__ import annotations

import datetime
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2f469cc

Please sign in to comment.