Setting a Variable On a Remote Device

Use Join to set any global (Uppercase) variable on a remote device

  1. joaomgcd

    STEP 1 - PROFILE THAT SETS VARIABLE


    • Create a new profile with the AutoApps Command condition
    • Set the command filter to setvar=:=
    • Set the Variable Names to varname,varvalue
    (i) This will make this profile trigger with a command like setvar=:=TEST=:=hello for example, in which TEST will be assigned to varname and hello will be assigned to varvalue.
    • Accept and create a new entry task
    • Add a Flash action with the text Setting %varname to %varvalue...
    • Add a Variable Set action where you set %%varname to %varvalue
    (i) Using 2 % is not a mistake. When using %% you're saying that you want to use the variable whose name is defined in the %varname variable. In the setvar=:=TEST=:=hello example %varname will contain TEST so this will set %TEST to hello. Search for Variable References here for more info.
    • Back out of Tasker to save


    STEP 2 - SET VARIABLE FROM ANOTHER DEVICE


    (i) In this example I'm using another Android device to do this, but you could do it with IFTTT, the Chrome extension or windows app or from anywhere else with the Join API.

    • On another device create a new task called Set Remote Variable
    • Add a Join Send Push action
    • Choose your original device from the device list (the one where you created the profile from Step 1)
    • Set the Text field to setvar=:=TEST=:=hello
    • Accept and go back to Tasker


    STEP 3 - TEST


    If you now execute the task that sends the push you'll see a Flash show up on the other device stating that it's setting the variable. If you now refresh the variable list on that device you'll see that the variable will be created and the value will be set. :cool: