I want to send a variable to Tasker in order to do some complex calculation depending on the value
Not yet
Sure but could you plann it ?
Could you plann for a future beta ?
It would be great if we'll be able to send some infos back to Tasker
Or at least write in a file and Tasker will read it.
The last part of your suggestion is already possible. $sh("echo '" + df(h:mm) + '" > /storage/emulated/0/Download/klwptext.txt")$ writes the time (for example) to a text file, and Tasker can read that.
I just learned that from the first Related Topics entry below your post: https://help.kustom.rocks/i683-send-info-back-to-tasker-problem-with-if-condition
I agree that a direct way to pass stuff to Tasker would be great too.
You can use Automate for that.
In klwp/kwgt create one object with the touch action to open a Link.
In the link your gonna use a URI Scheme like this one:
automate://VAR=$(VALUE)$
In Automate you create one Brodcast Recive block with the next settings
Action : android.intent.action.VIEW
URI Scheme : automate
Category : android.intent.category.BROWSABLE
Broadcast URI : VAR
You do your complex calculation with your VAR.
Then you create one Plug-in Action block, you select klwp or kwgt and you set your VAR and VALUE that you want to send to klwp/kwgt.
Back in KLWP/KWGT to recebe you value back just use this $br(tasker, VAR)$
*Replace VAR and Value with you owne var names.
Tasker has now release its new command system.
It allows 3rd party apps to send command directly to tasker.
A basic code snipped how to integrate it can be found on the website.
I currently do just this. It was a mission to replace a failing settings toggle widget that led me to KWGT.
For example, to set screen brightness in steps KWGT opens url autotoolscommand://newBrightness=:=$gv(brilev)$
Tasker has a profile event AutoApps Command with a filter newBrightness. This triggers a task to set the brightness based on that value
This is possible via open URL both on Flows (from 3.70) or standard touch action. In Flows setting a var can be done also when a formula changes or by any other internal Kustom event. See below comments for an example.