Create a Power Menu Action Toggle

Learn how to use state in a Power Menu Action

  1. joaomgcd
    In this example you'll learn how to toggle Bluetooth with a custom Power Menu action.
    You can use the same procedure to toggle any other setting you want.

    You can download a pre-made project with this example here.


    • Create a new task called Set Power Menu Bluetooth
    • Add a Power Menu Action action to the task
    • Set the action's ID to something like Bluetooth
    • Set the Type to Toggle
    • Set the Title to Bluetooth
    • Select an icon for the tile
    • Set the Command to togglebluetooth
    • Set Active to true just to test it out
    • Run the task
    • Add the Bluetooth tile to your Power Menu and check that its state is enabled


    • Add an If action to your task
    • Set the condition to %BLUE matches on (%BLUE contains on or off depending on the state of bluetooth on your device)
    • Add Else and End If actions
    • Add a Variable Set action
    • Set %status to true
    • Move the Variable Set action to inside the first If action
    • Copy that action and paste it inside the Else part
    • Change the value of %status on the new action to false
    • Move the Power Menu Action to the last position on the action list
    • In the action set Active to %status
    (i) Using %status here will ensure that the tile's state is set to true is Bluetooth is on and to false if it's off. If you're controlling something else you need to use that thing's state instead of %BLUE.
    • Toggle bluetooth and run the task and check that the tile's state will match the bluetooth state on your device


    • Go into the Power Menu Action action and copy the Command you set up earlier. You're going to use this in the new event
    • Go back to Tasker's main screen, open the Profiles tab and create a new profile
    • Use the Command event condition
    • In the Command field use the togglebluetooth* command like you set up earlier in the Power Menu Action
    /!\ In the video I first forgot to add the * at the end of the command filter and made it not work. That's because the command that the tile sends is actually something like togglebluetooth=:=true_or_false because it is a tile of type Toggle so it'll append the state at the end of the command like that. If you didn't use the * at the end of the command filter, Tasker would only match the togglebluetooth command exactly. Check out the Tasker Command System and the Power Menu Action's help file for more info.
    • Set the Variables field to newstatus. This will create a variable with the name %newstatus with will contain true or false depending on the new state of the tile after being clicked.
    • Accept the event configuration and in the task add a Flash action with the text New Status Set to %newstatus.
    • Back out of the task, save your setup and click the tile in the Power Menu. Check that the flash is correctly showing the wanted status.
    (i) You need to click the back button on your phone after clicking the tile to see the toast on the screen since the power menu will be covering it if you don't click back


    • In the task where you're flashing %newstatus add a Bluetooth action and set it to Toggle
    • Add a Perform Task and configure it to perform the task we configured earlier: Set Power Menu Bluetooth
    • Test the task by running it manually and see if it updates both the Bluetooth status on your device and the tile's state
    • Go back to the main Tasker screen, save your settings and test out your new tile!
    You'll now be able to toggle bluetooth for your Power Menu screen!
    Apply this to any setting/control/home automation device you want! :cool: