本帖最后由 debitus 于 2018-11-8 15:25 编辑
求助楼主@Mirukuteii ,原谅我读了你在前面写的那段教程,但还是不懂我这种情况需要如何写。在这种service_template的内容里,if嵌套里的语句如果没有需要执行的语句,为“空”就好吗?
比如这段{% else %}后面不需要执行任何代码,如果为空,貌似执行的时候,会提示错误。
{% if (trigger.to_state.state == 'on') and (states('input_boolean.ac_1') == 'off') %}
input_boolean.turn_on
{% elif (trigger.to_state.state == 'off') and (states('input_boolean.ac_1') == 'on') %}
input_boolean.turn_off
{% else %}
{% endif %}
|