So I set up an IFTTT event that I can call with my Google Home, that creates a webrequest to my HA to trigger a script. I am using the $ text ingredient with IFTTT and want to pass it to my script. I found this post to be helpful, but I still don’t get my script running correctly.
This is my script “saugen”. As you can see, it should pass the list [26500, 20500,29000, 23000, 1] to the vacuum no matter what. The problem is: the vacuum does not get the list. If I call the script without the templating (just with the list) it works perfectly. But of course my goal is to set up different rooms with different coordinates, depending on which room I give to my Google Home. I bet I have just a stupid tiny mistake in there, since this is my first time using templates. My script:
- data_template:
command: app_zoned_clean
entity_id: vacuum.mozart
params: >
{% if (raum == "Küche" or raum == "küche") %}
{% set values = [26500, 20500, 29000, 23000, 1] %}
{% else %}
{% set values = [26500, 20500, 29000, 23000, 1] %}
{% endif%}
{%- for value in values %}
{{- value }},
{% endfor %}
Can’t return a list inside a list which is what you are doing when you use [[ ]]. I believe the way I posted will work for you. You may need to remove the comma in the {{- value}}, line. I always forget if that’s needed or not.
The vacuum needs a list of coordinates and how often it should clean the area. But since the vacuum accepts multiple zones at once to be cleaned, I have to pass the list in a list - even if there is just one zone in it, hence
[[x1,y1,x2,y2, iterations]]
another example with more than one area/zone to be cleaned: