Open DarkStorm99 opened 3 years ago
I believe varmqtttopic
and varmessage
are the Tasker variable names that the MQTT topic and payload are respectively set to when a message with the selected MQTT topic is received and a Tasker task is executed. In my Tasker task, I have conditional actions that depend on the contents of the message in the variable name that is specified in varmessage
, eg. to turn on/off the screen.
So for example if you set varmessage
to the value mqttpayload
, then set your Tasker task to check %mqttpayload
for the MQTT payload and act accordingly.
I don't use varmqtttopic
in my setup as I have different Tasker tasks associated with different MQTT topics, but I guess it may be useful if you are using wildcard topic subscriptions.
I don't use
varmqtttopic
in my setup as I have different Tasker tasks associated with different MQTT topics, but I guess it may be useful if you are using wildcard topic subscriptions.
Can you explain pls? When setting up event, if leaving varmqttopic
's field blank, i'm getting an error :invalid topic variable
. How you "dont use varmqttopic
"?
Yes, you need to put some Tasker variable names in the varmqtttopic
and varmqttmessage
fields when you set the event up, but my point is that you don't have to actually use those Tasker variables anywhere in the task that is executed. For example, varmqtttopic
isn't very useful when wildcards (#
or +
) are not used in a subscription - the referenced Tasker variable will always be set to the subscribed topic.
Here's how MQTT Client and Tasker are generally set up on my device:
In MQTT Client:
In Tasker:
varmessage
enter mqttaction
, and for varmqtttopic
enter mqtttopic
%mqtttopic
to use the topic received in the MQTT message, and %mqttaction
for the payload. You could for example test the value of %mqtttopic
in an if action.
At the moment I am trying to use this app with tasker so that when motion is detected, an android tablet unlocks. When there is no motion, the android tablet locks.
This app has a lot of potential but I am struggling with the tasker configuration.
I am subscribed to a topic: home/input/livingpir_detection This has 2 messages: "detected" if motion has been detected "clear" if no motion has been detected for 5 minutes.
I was wanting to make it so if the message is received as "detected", the screen unlocks. If the message is "clear", the screen locks through tasker.
In the plugin for the "Clear" event I have set up, it is as follows: topic: home/input/livingpir_detection varmessage: clear
It would appear that varmqtttopic is compulsory. So I have tried putting in "clear" into this box.
In the plugin for the "detected" event I have set up, it is as follows: topic: home/input/livingpir_detection varmessage: detected varmqtttopic: detected
Unfortunately both tasker profiles trigger, when any message is received, not explicitly the one I put into varmessage. I suspect the varmqtttopic is causing issues, or I am doing something completely wrong here.
Can someone point me in the right direction? Thanks