This is a task that you can easily attach to a widget to toggle settings. In the example, the Ringer Volume is toggled between high and low and the label of the widget is changed to reflect the current setting.
After you've downloaded the task, press Tasks to go to the Task Edit screen, then press Menu and Import
and select ToggleTask.
Once it's imported, you can attach it to a widget. Go to the home screen and long-press, select Widget then Task. Once in the Tasker screen, select ToggleTask using the top selector and press Done.
If you want to edit it in the future, just press Tasks and select it from the top bar. Once you click Done, the widget function will have been updated.
How It Works
A variable called %STATE is used to store the current toggle state, either 0 or 1. The first two actions do things when %STATE is 0, the second two actions do things when %STATE is 1. The last two actions just swap the value of %STATE between 0 and 1.
Change The WIdget Icon With State
You could replace the Set Widget Label actions with Tasker / Set Widget Icon actions to toggle the icon when the state changes. Just click on the action, then click on the action name (Set Widget Label) to change it.
Update the Widget When Something Else Changes Ringer Volume
To do that, you need another profile which listens for the ringer volume changing and sets the widget appropriately:
After installing that profile, you will see the widget label changing as the ringer volume goes higher or lower than 4.