Call-service MQTT

Hi, trying to publish mqtt message triggered from floorplan but I don’t understand how to do it… Actually I have the followin in a card :

type: custom:mushroom-template-card
picture: /local/Logos/Netflix.png
primary: Publish mqtt msg
secondary: How are you?
tap_action:
  action: call-service
  service: mqtt.publish
  service_data:
    topic: StreaDeck/ON1
    payload: ReLaunch
multiline_secondary: false
layout: vertical

I would like to do the same in floorplan… but I don’t know where to inlcude the above code in the below floorplan code…

title: Test Floorplan
views:
  - title: Streamdeck
    path: floorplan
    theme: Google Dark Theme
    panel: true
    type: panel
    badges: []
    cards:
      - config:
          console_log_level: info
          log_level: info
          image: /local/streamdeck/test.svg
          defaults:
            hover_action: hover-info
            tap_action: more-info
          rules:
            - element: light.hue1
              entity: light.hue_maroc
              tap_action: toggle
          stylesheet: /local/streamdeck/home_simple.css
        full_height: true
        type: custom:floorplan-card

The mqtt.publish should be launched when light.hue1 is trigerred from the floorplan.

Thanks for help.

You do it the same way. You have tap_action: toggle so you need to change that to your service call

Thanks @OzGav. I tried already and it was not working… but I realized that I need to remove the line “entity: light.hue_maroc” and now it works!

Thanks a lot.