After using Shelly flood sensors for a few years I’ve needed to add another one. This time a bought a Shelly Flood Gen 4 and noticed the difference to the old ones. So, here’s my code snippet to use them all via mqtt:

alias: Benachrichtigung bei Wasser Sensor
triggers:
  - id: Kueche
    trigger: mqtt
    options:
      topic: shellies/shellyflood-3494546A1B2C/sensor/flood
      payload: "true"
  - id: Waschmaschine
    trigger: mqtt
    options:
      topic: shellies/shellyflood-3494546D3E4F/sensor/flood
      payload: "true"
  - id: Heizkeller
    trigger: mqtt
    options:
      topic: shellyfloodg4-58e6c5A5B6C7/events/rpc
      value_template: "{{ value_json.params['flood:0'].alarm }}"
      payload: true
conditions: []
actions:
  - metadata: {}
    data:
      title: Wassersensor {{ trigger.id }} hat Wasser entdeckt
      message: "{{ trigger.id }}"
    action: notify.email_markus
mode: single

The thing that cost me an hour of debugging: Use payload: true for gen4, not payload: "true".