Data templates & input boolean in scripts. I can't solve this

I’m trying to do this Project , but I can’t get script working.

I’ve copied this script from the link

     alias: "Erdgeschoss Zonen saugen"
       - service: vacuum.send_command
           entity_id: 'vacuum.rockrobo'
           command: 'zoned_cleanup'
               - "{%- if states('input_boolean.flur_vacuum_zone') == 'on' %}flur{% endif %}"
               - "{%- if states('input_boolean.kueche_vacuum_zone') == 'on' %}kueche{% endif %}"

adapted to my configuration

  alias: Vacuum zone pulizia
    - service: vacuum.send_command
        entity_id: 'vacuum.rockrobo'      
        command: 'zoned_cleanup'
            - "{%- if states('input_boolean.floor1camera_vacuum_zone') == 'on' %}floor1camera{% endif %}"
            - "{%- if states('input_boolean.floor1corridoio_vacuum_zone') == 'on' %}floor1corridoio{% endif %}"

But if I turn on corresponding boonlean, script doesn’t start.

So i tried this with automations

- id: '1571142168757'
  alias: floor1camera
  description: ''
  - entity_id: input_boolean.floor1camera_vacuum_zone
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  - data:
      command: zoned_cleanup
      entity_id: vacuum.rockrobo
        - floor1camera
    service: vacuum.send_command

And this works… I can’t trigger my script with booleans entites which works with automations.
In registry I can see booleans and automations changing status, but can’t see scripts.

Your spacing under zone_ids is off, could be it. Also, manually run the script and check for errors in your log.

Space corrected. Just tried running it, no errors in logs

Remove the single quotes from around 'zone_ids' in the script too. Just noticed that.

The author told me to put the script in lovelace UI explanation here
now I have to understand how to insert it in the lovelace UI

Create an entity button that calls the script, then press it when you want the script to run.

Edit: also to clarify, a script won’t ever start by itself. It’s not an automation. I didn’t realize that was part of your confusion until I reread your original post.

I finally understood! So I create my script.
Then I activate the script and then press input_boolean?

Set whichever input_booleans you want first, then run the script. Also, for future reference, instead of this:

states('input_boolean.floor1camera_vacuum_zone') == 'on'

…you can use this:

is_state('input_boolean.floor1camera_vacuum_zone', 'on')

Either works, but it just seems strange to me that the person whose project you looked at chose to use the first one instead of the second. No need to change it in your script, I just wanted to share for your knowledge.

THANK YOU!! It works!!!

I get this, thanks

Great! Sorry for the confusion before… I misunderstood what you were saying at first.

My fault, I thought wrong about scripts :smiley: