Help with a binary sensor

So I have some cheap water detectors that send an RF signal to a sonoff bridge. I have rules (on the bridge itself) that will parse thru that message and publish either of these 2 messages:
sonoff-bridge/washer-leak ON
sonoff-bridge/washer-leak OFF
The (old) way that I defined binary sensors in configuration.yaml used to work - and I understand that way is no longer support and you have to use a new format using template. So far I have not figured out how to define this under that new format. Can someone give me breadcrumbs on how the configuration would be to look for those messages? That the part I’m stuck at.

Published via MQTT?
You can just add the sensor in configuration.yaml like:

mqtt:
  binary_sensor:
    - state_topic: "sonoff-bridge/washer-leak"

So here is my current config in configuration.yaml. I tried to put it in exactly the format in the link you suggested.

  binary_sensor:
    - name: "counter-top-water"
      state_topic: "sonoff-bridge/counter-top-water-detected"
      payload_on: "ON"
      payload_off: "OFF"
      availability:
        - topic: "sonoff-bridge/tele/LWT"
          payload_available: "online"
          payload_not_available: "offline"
      qos: 0
      device_class: opening
      value_template: '{%if is_state(entity_id,"ON")-%}OFF{%-else-%}ON{%-endif%}```

no syntax errors reported.   Good.  Reboot the box - just to be sure.  The entity shows up in STATES as "binary_sensor.counter_top_water".  All that looks good.  It does show up as UNAVAILABLE though.  The real issue is - does not work.  I can trigger an alert on the remote sensor - with MQTT Explorer -  I see this message from the sonoff-bridge:

sonoff-bridge/counter-top-water-detected

 - with an ON - and within a few seconds an OFF.  I get no state change  in STATES that the counter-top-water entity got that MQTT message.

Your availability is probably incorrect.

Remove the value_template line and change the payload_on/off to match what you want.

I wished I understood the programming side a lot more. I took at that line (and also lines concerning ability to get rid of the unknown state) and it is now working. Thanks you for you help!..