Remove warning on script delay (#17264)
* Remove warning on script delay * Use suppress
This commit is contained in:
parent
540d22d603
commit
5db7d702c8
1 changed files with 6 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
"""Helpers to execute scripts."""
|
||||
|
||||
import logging
|
||||
from contextlib import suppress
|
||||
from itertools import islice
|
||||
from typing import Optional, Sequence
|
||||
|
||||
|
@ -95,7 +96,9 @@ class Script():
|
|||
def async_script_delay(now):
|
||||
"""Handle delay."""
|
||||
# pylint: disable=cell-var-from-loop
|
||||
self._async_remove_listener()
|
||||
with suppress(ValueError):
|
||||
self._async_listener.remove(unsub)
|
||||
|
||||
self.hass.async_create_task(
|
||||
self.async_run(variables, context))
|
||||
|
||||
|
@ -240,7 +243,8 @@ class Script():
|
|||
@callback
|
||||
def async_script_timeout(now):
|
||||
"""Call after timeout is retrieve."""
|
||||
self._async_remove_listener()
|
||||
with suppress(ValueError):
|
||||
self._async_listener.remove(unsub)
|
||||
|
||||
# Check if we want to continue to execute
|
||||
# the script after the timeout
|
||||
|
|
Loading…
Add table
Reference in a new issue