MQTT Notify Automation help

Hi All,
Just bougt me an Ulanzi Matrix clock and flashed it with awtrix-light.
I can send the following using MQTT Publish packet:


How can I send the same notification as an action in yaml code to a trigger, how should it be written?
Thanks,
Ase

Use the mqtt.publish service call. There’s an example in the documentation:

MQTT Notifications

1 Like

Thanks Taras for the fast reply,
Checked the examples and played around.
Cant see how to specify to what MQTT unit it should go to.

  action:
  - service: mqtt.publish
    data:

Then what in my example above?

Try this:

action:
  - service: mqtt.publish
    data:
      topic: Awtrix/notify
      payload:
        text: Hello
        duration: 10

The code does not give any error when written, but does not give any result.
I checked that the trigger is activated as it should.
Any more ideas to try?

The example I posted does exactly the same thing as what you did in “Publish a packet”. It publishes a payload, containing a dictionary in JSON format, to the Awtrix/notify topic.

It’s effectively the same as this:

service: mqtt.publish
data:
  topic: Awtrix/notify
  payload: '{"text": "Hello", "duration": 10}'

Tried the MQTT listener as well, it sees the MQTT been published in MQTT Settings but sees nothing on:

action:
  - service: mqtt.publish
    data:
    topic: Awtrix/notify
    payload: '{"text": "Hello", "duration": 10}'

or

action:
  - service: mqtt.publish
    data:
      topic: Awtrix/notify
      payload:
        text: Hello
        duration: 10

When I use this:

the result is this:

WORKS!

Must have been the intendtation that was the differens.

This below works geat!

  - service: mqtt.publish
    data:
      topic: Awtrix/notify
      payload: '{"text": "Hello", "duration": 10}' 

Will try to solve the other way as well to write it as it it easier for us newbies.

Thanks a LOT for your help and patience to help!

//AseKarlsson

1 Like

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

Good reminder, Of cource!

Hi all! There is a way to maintain the message on top (ideal) until the trigger is off … like a window? Already make a mqtt publish… but can’t maintain on screen…

Screen Shot 2023-06-19 at 7.48.29 PM

service: mqtt.publish
data:
qos: 0
retain: true
payload: >-
{ “text”: “hola, se abrio la {{ trigger.to_state.name }} ?”, “icon”:
“36493”, “durations”: 10 }
topic: awtrix_a96f40/notify

“hold” : true