本帖最后由 comeon_000 于 2020-3-29 23:37 编辑
写了一个脚本,调用的时候总是提示域和名称不匹配
Error executing script script.fan_oscillating. Invalid data for call_service at pos 1: Service does not match format <domain>.<name>
代码如下:
fan_oscillating:
alias: shufang fan osc
sequence:
- service_template: >
{% if oscillating == True %}
script.turn_on_study_fan_osc
{% elif oscillating == False %}
script.shufang_fan_speed
data_template:
speed: "{{ speed }}"
{% endif %}
- service: input_select.select_option
data_template:
entity_id: input_select.shufang_fan_osc
option: "{{ oscillating }}"
怀疑还是service_template的使用方法不太对,另外一个类似脚本就没这个问题,对比了很长时间,也没法先什么区别,看不出是哪里的问题,向大神求教
shufang_fan_speed:
alias: shufang fan speed
sequence:
- service_template: >
{% if speed == '1' %}
script.turn_on_study_fan1
{% elif speed == '2' %}
script.turn_on_study_fan2
{% elif speed == '3' %}
script.turn_on_study_fan3
{% elif speed == '4' %}
script.turn_on_study_fan4
{% elif speed == '5' %}
script.turn_on_study_fan5
{% elif speed == '6' %}
script.turn_on_study_fan6
{% else %}
script.turn_off_study_fan
{% endif %}
- service: input_select.select_option
data_template:
entity_id: input_select.shufang_fan_speed
option: "{{ speed }}"
|