Android and Linux

Sunday, January 9, 2011

Example Tasker Home Automation profile

I'm still pretty new to home automation, but have been coming home late the past few days to a dark house, so let's turn on some lights with Tasker. This assumes you're using Heyu/Linux and ssh, as in my previous post.

This may need some tweeks, I just came up with it tonight and haven't tested it. It would probably be more useful with a Tasker location profile, but I don't actually use any location profiles. When I drive into the garage, as long as my phone's screen is on and unlocked, it automatically connects to my home wifi. When I remove it from the car dock, the screen comes on and it connects to wifi, so I'm using wifi as my trigger instead of a location. If you use a location profile, adjust accordingly.

First, there's no reason to turn on a lot of lights at noon, so we need to know if it's dark when you get home.

Set up a new time based profile called Night. Set "From" and "To" to the times when it is dark where you live. Then make the entry task for the Night profile: Set Variable %NIGHT to "yes", and as an exit task: Set Variable %NIGHT to "no".

The variable should change at dusk and dawn every day, although you may need to adjust it every few weeks.

Now it's as simple as having your trigger check the variable and turning on the lights if it is dark. In my case "wifi connected" is the trigger, but maybe location or "cell near" is better for others. Since I used j2 and b1 in my last post as example X10 modules, I'll stick to them here. Under the wifi connected profile, I'd add:

Perform Task: j2 if %NIGHT matches: yes
Perform Task: b1 if %NIGHT matches: yes

And hopefully the lights will come on when I get home... if it's night.