写了一个很简单的根据当前温度调节风扇转速以及打开和关闭,执行部分代码如下,查询过HA官方文档没说service_temlate不支持is_state和state呀,可我经过试验得出来service_temlate后面只能跟state_attr和is_state_attr,只要跟is_state和state就log报错'state' is undefined ,这个template前人用的好好的呀真的搞不懂了
Log如下:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 114, in async_prepare_call_from_config
domain_service = config[CONF_SERVICE_TEMPLATE].async_render(variables)
File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 230, in async_render
raise TemplateError(err)
<font color="Red">homeassistant.exceptions.TemplateError: UndefinedError: 'state' is undefined</font>