Android, Automation and more!

Good morning with AutoHue

Some people have been asking about Tasker Variable support and how to use it. In this post I want to share one of my personal setups with you, which slowly turns up the brightness of the lights in my bedroom, simulating a sunrise. This task is set up to launch whenever my phone alarm goes off, that way I always snooze with a sunrise!

So let’s get to setting things up!

Step 1. Create a new Task

Step 2. Add a “For” action (+ -> Task -> For), Set Variable to %BRIGHTNESS (or any other variable name of your choice, as long as you are consistent) and Items to 0:255:5 as shown in the image. What this does is set the variable %BRIGHTNESS to all values from 0 to 255 with steps of 5 (Thus 0, 5, 10, 15, …., 245, 250, 255).

Tasker For loop

Setting up the variable

Step 3. In this for loop create a new AutoHue action (+ -> Plugin -> AutoHue). Press the pencil in Tasker to configure AutoHue and connect to your bridge. Now select the lights you want to control (I choose All Lights since I only have 3 bulbs in my bedroom) and set the command to custom Json String. Here comes the magic, set Custom JSON to: {“on”:true,”bri”:%BRIGHTNESS,”effect”:”none”,”sat”:246,”hue”:9410} as seen in the screenshot. What happens here is that Tasker will replace %BRIGHTNESS located in our Custom JSON with the values stated in step 2. Thereby increasing the brightness with every command that will be send! Save these settings and return to the Task Edit screen.

AutoHue setup

Example of AutoHue setup with Tasker variables

Step 4. We are almost done but there is one more important step, if we would run it right now Tasker would speed through the For statement blasting out the commands to the lightbulbs at such a rate that both the hues will not respond correctly and we can’t speak of a sunrise. To fix this we add one more Task inside this For statement. Namely “Wait” (+ -> Task -> Wait) and set this action to 2 seconds, of course you can lower this value if you like a faster sunrise or up the value if you enjoy a slower sunrise. With 2 seconds the complete sunrise takes about 2 minutes.


Make sure AutoHue and Wait are located in the For loop (shown by the indentation of these 2 actions)

That’s it! You can now press play at the bottom of the Task Edit screen to test the Task and see if it works. If you want the sunrise to execute when you alarm goes of follow the optional Step 5.

Step 5. (optional) Create a new profile and select Event -> Date/Time -> Alarm Clock. Here leave everything blank and set the task created at step 1 to execute. Now whenever your alarm goes off your hue light bulbs will execute a sunrise!


Some notes:
- Variables are not replaced when using the “Test Command” button inside the AutoHue configuration screen. This only happens when the action is executed by Tasker
- To make creating custom Json commands a little easier you can set up a normal command, then save the action and enter the configuration screen again. Now if you change the command to “Custom JSON” you will see your previous settings are already there! You can now simply replace or add the corresponding variables.

A New Home

Hi All!

So what is this new website? Well it’s the new home for all my stuff!
Stuff? Yeah stuff. I’m planning on making this the new home for my Android apps, but also everything else I happen to come across and feel like sharing. Most of it will be tech stuff (Android, Gadgets, Home Automation, tutorials etc.) but I also enjoy playing guitar, sports (Snowboarding, Fitness, Surfing) and of course games/music/movies so who knows what might end up here.