What’s the difference between the two launch script syntaxes?

    service: script.turn_on
    target:
      entity_id: script.somescript

And

     service: script.somescript

I’m asking because I was trying to execute a script using the API with Windows Powershell and couldn’t work out the syntax to run a script without using the entity_id as in :


curl.exe --% -X POST -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" -d "{\"entity_id\": \"script.somescript\"}" http://IP:8123/api/services/script/turn_on

script.turn_on still doesn’t make sense to execute it because it seems it should turn on a script as in enabling the script from a disabled state.

But script.turn_on seems to be the only way to execute the script using the API, I’ve edited my post to clarify.

whoops. sorry, i had script.turn_on and automation.turn_on mixed up in my head. quickly nuked my prior post

i didn’t know you could invoke a script in that way (via curl). i had only known of doing it via webhook!

The differences are explained here:

https://www.home-assistant.io/integrations/script/#waiting-for-script-to-complete

And here:

https://www.home-assistant.io/integrations/script/#passing-variables-to-scripts

Scripts don’t have an “enabled state”. They are only ever running (on) or idle (off).

They are neither ever enabled or disabled because they aren’t a self executing entity in themselves because they are only ever called externally to the script. So being enabled/disabled wouldn’t make any sense. In that sense scripts are always enabled since they are always available and waiting to be called.

by contrast, automations are enabled/disabled because they are self triggering. So that concept there makes sense.

I will say that the states that HA uses for the two are fairly confusing because they use the exact same states to men two totally different things.

Thanks for the clarification.