mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Handle case where timer device id exists but is not registered (delayed command) (#118410)
Handle case where device id exists but is not registered
This commit is contained in:
parent
a0443ac328
commit
43ceb1c6c8
@ -229,7 +229,9 @@ class TimerManager:
|
|||||||
if (not conversation_command) and (device_id is None):
|
if (not conversation_command) and (device_id is None):
|
||||||
raise ValueError("Conversation command must be set if no device id")
|
raise ValueError("Conversation command must be set if no device id")
|
||||||
|
|
||||||
if (device_id is not None) and (not self.is_timer_device(device_id)):
|
if (not conversation_command) and (
|
||||||
|
(device_id is None) or (not self.is_timer_device(device_id))
|
||||||
|
):
|
||||||
raise TimersNotSupportedError(device_id)
|
raise TimersNotSupportedError(device_id)
|
||||||
|
|
||||||
total_seconds = 0
|
total_seconds = 0
|
||||||
@ -276,7 +278,7 @@ class TimerManager:
|
|||||||
name=f"Timer {timer_id}",
|
name=f"Timer {timer_id}",
|
||||||
)
|
)
|
||||||
|
|
||||||
if timer.device_id is not None:
|
if timer.device_id in self.handlers:
|
||||||
self.handlers[timer.device_id](TimerEventType.STARTED, timer)
|
self.handlers[timer.device_id](TimerEventType.STARTED, timer)
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Timer started: id=%s, name=%s, hours=%s, minutes=%s, seconds=%s, device_id=%s",
|
"Timer started: id=%s, name=%s, hours=%s, minutes=%s, seconds=%s, device_id=%s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user