ESPHome IR Receiver triggering double keypresses

I am working on a universal remote setup to replace my old Harmony stuff and to be able to do it in multiple rooms, so adding this stuff to Home Assistant seemed like the ticket.

I have an 8266 setup with an IR receiver that is sending events to home assistant, which I then set as triggers for automations that send signals via a Broadlink RM4 (or to do lights or whatever else I decide). My first try using a binary sensor was very spotty at triggering the automations, but sending events has been working great except that I am getting double keypresses alot. I programmed the up/down/left/right for my TV and it will skip around when trying to select menu items. Triggering the automations manually works perfectly, so it has to do with the receiving end. I’ve been looking through the documentation and I cannot find a way to rate limit the signal either in ESPHome or by configuring the trigger in the automation.

Here is the code I’m using on the esphome device:

remote_receiver:
  pin: 
    number: GPIO14
    inverted: True
    mode: INPUT_PULLUP
  dump: sony
  on_sony:
   - homeassistant.event:
      event: esphome.infrared.code_received
      data:
        source: masterbedroom
        code: !lambda |-
          return x.data;

Any ideas on how to slow it down a little to prevent this?

Try putting filters: - delayed_off: under on_sony
This worked for me in mine:

substitutions:
  ir_rec_delay: 200ms   # PREVENTs DUPLICATES.  
          #  200ms WORKS GREAT TO PREVENT TOGGLING
          #  this value may not be good for VOLUMEs and analog controls

remote_receiver:
  pin: 
    number: GPIO1          
    inverted: true
  dump: 
    all
  
binary_sensor:
  - platform: remote_receiver
    name: "Samsung Remote ALT PWR button"
    samsung:
      data: 0xE0E040BF            # bluray other power
      nbits: 32
    on_press:
      then: 
         - switch.toggle: huGPIO2      #  TOGGLES BLUE LED huzzah
    filters:
      - delayed_off: ${ir_rec_delay}   #   

Unfortunately, I have already tried using the delayed off filter but that only works with binary_sensor.

Then redo your IR config to use a binary sensor. I know it works.