Defining variables in script

Hi,

Not sure how to explain this but Ill try. I currently have a script that has 12 choose options, and each one of those has 20 actions. The script sets a heating schedule for each radiator depending on the season and whether its school holidays.

The schedule names are set as:

So either

LoungeWinter
LoungeWinterHolidays etc

Is there a way for me to set each climate entity to a room name and then run a script to go through each entity and set the corrent schedule. When I say set each entity to a room name I mean:

climate.lounge = Lounge
climate.kitchen = Kitchen
Etc

And then use the room name (Lounge) as part of the script to set the schedule? Not all climate entities have matching schedule names I.E my kids schedules are called KidsBedroom rather than the entity name.

Hope that makes sense

Forgot to say, this is the output Id like:

service: wiser.set_schedule
data:
entity_id: climate.wiser_bathroom
filename: wiser/BathroomWinter

I think you mean something like this?

repeat:
  for_each:
    - Bathroom
    - Kitchen
    - Kids
  sequence:
    - service: wiser.set_schedule
      data:
        entity_id: "climate.wiser_{{ repeat.item | lower}}"
        filename: "wiser/{{ repeat.item }}Winter"

And, yes, the Winter part could be a variable too, but it’s hard to guess how to best handle this given your description. Check out script variables, possibly.

Yeah something like that. The winter part would be from an input_text helper which has the season set.

So something like this?

filename: “wiser/{{ repeat.item }}{{input_text.season”

How about knowing when to append Holidays on the end of season name? Holiday mode is on or off using an input boolean

Just did a quick test and got it working with the following

filename: wiser/{{ repeat.item }}{{ states(‘input_text.season’) }}

Will finish script properly when I get home. Thank you so much!