deepessh / mqttclpro

MQTT Client for android with tasker support
MIT License
99 stars 30 forks source link

Have Tasker Subscribe to Topic #89

Open chribro88 opened 1 year ago

chribro88 commented 1 year ago

Version 4.5.1

Is it possible to have tasker subscribe to a topic or can it only be done first through the app?

As a workaround I subscribed in the app to a topic +/+/hello and then attempt to have tasker filter the topic in the profile, such as:

        Profile: MQTT Received Req-Res
            Event: Message Arrived [ Configuration:broker - 127.0.0.1 : +/+/hello : varmessage : varmqtttopiv : Topic Equals %MQTT_TOPIC : Message Equals  ]

        Enter Task: TestFlash

but the variable %MQTT_TOPIC does not seem to get passed to the plugin. I'm able to filter the messages in the task as so:

        Enter Task: TestFlash

        A1: If [ %varmqtttopiv eq %MQTT_TOPIC ]

            A2: Flash [
                 Text: %varmessage
                 Tasker Layout: On
                 Title: %varmqtttopiv
                 Continue Task Immediately: On
                 Dismiss On Click: On ]

        A3: End If

(also tried MQTT_TOPIC, but only when I hardcode the topic to 'testtopic' does it work)

Ideally, if Tasker could subscribe to the specific topic then it only be receiving the messages that it requires.