Add shorthand notation for Template conditions (#39705)

This commit is contained in:
Franck Nijhof authored and GitHub committed 2020-09-06 16:55:06 +02:00
1 parent da9b077c11
commit a3c45a6f89
6 files changed
+87 -43

No files matched your search

+4 -1
View File
@@ -935,7 +935,10 @@ class Script:
await asyncio.shield(self._async_stop(update_state))
async def _async_get_condition(self, config):
config_cache_key = frozenset((k, str(v)) for k, v in config.items())
if isinstance(config, template.Template):
config_cache_key = config.template
else:
config_cache_key = frozenset((k, str(v)) for k, v in config.items())
cond = self._config_cache.get(config_cache_key)
if not cond:
cond = await condition.async_from_config(self._hass, config, False)