Hello all XDA users! I created a project that automatically switches the clock format on your WM watchface whenever you switch between the formats on your phone via system settings.
===Prerequisites===
First and foremost, you need to install the Tasker (I used this on full version but it may work on the trial version) and have Allow External Access enabled, you can do this by doing the following:
Press the 3 dot menu
Click Preferences
Swipe over to Misc and find Allow External Access, then tap it to enable it
Done!
Then you need AutoTools by joaomgcd, you can download it here
Have USB Debugging enabled for ADB configuration for AutoTools
To Enable this, do the following:
Go to Settings
Go to About Device
Find your build number and click it several times until the phone says that you have enabled developer mode
Go into Developer Settings
Click on the tab that sets USB Debugging to enable it
Done!
Have ADB Drivers/Fastbook installed, here are two places that you can download these from but you don't have to download from these: Skipsoft, XDA
Have Installed WatchMaker Premium or Free Version
===About this Project===
What this project does is check if you have booted up your device and if so, it records the current time format your clock is set to. Then it checks if you have changed the format of your clock via broadcast intent, then it compares the previously recorded setting and the new setting, if they do not match, the task sends the new setting to WatchMaker and it changes the format on the watch to the new setting.
===Building the Project===
The first and foremost you MUST do is ensure that you have downloaded and got everything from the prerequisites. Once you have everything, follow the instructions for enabling access to system settings for AutoTools (you HAVE to do this in order for the profile to function correctly, as it needs to read the configuration for the 24hr format switch in the system settings, the profile will ONLY be looking at this setting). Once you have done these, you can move on to making the actual profiles
For the first profile, it will record the current clock format soon after the device boots up
So we must create an Event profile that will trigger soon after the phone finishes booting on, leave Invert unchecked
Now here's what you need for the actions:
Plugins -> AutoTools -> Secure Settings. Then click custom settings and do the following:
Setting Type: System
Name: time_12_24
Input Type: String
Leave Value Blank
Read Setting: Enabled
Variables -> Variable Set. Set %TIME_FORMAT to %time_12_24 (its the variable that AutoTools passes for the custom setting). This records the value we got from AutoTools and stores it in a global variable for us to use later on
OPTIONAL: Alert -> Notify Vibrate. For Title: put 'Logged Format Time' without quotes, and for text, added 'Log Format: %TIME_FORMAT' without quotes. This will notify that you have logged the format and will tell what the format is.
OPTIONAL: Task -> Wait. Set it for 10 seconds. This will make Tasker wait 10 seconds to move on to the next action
OPTIONAL: Alert -> Notify Cancel. For Title: put 'Logged Format Time' without quotes, and have Warn Not Exist checked. This will dismiss that notification we just sent 10 seconds ago
For the second profile, it will do the actual process of sending the variables to the WatchMaker App
We're going to create a Intent Received profile that will check if the specified broadcast intent has been received. For action, put 'android.intent.action.TIME_SET' without quotes. This will check if the TIME_SET intent has been received
Now here's what you need for the actions:
Task -> If. Set the condition to %TIME_FORMAT is SET. This will check if the global variable we defined in the first profile has something in it (this is for in case that you didn't boot up your device to store the value to the global variable so Tasker does not return an error since there is no value in the variable)
Plugin -> AutoTools -> Secure Settings. Like the same as like time, we're going to be finding that system variable, time_12_24. Just do the exact same steps as listed for the last time we defined this action
Task -> If. This time, set the condition to %time_12_24 does not match (!~) to %TIME_FORMAT. This will make Tasker check if the system format variable we just grabbed in the previous action DOES NOT match the previously recorded variable from our first profile. This is necessary to check because if you have automatic update clock enabled in system settings, that TIME_SET intent gets called whenever the phone updates to the network time, and because of this, we do not want Tasker constantly nagging us that the format has been update, despite that the format is the same as before.
Plugin -> WatchMaker -> WM Send Variable. Set the variable to send to %time_12_24, which is the new format that we switched to and just checked for.
OPTIONAL: Alert -> Notify Vibrate. For Title: put 'Time Format Changed' without quotes, and for text, added 'Updated Format to %time_12_24' without quotes. This will notify that you have logged the format and will tell what the format is.
OPTIONAL: Task -> Wait. Set it for 10 seconds. This will make Tasker wait 10 seconds to move on to the next action
OPTIONAL: Alert -> Notify Cancel. For Title: put 'Time Format Changed' without quotes, and have Warn Not Exist checked. This will dismiss that notification we just sent 10 seconds ago
Task -> End If. Close that If stated that we have created so far
Variables -> Variable Set. Set %TIME_FORMAT to %time_12_24. This will override the previously recorded value and place the new one in its place in the variable, %TIME_FORMAT
Task -> Stop. Leave everything else blank. This will make Tasker end the task from here
Task -> Else. Leave everything else blank. This basically says that if that system format variable DOES have something in it. This is necessary to check because
OPTIONAL: Alert -> Notify Vibrate. For Title: put 'Logged Format Time' without quotes, and for text, added 'Log Format: %time_12_24' without quotes. This will notify that you have logged the format and will tell what the format is.
OPTIONAL: Task -> Wait. Set it for 10 seconds. This will make Tasker wait 10 seconds to move on to the next action
OPTIONAL: Alert -> Notify Cancel. For Title: put 'Logged Format Time' without quotes, and have Warn Not Exist checked. This will dismiss that notification we just sent 10 seconds ago
Variables -> Variable Set. Set %TIME_FORMAT to %time_12_24. This records the value we got from AutoTools and stores it in a global variable for us to use later on.
Task -> End If. Close up the main IF statement that surrounds everything.
One final thing! Make sure that your watchface in WM has this method or something similar (WITH the quotes): '{ttime_12_24}' == '24' and '{dh23z}:{dmz}' or '{dh}:{dmz} {da}'. This sets the clock format to 24hr if the tasker value is 24, and switches to 12hr if the value is 12.
Note: You DO NOT have to have items such as he notification and clock method text to display exactly as I have, as I have designed these for my convenience.
===Download===
The download files are attached below, you can import this by doing the following:
Long-press the little icon that looks like a house at the bottom of the main menu
Press Import
Locate the downloaded file
Tasker should do the rest and import the entire project and the profiles
===Final Notes===
If you have any questions or issues, please feel free to post them here! ^^
Related
On the portal news on 2016-03-11 (thanks to @MishaalRahman for this).
This profile requires AlarmPad (either free or Pro version) and will activate your own Night Mode by setting an alarm.
You have to go to work the next morning, are sleeping, dreaming of the ones/things you love and then – BEEEEEEP BEEEEEEP BEEEEEEP – getting woken up by some more or less (most likely less) funny message by one of your friends. Awesome, right? No way… But this comes to an end right now.
Use Alarm Pad in combination with Tasker to set up a Night Mode, where you won’t get disturbed by any loud notification anymore. Activating an alarm will automatically set your phone into silence mode during a specific time, only the alarm is allowed to wake you up. When you dismiss the alarm, the Night Mode will turn itself off automatically. Cool, eh?
So, what do we need? First of all, you have to install AlarmPad (which is a great and customizable alarm clock app with native Tasker integration). Download it by following the above inserted Play Store link and continue with Tasker. Let’s start.
1. First, set up a profile called “Alarm set”. This will set a variable %ALARM to true if the alarm has been set. We need this variable to determine whether an alarm is currently set or not.
Use Event -> Plugin -> AlarmPad and select the Edit button. Choose “Alarm set” and confirm it by clicking the check mark on top right (OPTIONAL: you can choose a specific alarm for this by selecting “Restrict alarm” and then choosing the desired alarm).Create a new task and name it (for example) “Set Alarm VAR”. Create a new variable %ALARM and set it to true.Add Audio->Alarm Volume and set it to your desired value (maximum, if you tend to sleep very deep).Now you are done. You can optionally add a toast notification to verify that the task has been executed, for example Alert -> Flash -> Text “Alarm set”.
2. Create a new profile called “Alarm disabled”. This will set %ALARM to false if the alarm gets disabled manually.
Use Event -> Plugin -> AlarmPad and select the Edit button. Choose “Alarm disabled” and confirm it by clicking the check mark on top right.Create a new task and name it (for example) “Reset Alarm VAR”. Set variable %ALARM to false.Add Audio->Alarm Volume and set it to your desired default alarm value when being outside of your house.Now you are done with it. You can optionally add a toast notification to verify that the task has been executed, for example Alert -> Flash -> Text “Alarm disabled”.
3. Create a new profile called “Alarm playing”. This will set %ALARM to false if the alarm is fired and manually disabled.
Use Event -> Plugin -> AlarmPad and select the Edit button. Choose “Alarm triggered” and confirm it by clicking the check mark on top right.Create a new task and name it (for example) “Reset Alarm VAR”. Set variable %ALARM to false.Add Audio->Alarm Volume and set it to your desired default alarm value when being outside of your house.Now you are done with it.
4. Create a new profile “Night Mode”. This will set your device into silent mode during a specific time interval when an alarm is set.
Use State -> Variables -> Variable Value and enter %Alarm ~ true. Return to your profile and select a new task which you call “Night Mode on”.Add Task -> Wait -> 1 minute. Return to the task menu.Add Task -> If and select “%ALARM ~ true”. Return to the task menu.Add Display -> Display Brightness and set it to 0. Return to the task menu.Add Audio -> Notification Volume and set it to 0. Repeat the same for Media Volume and Ringer Volume. Add Audio -> Alarm Volume and set it to your desired value. This will ensure that no other profile which might be triggered between setting the alarm and starting the Night Mode task has reset your alarm volume.At last, add Task -> End If.That’s it.
5. OPTIONAL: Return to the profile screen and add a trigger event to the profile Night Mode: Time.
Here you can define when the Night Mode will start and when it will end, for example, you set your alarm at 8 p.m., but go to bed at 10 p.m. and don’t want to miss messages until 10 p.m. because of reasons. Then select 10 p.m. as start time and whatever end time you want, for example 10 a.m. (don’t worry, if the alarm is triggered before 10 a.m., the Night Mode will automatically being deactivated and you can receive audio notifications again).
6. Create a new exit task for the profile “Night Mode” and call it “Night Mode off”. This will reset your device from silent mode after the alarm is triggered or manually disabled.
Add Task -> Wait -> 1 minute. Return to the task menu.Add Plugin ->AlarmPad and select AlarmPad perform Action” and select “Disable” (OPTIONAL: select the alarm that is to be disabled). Confirm and return to the task menu.Add Display -> Display Brightness and set it to your default brightness. Return to the task menu.Add Audio -> Notification Volume and set it to your default volume value. Repeat the same for Media Volume and Ringer Volume.That’s it.
Now we have set up Tasker to toggle your own Night Mode automatically depending on your alarm’s status.
That’s all, folks. Have a nice dreaming :good:
I' not sure if i understand it very well. How can we set the audio volumes (notifications, ringer and media) in silence mode only at one specifit hore (21:00 pe). When i disable the alarm the volumes are set to the default configuration that we have on the phone? And how do they turn off (silent mode) again?
joguirian said:
I' not sure if i understand it very well. How can we set the audio volumes (notifications, ringer and media) in silence mode only at one specifit hore (21:00 pe). When i disable the alarm the volumes are set to the default configuration that we have on the phone? And how do they turn off (silent mode) again?
Click to expand...
Click to collapse
Setting an alarm will trigger the Night Mode profile (and its related task Night Mode on, which sets all notification/media/ringer volumes to 0). If you have set up a time-trigger (for example between 10 p.m. and 10 a.m.) the task will only being executed within this time frame. For example, if you set your alarm at 8 p.m. and have the given time frame from 10 p.m. to 10 a.m., the Night Mode will only being executed if %ALARM is true and it is past 10 p.m. and before 10 a.m. of the following day.
Disabling the alarm will trigger the exit task (Night Mode off) of the Night Mode profile, thus all volumes are set back to their (pre-defined in exit task Night Mode off)volume level.
If you want to silence your phone at 9 p.m., just use a time trigger for the profile and set 9 p.m. as start and whatever you like as end time.
orville87 said:
Setting an alarm will trigger the Night Mode profile (and its related task Night Mode on, which sets all notification/media/ringer volumes to 0). If you have set up a time-trigger (for example between 10 p.m. and 10 a.m.) the task will only being executed within this time frame. For example, if you set your alarm at 8 p.m. and have the given time frame from 10 p.m. to 10 a.m., the Night Mode will only being executed if %ALARM is true and it is past 10 p.m. and before 10 a.m. of the following day.
Disabling the alarm will trigger the exit task (Night Mode off) of the Night Mode profile, thus all volumes are set back to their (pre-defined in exit task Night Mode off)volume level.
If you want to silence your phone at 9 p.m., just use a time trigger for the profile and set 9 p.m. as start and whatever you like as end time.
Click to expand...
Click to collapse
ok, understood
Thanks
I set in profile task what At a specific time enable wifi and internet radio - that should wake me up.
But if radio don't wake me up I want that few minutes later set/on oryginal alarm clock (where i can set my ring tone or ex. set snooze for 5min/10min or off alarm if I wake up).
I randomly wake up so when i whant that radio wake me up i set time to ON only on tasker profile.
How i can add/what task add to this if I want Get the effect when radio will ON , 5min later clock alarm will ON
try this:
- in profile task, do math on current time, plus x min times 60,
- than convert the result back to normal time format
- do a variable split, splitter empty, to split it by space, to get time only
- you will have to trim possible preceding zero in hour
- than set alarm with the result time
Sorry but You write too complicated for me :|
Can You write this same but maybe on the example and write step by step what to do
Thank so much
Yeah that's far too complicated. Try this.
In your first profile, that turns on your alarm, set a variable %ALARMTIMERCOUNTDOWN =%TIMES+120 (%TIMES is the current time in seconds, and + 120 is two minutes after the current time
Then create a time context profile and click the little tag you change it from time, to variable, and enter %ALARMTIMERCOUNTDOWN as the time.
Then, when the current time=ALARMTIMERCOUNTDOWN the profile will trigger.
Now remember to clear the variable in both exit tasks so if you wake up, the variable will be empty and thus will never trigger
Can You write this step by step. Like this: Go to your profile that turns on your alarm -> in task what enable radio add new variable -> action ("+") -> variables -> add variable - here in "........." write "....... " -> then go to action variable and "set variable" -> ........
In profile I can add new time context and to start time set %ALARMTIMERCOUNTDOWN but i bust add task to this context - what task i should add?
"Now remember to clear the variable in both exit tasks" - I had add variable only on one task "In your first profile, that turns on your alarm, set a variable.... "
someone can help?
gonzolex said:
someone can help?
Click to expand...
Click to collapse
ok, here goes:
new profile1
- trigger: event/date-time/alarm clock: alarm info
- action: set variable %Trigger to %TIMES+120, do math
btw profile2
- trigger: state/variables/values: %TIMES eq %Trigger
- action: do your task
Hi guys
Tried importing a profile which will recognise three repeat keys and trigger an action, but, unfortunately this isn't working.
I created two test profiles, one based on camera button press, another based on shake. Simple result is beep and pop-up, but even that isn't working.
I have heard about key guard and not sure if this may be related tasker is enabled, but on swipe down 'no profiles are enabled' even though all three are checked orange and should be switched on. Phone has been restarted and its still not working...
Any ideas?
Sent from my D6603 using Tapatalk
A profile is active only when it's context(s) are all meet. That's different than being enabled.
Assuming you're using tasker 5, the toggles switched to the right and colored indicate enabled. The profile name being colored indicates active. When active, the tasker notification will show the name of the profile as active.
Try a simple test. Create a profile that has a context of application -> select one app like calculator or something -> use the arrow top left to exit the app list. Now create a new task when prompted and add an alert -> popup action. Just put testing in the text field and save. Now back out of tasker using the device back button multiple times. Open calculator and a pop-up should appear. The tasker notification should show the profile as active.
Now, it's hard to know what is happening with the profiles you're attempting without more information. You should export and post the DESCRIPTION of the profile whenever asking for help with a profile or task.
Long press on the profile name -> 3-dot menu -> export -> export "DESCRIPTION" to clipboard (not XML). Then paste here.
Beginner mode must be off and the profile must be named. If you didn't name it, there will be a default name created from the first context. You need to actually name the profile by long pressing and tapping the "A" at the top.
"Good judgment comes from experience, and a lot of that comes from bad judgment." - Will Rogers
Hi,
lets say i want that every time my smartphone connects with the wlan at home bluetooth should be enabled and disabled when i leave the wlan. this is easy to do with tasker.
but when i enable bt manually when i'm not at home, then tasker has nothing to do when i connect to the wlan. but whe i leave it bluetooth will be disabled.
is there any way to prevent bluetooth disable when i've enabled it manually? maybe there is a solution using variables? set a variable from 0 to 1 when bluetooth is enabled manually and not when it enabled automatically via tasker?
Restore settings being enabled in your profile will automatically restore the configuration based on the entry task. Deselect restore settings (long press profile, with it selected tap the cog/gear icon) and expressly restore the settings in your exit task.
In the entry task add a variable set %BTon to "true". Include an "if statement" in the variable set action "if %BLUE does not match on".
Then in the exit task, when you expressly turn off Bluetooth, add an "if statement" to the BT off action so it only runs if the variable "%BTon matches true".
Make sure to add a variable clear for the %BTon variable at the end of your exit task.
Tips
Thanks
I have a Pixel 4 XL (rooted), there is a way to enable High Brightness Mode when the screen is at 100% brightness and by entering the following in Terminal Emulator.
su
echo on >> /sys/class/backlight/panel0-backlight/hbm_mode
This only sticks until the screen goes off and needs to be ran again to get it on again. I'd like to make a task so that it automatically turns on when the screen is at 100% brightness but I have no idea how to do it. I've watched a few videos but I'm still not sure what to do. Thanks in advance.
Add a task and make sure to name it.
Add an action to the task code -> run shell.
On the line for command put your terminal command;
echo on >> /sys/class/backlight/panel0-backlight/hbm_mode
Tick the box for use root.
Tap the [emoji809] on the line with the "if"
On the first line put the variable %BRIGHT
Tap the center button (probably displays a ~)
Select "Maths: greater than" (will now display a > )
On the second line, enter 230 (* see further down for an explanation)
Back out of the task to save it.
Now create a profile, with the context of event -> display -> display on
Link the task you created above
What this does is each time the display turns on, the associated task will run. But the code will execute only if the display brightness is above the level set. You will need to play with the number to your satisfaction.
On my Pixel 3XL, stock Pie, 237 is actually the highest I've seen brightness go. In theory, 255 is the highest. Other (non pixel devices) have reported an order of magnitude higher. You can view the value of the variable in an alert -> flash action.
If there is a specific app that you will be using, then adding that as a profile context will reduce the number of times the profile will run. Or any other way to narrow down the active condition, maybe a state -> light level context.
ktmom said:
Add a task and make sure to name it.
Add an action to the task code -> run shell.
On the line for command put your terminal command;
echo on >> /sys/class/backlight/panel0-backlight/hbm_mode
Tick the box for use root.
Tap the [emoji809] on the line with the "if"
On the first line put the variable %BRIGHT
Tap the center button (probably displays a ~)
Select "Maths: greater than" (will now display a > )
On the second line, enter 230 (* see further down for an explanation)
Back out of the task to save it.
Now create a profile, with the context of event -> display -> display on
Link the task you created above
What this does is each time the display turns on, the associated task will run. But the code will execute only if the display brightness is above the level set. You will need to play with the number to your satisfaction.
On my Pixel 3XL, stock Pie, 237 is actually the highest I've seen brightness go. In theory, 255 is the highest. Other (non pixel devices) have reported an order of magnitude higher. You can view the value of the variable in an alert -> flash action.
If there is a specific app that you will be using, then adding that as a profile context will reduce the number of times the profile will run. Or any other way to narrow down the active condition, maybe a state -> light level context.
Click to expand...
Click to collapse
Thank you very much, I'll give it a shot.