参考脚本:
script:
chenck_switch_status:
sequence:
- service: tts.iflytek_say
data_template:
message: >
{% for state in states.switch -%}
{{ state.attributes.friendly_name }}
{%- if state.state == "off" %}
已关闭,
{%- elif state.state == "on" %}
已开启,
{% endif -%}
{%- endfor %}
|