Multiple binary sensors in rf bridge

Hi all,

I am struggling adding an if statement in my yaml code.
In my house I have 6 433mhz door sensors (only open) which I connect with the sonoff rf bridge flashed with ESPhome. Now with 1 binary sensor there is no problem, but I can’t seem to integrate all six. Some help would be greatly appriciated. Here is my yaml code, where I want to make ‘Schuifpui’ work:

rf_bridge:
  on_code_received:
    then:
      - homeassistant.event:
          event: esphome.rf_code_received
          data:
            sync: !lambda 'char buffer [10];return itoa(data.sync,buffer,16);'
            low: !lambda 'char buffer [10];return itoa(data.low,buffer,16);'
            high: !lambda 'char buffer [10];return itoa(data.high,buffer,16);'
            code: !lambda 'char buffer [10];return itoa(data.code,buffer,16);'
      - if:
          condition:
            lambda: |-
              return data.code == 0xXXXXX;
          then:
            - binary_sensor.template.publish:
                id: voordeur
                state: ON
            - delay: 5s
            - binary_sensor.template.publish:
                id: voordeur
                state: OFF
                
binary_sensor:
- platform: template
  name: 'Voordeur'
  id: voordeur
  device_class: door

- platform: template
  name: 'Schuifpui'
  id: schuifpui
  device_class: door
1 Like