Adjust Android Phone / Tablet Brightness and Volume Per Mode

EDIT - I originally posted this as a "how-to", explaining how I setup my Android tablets and phone using Tasker and AutoRemote. I don't want to stifle others wanting to share their solutions in this space, whether it still be in the Android space using things like MacroDroid, or those who have signed up to the Apple eco-system, all are welcome to post their own creations to achieve this outcome.... plus any other weird and wonderful variations.... Though I may post separate topics, so stay tuned.....

I recently set one of my Android tablets up to adjust the screen brightness and volume based on the mode set in HE. Below are some notes on how I did this. Due to the use of Tasker, this is only relevant for Android devices.

The short explanation is that I used a HTTP call from Rule Machine rule when the HE mode changes, which is received on my tablet using AutoRemote and Tasker, with Tasker storing a variable to represent the mode name passed in the HTTP call. Tasker then adjusts the screen brightness and volume based on the mode name received.

I will skip over the initial setup of Tasker and AutoRemote, but can add some notes if people need them, or at least links to existing instructions.

Setup the Tasker Variable

  1. Open Tasker
  2. Across the top of the screen select the Variables (Vars) tab
  3. In the bottom right click the plus symbol to add a variable
  4. In the pop-up at the top of the screen enter a name for the variable, leaving the percent symbol in place, tapping the tick to create the variable. I called my variable Mode.
  5. If you want, tap the variable and enter a value, e.g. Day, Night, etc.

Setup a Tasker Profile to Dim Screen Brightness and Mute Device Volume

  1. Open Tasker
  2. Select the Profiles tab
  3. Tap the plus symbol to add a new Profile
  4. Select State, Variables and finally the Variable Value state
  5. Tap the Conditions configuration icon (tag-style icon) and select the recently created %Mode variable (at the top of the list)
  6. In the Value enter one of the modes where you want the display and audio settings reduced
  7. If you have more than one mode where this will be the case, tap the plus icon in the Conditions banner and repeat steps 5 and 6.
  8. Tap the back arrow to return to the profile setup
  9. Tap the New Task option that pops up, entering a name for the new task, like Night Mode Settings
  10. Tap the plus icon to add action
  11. Select Display, Display Brightness, adjusting the brightness setting on the slider. Tap the back arrow to return to the task setup
  12. Tap the plus icon to add a second action, selecting Audio, System Volume, adjusting the volume setting slider. Tap the back arrow to return to the task setup
  13. Tap the back arrow again to return to the profiles tab
  14. Tap the tick in the top right of the screen to save the changes.

Repeat the steps above to setup another profile for raising the brightness and volume for different mode(s).

Test the changes by going into the variables page and manually adjusting the mode variable and seeing the tasks run and take effect.

Setup Profile to Receive Mode Change Command From HE

  1. Create a new profile, selecting Event, Plugin, AutoRemote, AutoRemote
  2. Tap the Edit pencil icon in the configuration banner
  3. Tap the Message Filter, entering the word mode. You can set this to be case insensitive if you wish.
  4. Create a Task that sets the mode variable to %arcomm, a variable that is populated when the AutoRemote plugin is triggered by a command being received that has the format of mode=:=Night, where arcomm would have a value of night in this case.
  5. Save the profile

Sending the Mode From HE
I chose to use Rule Machine to send the AutoRemote command, but you can use whatever approach works for you.

  1. Create a new Rule Machine Rule, triggered by a change in mode
  2. Under Actions, select a HTTP GET call, entering the following address:

http://< IP of Phone / Tablet >:1817/?message=mode=:=< Mode Name >

replacing < IP of Phone / Tablet > and < Mode Name > with appropriate values. Depending on how you setup AutoRemote, you may also need to adjust the port from 1817.

Setup additional RM rules or conditional actions in one rule to handle each mode. I personally prefer to send all the modes to the device and record them in the variable, then react to the one's I want through my choice to configure a Tasker profile for that mode.

Enjoy!!

7 Likes

Excellent write-up, thanks!

Not to glom onto this topic, but since I have a similar workflow in my home, I thought I'd share this as an alternative method. I use spoken commands to Alexa, where I've set up Routines, that in turn Send Notification to my Android device, which interprets the incoming message's payload (using Tasker) to change my phone's settings (using a complex Task).

On Alexa:

  • Routine > If I say... > "Switch my phone to normal" > Send Notification > "trigger_mode_normal"

On phone:

  • Tasker > Profile > Event: Notification > Owner App: Alexa > Text: trigger_mode_normal
  • Tasker > Task > 1. Alarm Volume = 6, 2. Media Volume = 20, Auto Brightness = On, etc.

Indeed, if you're willing and able to allow Alexa to act as the intermediary between HE and Tasker, this setup becomes infinitely expandable, as you CAN trigger Alexa Routines directly from Hubitat. All you have to do is:

HUBITAT

  • Create a virtual device of type VIRTUAL CONTACT SENSOR
  • Include the new device in Alexa Echo skill/app
  • Create a Rule containing an Action that sets that device to "Open"
  • Note: Same rule should "Close" the device after a few seconds delay

ALEXA

  • Create a Routine which gets triggered by that contact going "Open"
  • Do all the things you want here (which could in some cases duplicate HE capabilities, but importantly Speak a response and/or Send Notification to your Android device, where your coded message gets intercepted by Tasker, as above)

NOTE: While typing this, I realized a similar workflow could probably be established between HE and your Android device(s) using Pushover, since that service allows messages to be sent to selected endpoints, including web browsers and PCs ... unlike Alexa > Send Notification, which only targets the main Android device on which the "Alexa" app is installed.

2 Likes

Im going to have to try this when i get home!

1 Like

Download the Hubitat app