Is it possible to reference script fields in template switches?

Hey everyone,

Currently I have all my remote buttons in the house as individual scripts to fire commands from my broadlink minis however this has resulted in me having over 300 scripts. To tidy this up I’ve started combining all of these for each device and just using selector fields in the scripts.

The problem with this is that I use template switches taking advantage of the on and off IR commands on each remote. Is it possible to reference the field for these commands on the new all in one script or do I need to keep them separate?

For reference the switch template is currently this:

    bedroom_television:
      unique_id: bedroom_tv_switch
      friendly_name: "Bedroom Television"
      value_template: "{{ 'false' if is_state('media_player.firestick_tv', 'off') else 'true' }}"
      turn_on:
        service: homeassistant.turn_on
        target:
          entity_id: script.lg_television_power_on
      turn_off:
        service: homeassistant.turn_on
        target:
          entity_id: script.lg_television_power_off

I’ll leave this up incase anyone needs it but the answer is script variables :slight_smile: Thanks to Rob from the discord for highlighting that term difference to me.