Log template listeners when debug logging is on (#40180)

pull/40243/head
J. Nick Koston 2020-09-17 14:45:30 -05:00 committed by Paulus Schoutsen
parent f77b3d4714
commit 7cb0c98c03
2 changed files with 15 additions and 1 deletions

View File

@ -525,6 +525,11 @@ class _TrackTemplateResultInfo:
self._last_info = self._info.copy()
self._create_listeners()
_LOGGER.debug(
"Template group %s listens for %s",
self._track_templates,
self.listeners,
)
@property
def listeners(self) -> Dict:
@ -683,6 +688,10 @@ class _TrackTemplateResultInfo:
):
continue
_LOGGER.debug(
"Template update %s triggered by event: %s", template.template, event
)
self._info[template] = template.async_render_to_info(
track_template_.variables
)
@ -708,6 +717,11 @@ class _TrackTemplateResultInfo:
if info_changed:
self._update_listeners()
_LOGGER.debug(
"Template group %s listens for %s",
self._track_templates,
self.listeners,
)
self._last_info = self._info.copy()
if not updates:

View File

@ -541,7 +541,7 @@ async def test_track_template_error(hass, caplog):
hass.states.async_set("switch.not_exist", "off")
await hass.async_block_till_done()
assert "lunch" not in caplog.text
assert "no filter named 'lunch'" not in caplog.text
assert "TemplateAssertionError" not in caplog.text