Two questions about scripting ( building a script for a single button AC remote-controller )

Hi all,
I’m using HA for about a year and I’m really enjoying the system and the community support. I think I reached pretty far without asking any question anywhere haha
Attaching some prequel, but you are welcome to jump to the questions :sweat_smile:

The main problem is that my AC is not a “smart AC” that can connect to WIFI, and I control it with an IR blaster.
So, I have prerecorded a lot of functions for my AC in the last year.
the way this controller works is by generating different codes ( “blasts” or whatever you want to call it ) for each possible outcome, considering lots of variables ( heat/cold/fan, tempratures ( 16-30 ), fan speed ( low, med, high ) and even stuff like the direction of the wind ).
Along the last year I prerecorded all the relevant functions and gave each a uniqe button in the lovelace interface.
Now, I want to unify it, in order of making it simpler and easier to use. This led me to a kinda-hard-to-google niches of HA scripting like “calling a script from another script”, or “using conditions” but a bit different than the examples I’ve seen.

Here are picture to show…

So, to my first question:
I thought I can set variables but I couldn’t find to best use them in conditions without taking several lines for each condition. something like this for example:

{% set temperature = states("input_select.dropdownbox_temprature") %} # a number between 24 to 30 ( I don't need 16-23 )
{% set fanSpeed= states("input_select.helper_dropdownbox_LMH") %} # Fan speed: Low/Med/High 
{% set isHeat = states("input_boolean.helper_toggle_isonheat") %} # heat: Yes/No

My second question is how to execute an existing script like “script_ac_heat28low”, “script_ac_heat28med” from the current - “script_unified_AC_RC”?

See the script docs at for how to call scripts and how to define and use variables in scripts:

You call a script from within the sequence: or action: block of another script/automation like so:

  action:
  - service: script.turn_on
    data:
      entity_id: script.my_script
1 Like

Ohhhh
I get that part now

pffff I hate YAML :sweat_smile:

So for the first question: Is there any way to use as much less text as possible for when writing conditions?
I saw that several rows are needed for each condition and that feels a lot.
Again, I need to have a total of over 40 conditions… and would preffer to shorten the file as much as possible.