ESPhome IR change switch to light

I have the below configuration running on an esphome device. The switch gets passed to HA and then I use the light platform - switch to change it to a light.

Is there any way on the ESP device to change the switch to a light and pass that to HA? I’ve messed around with the code, but can’t find out how to do it. I’ve tried a binary light and a template.

switch:
  - platform: template
    name: "Bedroom 3 Light"
    optimistic: true
    turn_on_action:
      remote_transmitter.transmit_raw:
        code: [1240, -437, 1239, -438, 340, -1272, 1239, -438, 1239, -438, 1239, -439, 340, -1274, 339, -1273, 340, -1272, 1239, -438, 1239, -439, 1239, -6645, 1239, -438, 1239, -439, 340, -1273, 1239, -438, 1240, -438, 1240, -439, 340, -1274, 340, -1274, 340, -1272, 1240, -438, 1240, -438, 1240, -6626, 1239, -438, 1240, -439, 339, -1274, 1240, -438, 1240, -438, 1240, -439, 340, -1275, 340, -1274, 340, -1273, 1239, -438, 1240, -439, 1240, -6627, 1239, -438, 1240, -439, 340, -1274, 1239, -439, 1240, -439, 1239, -440, 340, -1275, 340, -1275, 339, -1274, 1239, -439, 1239, -439, 1240, -6630, 1238, -439, 1239, -441, 339, -1275, 1239, -439, 1239, -440, 1239, -441, 339, -1276, 340, -1275, 339, -1275, 1238, -440, 1239, -440, 1239, -6611, 1238, -440, 1239, -440, 339, -1276, 1238, -440, 1239, -440, 1239, -441, 339, -1277, 339, -1276, 339, -1275, 1238, -440, 1239, -440, 1239]
        carrier_frequency: 38kHz
    turn_off_action:
      remote_transmitter.transmit_raw:
        code: [1240, -437, 1239, -438, 340, -1272, 1239, -438, 1239, -438, 1239, -439, 340, -1274, 339, -1273, 340, -1272, 1239, -438, 1239, -439, 1239, -6645, 1239, -438, 1239, -439, 340, -1273, 1239, -438, 1240, -438, 1240, -439, 340, -1274, 340, -1274, 340, -1272, 1240, -438, 1240, -438, 1240, -6626, 1239, -438, 1240, -439, 339, -1274, 1240, -438, 1240, -438, 1240, -439, 340, -1275, 340, -1274, 340, -1273, 1239, -438, 1240, -439, 1240, -6627, 1239, -438, 1240, -439, 340, -1274, 1239, -439, 1240, -439, 1239, -440, 340, -1275, 340, -1275, 339, -1274, 1239, -439, 1239, -439, 1240, -6630, 1238, -439, 1239, -441, 339, -1275, 1239, -439, 1239, -440, 1239, -441, 339, -1276, 340, -1275, 339, -1275, 1238, -440, 1239, -440, 1239, -6611, 1238, -440, 1239, -440, 339, -1276, 1238, -440, 1239, -440, 1239, -441, 339, -1277, 339, -1276, 339, -1275, 1238, -440, 1239, -440, 1239]
        carrier_frequency: 38kHz

Thanks

I think you want a template output connected to a binary light.

Hello, solution here :