MQTT Client setup (with Sonoff/ Tasmota Rules)

Hello all,

I’m trying to use MQTT Client (https://apps.athom.com/app/nl.scanno.mqtt) combined with a D1 mini running Tasmota. I’ve created a ‘rule’ (https://github.com/arendst/Sonoff-Tasmota/wiki/Rules) to send a MQTT message once a certain value is reached on a sensor attached to the D1. However I’m uncertain of how to setup the MQTT Client trigger.

I see the tag ‘Message received from topic’ & ‘Name Topic’ but the text to the right is cut off from the screen (I’ve tried rotating to no avail). What is the correct format to use? Must tags be used or can I get the D1 to send out any particular message that the client will recognise & trigger on?

Thanks,

chrome_2019-05-07_20-40-32

Those are the tags that the trigger flow card provides (and that you can use in condition/action cards, for instance). Because the MQTT Client can trigger on wildcard topics, the Name Topic tag can be used to determine the exact topic that the message was posted to.

The “Topic” part is the one that you have to fill in, and should contain the topic that the rule will post a message to.

Thanks both for the replies. I’m still having some difficulty however. From the console of the D1 when a switch is activated the following MQTT appear to be sent:

11:02:15 MQT: stat/post/RESULT = {"POWER":"ON"}
11:02:15 MQT: stat/post/POWER = ON
11:02:15 MQT: stat/post/RESULT = {"POWER":"OFF"}
11:02:16 MQT: stat/post/POWER = OFF

So to capture this switch activation on the MQTT client would it be correct to construct the flow as follows:

No luck so far with this but I think the setup is complicated but the UI. On my android phone it’s not possible to select the Tags (in green) as indicated by the arrows in the picture, but it is on my Firefox browser (& Chromium).

The topics in your example are stat/post/RESULT and stat/post/POWER. Everything after the = is the message.

Thanks Robert. On selection of the green tag (eg. ‘Message received from topic’) is another text box meant to appear? As currently this is the only way I can enter text:


& from MQTT Client logs it doesn’t seem like the topic is being correctly subscribed to:

Screenshot%20from%202019-05-11%2012-23-47

The topic field should only contain the topic name (stat/power/POWER), not the tag.

For example (from the flow web interface):
image

Ahh, I see. Thanks very much, Ive managed to get it working now.

Is there anyway to examine the MQTT message (e.g. ON or OFF)?

Yes, that’s where you can use the tag. For instance in an “AND” card (using Logic “equals”):

image

  • “Bericht ontvangen via topic” = “Message received from topic”
  • “is precies” = “equals”

Thanks very much indeed, got it now.

For anyone else following here it is put together:

2 Likes

Here’s how I used this setup