Setting up a waterleak sensor with reset button in lovelace

I have the simple RF433 watersensors, they have 1 code they can send, so when they get wet, they send an alert.
I want to build a button in lovelace that resets the alert.

So the RF433 is sent as a MQTT message, and it flips the binary sensor on.
I’ve made my own RF code for turning off the binary sensor.
So if I publish this to MQTT it turns off the alert:

topic: tele/rfbridge/RESULT
payload: {"RfReceived":{"Sync":10140,"Low":320,"High":920,"Data":"33C112OFF","RfKey":"None"}}
qos: 1
retain: false

So I’ve built a card with the custom button by @RomRider My idea was that I could hide the icon if the alert was off, and show if it’s on.
But when I press the icon, it doesn’t turn off the alert, so basically it doesn’t work :laughing:

The conditional works fine of course, but it doesn’t publish the mqtt?

type: conditional
conditions:
  - entity: binary_sensor.waterleak_bathroom
    state: 'on'
card:
  type: 'custom:button-card'
  entity_id: binary_sensor.waterleak_bathroom
  icon: 'mdi:water'
  name: Oversvømmelse i badeværelse
  color_type: icon
  color: rgb(0,100,255)
  tap_action:
    - action: call-service
      service: mqtt.publish
      service_data:
        topic: tele/rfbridge/RESULT
        payload: >-
          {"RfReceived":{"Sync":10140,"Low":320,"High":920,"Data":"33C112OFF","RfKey":"None"}}
        qos: 1
        retain: false

Did I format it wrong? Or can’t it call the mqtt.publish from the custom button, or what?

tap_action is not an array:

tap_action:
  action: ... 

Not

tap_action:
  - action: ... 
1 Like

Absolutely right, thankyou! Works like a charm now :slight_smile: