Problem with script and parameters script

Hi there,

i’m struggling with parameters passed to script (located ina file loaded by script::!include_dir_merge_named scripts/ in configuration.yaml

I’ve this script working well :

vacuum_kitchenvacuum:
    sequence:
      - service: vacuum.send_command
        data:
            entity_id: vacuum.xiaomi_vacuum_cleaner
            command: app_zoned_clean
            params: [[18116,22778,23416,28628,2]] 


if i try to replace it by something like this:


vacuum_zonedclean:
    sequence:
      - service: vacuum.send_command
        data:
            entity_id: vacuum.xiaomi_vacuum_cleaner
            command: app_zoned_clean
            params: "{{Zone}}"

vacuum_kitchenvacuum:
    sequence:
        - service: script.vacuum_zonedclean
          data:
            variables:
                Zone: [[18116,22778,23416,28628,2]]

It doesn’t do the same :frowning:

I’ve also tried:

vacuum_zonedclean:
    sequence:
      - service: vacuum.send_command
        data:
            entity_id: vacuum.xiaomi_vacuum_cleaner
            command: app_zoned_clean
            params: {{Zone}}

–> returning an error during configuration check

This won’t work because params apparently wants a list of lists of numbers, whereas a Jinja template can only return a single string. So although script.vacuum_kitchenvacuum is calling script.vacuum_zonedclean and passing in a list of lists of numbers in the Zone variable, when script.vacuum_zonedclean tries to use that variable via a template, the result is the list turned into a string representation of it. Nothing you can do about this when using YAML scripts.

However, you might be able to make this work by creating a Python script in place of the YAML script.vacuum_zonedclean.

Thanks a lot.

So, i’m diving in python script to achieve this.