Making a file similar to secrets.yaml for other codes

Hello,

I’ve just retrieved al the IR-codes for my remotes and got them working with my Broadlink Mini. I’m planning on making multiple scripts where it will fire multiple commands. Now I copy and paste the code very time I need a command, but I want to make it easier and more organized.

I was thinking of making a file just like the secrets file. So I can put: ‘!ircodes powerbutton’ and not the entire code. Is this possible?

It now looks like this:

switch:
  - platform: broadlink
    friendly_name: broadlinkmini3
    host: xx
    mac: 'xx'
    type: rm_mini
    timeout: 15
    switches:
      powertelevisie:
        friendly_name: "Televisie"
        command_on: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA='
        command_off: 'JgAaABweOR4bHhwdHB4dHRw6HhsdHR0dOTocAA0FAAAAAAAAAAAAAAAAAAA='

But I want it to look like this

switch:
  - platform: broadlink
    friendly_name: broadlinkmini3
    host: xx
    mac: 'xx'
    type: rm_mini
    timeout: 15
    switches:
      powertelevisie:
        friendly_name: "Televisie"
        command_on: !ircodes powertv
        command_off: !ircodes powerofftv

Use an include for your switches and then call the switch in your automations. Examples in my repo.

Switch config is in homeassistant/packages/system/hardware.yaml

Included ir codes are in homeassistant/includes/ir_codes/*

link removed