Send an IR code twice

I have the following switch working fine but need it to fire twice:

switch TVHDMI:
platform: mqtt
name: “TVHDMI”
state_topic: “home/commands/#”
command_topic: “home/commands/sendNEC”
payload_on: 551538735
payload_off: 551538735
optimistic: false
retain: true

I know I probably need to script it but I have no idea where to start.
Any help would be greatly appreciated.

Sorry for the Bump

If you post config snippets you always should use the function here to paste preformatted stuff or else the indents get lost.

For the question I can’t think of an easy solution right now…buuut you could use a input boolean for the switch and 3 automations. One for switching on, one for switching off and another one that triggers the switch depending on the mqtt topic.
I may over engineer here and there might be a easy solution.

If you need further help or examples lemme know.

~Cheers