Call scripts with parameters?

Yup, but it’s not very easy to explain…

Imagine an automation and your action is:

action:
  service: script.clever_script
  data:
    this_light: livingroom

Then clever_script would say:

clever_script:
  sequence:
    - service: light.turn_on 
      data_template:
        entity_id: "light.{{ 'this_light'}}"

Then you can put this_light to kitchen in another automation or whatever.

It’s very powerful when you get the hang of it, I use a much more complicated version for my notification engine, you call script.notify with some parameters and it generates a message and you can choose whether it goes to text (and whom receives it), speech via TTS over the speakers, and an on screen message via persistent notification, or any combination of the three notification methods, which in turn are scripts that receive parameters from script.notify

If any of that made sense to you, the file in my repo that makes this happen is

link removed

You’ll notice that the meat-and-bones of script.notify is in an include, which is here…

link removed

Hope this helps.