How to publish a single Mqtt command

currently I have an mqtt switch:

switch:

  - platform: mqtt
    name: Watermeter Install firmware update
    command_topic: watermeter/smart_gateways/install_update
    payload_on: 'yes'
    payload_off: 'no'

which is a bit useless, as it only serves the purpose of sending the update command to the watermeter. Turning this off does nothing.

So, Id like to rebuild this to a script, or at least a single button single command in the frontend. Can we do that?

Ive checked the Mqtt section, and of course the scripts and commands, but couldn’t find the right thing yet…

Please help me out? thanks!

Something like this?

  sequence:
  - service: mqtt.publish
    data:
      payload: "yes"
      topic: 'watermeter/smart_gateways/install_update'
  - delay: 2  # not sure if this needs to be reset to 'no'
  - service: mqtt.publish
    data:
      payload: "no"
      topic: 'watermeter/smart_gateways/install_update'
1 Like

why thanks! of course…

thats exactly what I needed.

(Now How I didnt find that myself… really sorry, have those scattered in my config. :blush: :flushed:)

truly appreciate that Tom.