Coming home to a house with the outdoor lights on is much nicer than coming home to a dark house. With a bit of scripting it was possible to automate the outside lights to follow this logic,
- if it's 30 minutes after sunset, and at least one person is not home, then turn the lights on.
- if it's after sunset and everyone is home then turn the lights off.
- if the lights have been manually turned on, leave them on (i.e. guests are expected).
Sunset & Sunrise times.
An easy way to get sunset/sunrise times is from wundermap. You'll need to register (for free) to get an api key, once done you can get current conditions, forecasts, astronomy info etc. The following will download theastronomy json file for Sydney. Put this in a crontab and download it once a day.
curl http://api.wunderground.com/api/<your_api_key_here>/astronomy/q/Australia/Sydney.json >astro.json
A simple parser can then pull out the hour and minute for sunset and sunrise.
Presence.
Presence is a common issue in home automation systems, i.e. knowing who is home (or even who is in each room). To deduce who is home I used a simple cheat - ping everyones mobile phone on the wifi and see which respond. If the mobile doesn't respond we'll assume the person is out. Of course this assumes the mobile hasn't just gone flat, been lost or had the wifi turned off.