render_with_collect method for template (#23283)

* Make entity_filter be a modifiable builder

* Add render_with_collect method

* Use sync render_with_collect and non-class based test case

* Refactor: Template renders to RenderInfo

* Freeze with exception too

* Finish merging test changes

* Removed unused sync interface

* Final bits of the diff
This commit is contained in:
Penny Wood 2019-05-01 10:54:25 +08:00 committed by GitHub
parent 581b16e9fa
commit 5b9d01139d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 474 additions and 90 deletions

View file

@ -23,7 +23,6 @@ from homeassistant.const import (
TEMP_CELSIUS, TEMP_FAHRENHEIT, WEEKDAYS, __version__)
from homeassistant.core import valid_entity_id, split_entity_id
from homeassistant.exceptions import TemplateError
from homeassistant.helpers import template as template_helper
from homeassistant.helpers.logging import KeywordStyleAdapter
from homeassistant.util import slugify as util_slugify
@ -445,6 +444,8 @@ unit_system = vol.All(vol.Lower, vol.Any(CONF_UNIT_SYSTEM_METRIC,
def template(value):
"""Validate a jinja2 template."""
from homeassistant.helpers import template as template_helper
if value is None:
raise vol.Invalid('template value is None')
if isinstance(value, (list, dict, template_helper.Template)):