Hello
First, excuse me for my poor english…
I have a script which include service_template.
What I want to do :
I have tilt cover, and I want to verify if the covers are closed before send the tilt position.
This is my script :
bso_ouvre_cuisine_autres_tilt_100:
alias: Ouvre BSO Cuisine et lamelles autres
sequence:
- service: cover.open_cover
data:
entity_id: cover.bso_cuisine
- service_template: >
{% if is_state('cover.bso_bv_cuisine', 'open') %}
cover.close_cover
{% else %}
{% endif %}
data:
entity_id: cover.bso_bv_cuisine
- service_template: >
{% if is_state('cover.bso_sam', 'open') %}
cover.close_cover
{% else %}
{% endif %}
data:
entity_id: cover.bso_sam
- service_template: >
{% if is_state('cover.bso_bv_salon', 'open') %}
cover.close_cover
{% else %}
{% endif %}
data:
entity_id: cover.bso_bv_salon
- service_template: >
{% if is_state('cover.bso_pf_salon', 'open') %}
cover.close_cover
{% else %}
{% endif %}
data:
entity_id: cover.bso_pf_salon
- service: cover.set_cover_tilt_position
data:
entity_id:
- cover.bso_bv_cuisine
- cover.bso_sam
- cover.bso_bv_salon
- cover.bso_pf_salon
tilt_position: 100
But I have this error :
Error executing script. Unexpected error for call_service at pos 2: Template rendered invalid service:
Traceback (most recent call last):
File « /usr/src/homeassistant/homeassistant/helpers/service.py », line 166, in async_prepare_call_from_config
domain_service = cv.service(domain_service)
File « /usr/src/homeassistant/homeassistant/helpers/config_validation.py », line 463, in service
raise vol.Invalid(f"Service {value} does not match format .")
voluptuous.error.Invalid: Service does not match format .
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 250, in _async_step
await getattr(
File « /usr/src/homeassistant/homeassistant/helpers/script.py », line 429, in _async_call_service_step
domain, service_name, service_data = service.async_prepare_call_from_config(
File « /usr/src/homeassistant/homeassistant/helpers/service.py », line 172, in async_prepare_call_from_config
raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Template rendered invalid service:
Could you help me please ?
Thanks