Thursday, May 19, 2011

Llama (the android app): my latest discovery, and gleanings therefrom

I've been really impressed with the time-and-location-aware Llama Android app. It's a simple-sounding concept with some big implications.

You teach it about a place you're at (say, Work). The default is to have it pick up cell towers, though he's lately added experimental features, so you can have it pick up Android location, GPS, Bluetooth, and WiFi signals (though when in Learning mode it doesn't pick those up; you have to click to add each one automatically, which is fine).

You can also create Profiles, which are collections of Actions to take. For instance, a "Vibrate" profile might set any sound it can to Vibrate, and perhaps set any remaining sounds to a very low volume. A variety of Actions are available -- turn WiFi off, trigger a reboot (it does check to see if it's been triggered recently when it fires to ensure you're not in a loop), change screen brightness, turn various items on and off, you get the picture.

Then, you create Events based on location, time, amount of battery charge, and a variety of other conditions. When the conditions are met, the event triggers one or more Actions (which can simply be to trigger one of the Profiles you created).

So, for those of you not familiar with it, go play!

References


http://kebabapps.blogspot.com/: the developer's Llama blog.

Tips, tricks, and issues


For those of you who are, here are a few tips and tricks and bugs and questions I've discovered as of the latest Market version today.

  • Event (lack of) Priority: There's no inherent priority given to the Events list. I believe it gets run down in alphabetical order (the same order you see on screen). This can require careful planning if you have lots of Events.
    •  For example, I have a "Battery < 50%" event (which causes some things on the phone to shut down to save battery, and even sets Llama to do its own checks less often, and also turns the Llama icon yellow), and a "Battery < 30%" event (which, among other things, turne the Llama icon red). Well, "Battery < 30%" is in the list, followed alphabetically by "Battery < 50%" -- which meant even when the power was down, the icon turned yellow rather than red (it likely turned red for a fraction of a second from "Battery < 30%" then yellow from "Battery < 50%").
    • The solution? I used 3-digit numbers to order my Events, such that anything I wanted to supersede anything else had a higher number. In this case, I have "110 Battery < 50%" followed by "120 Battery < 30%" and all is fine (unless something further down my list supersedes something in "120 Battery < 30%").
    • And, of course, before any of these items, I had "100 Charging" which turns all back onto defaults. That proves to work out well, as 
    • This took a bit of advance planning but I ran through my list of Events and figured out numbers. The general concept is that Events that affect the same sets of things go from more general with lower numbers to more specific/more important with higher numbers. My general sequence now looks like:
      • 100-199: Battery events (starting with Charging, then lower levels of battery).
      • 300: Not In Areas event (see below for "Not in Areas" vs. "Upon Leaving Area"). This is set up by how I want my phone in general.
      • 400s: Specific Leaving events
        • 410 Leave Car sets bluetooth monitoring to happen a bit less often, for instance, and generally all Leaving events set Normal Profile.
      • 500s: At Work, Leave Calendar With "{whatever}" events to match my set of At Work, Enter Calendar With "{whatever}" below.
        • (Note: I hope he improves the "meeting" setup. Ideally, I'd love to set up a single event like "If At Work, and calendar "Work" shows busy, set phone to Vibrate, and then a matching "If calendar "Work" shows not busy, set phone to Normal. Don't know if Android understands Busy vs. Not Busy for Google Calendars. I don't want my phone on Vibrate all the time I'm at work the entire week I'm on call! And every meeting I get invited to seems to have a different string to search for -- I have enter/leaving for "Meeting," "Mtg," "1:1," "class," "workshop," etc.
      • 600s: At Home events (nights Quiet, weekdays 7am-11pm Normal, weekends 10am-11pm Normal)
      • 700s: Other At {area} events - 700 Work Normal, 710 Car Loud (also make Bluetooth check more often), 730 venues Loud (a couple of loud Locations), 850 venues Vibrate (movie theatres, bookstores, etc.), 
      • 800s: Specific Area/Calendar Event (see 500s) vibrate
        • (Note: it would be great to do the above note, or if that didn't work, maybe a list of strings in the calendar so I could just have one event I could keep adding to -- like "If in Work and Calendar string = (list)"Meeting", "Mtg", "1:1", "class", workshop..."
  • Quit and Restart Llama, sometimes twice, with every set of changes you make. Changes don't seem to take effect immediately usually, and sometimes when I've added something to my ordered numeric list, above, it has taken me two Quit and Restarts before it seems to work. No big deal but good to know.
  • "Upon Leaving Area" events can be problematic if there's overlap between Areas you're in. For example, when I was in a Work meeting (yes, you can have Events like "When Location is Work and calendar contains "meeting" trigger profile "Vibrate"). But with checks happening every few minutes, I could have an issue because I turn my phone up to Loud in the car (in case I have the radio on ... btw my car is detected by the fact that there's a bluetooth in the GPS, which is what it really detects). Usually, being quiet in a meeting is more important than being Loud in the car, but a sequence like this could occur if I had a meeting on my calendar that I went straight into from the parking lot:
    • Enter area Car - Loud profile
    • Enter area Work - Normal profile
    • Location Work enter Calendar "meeting" - Vibrate profile
    • Leave car - Normal (even though you're still in the work meeting, "Enter work meeting" only triggers when you, well, Enter the work meeting, it doesn't get re-triggered because you Left the car)
  • ... the upshot being that my phone is at Normal in the in the meeting and not Vibrate. I discovered the solution: there's a "Not in Areas" (different from Leave areas) item, and any time I set up a change based on something in an Area, I make scrupulously sure that area is added to the "Not in Areas" list, which has some sensible defaults (Volume Normal, for instance). So my "Not in Areas" list contains, among others, Car and Work. Therefore, the new sequence looks like:
    • Enter area Car - Loud profile
    • Enter area Work - Normal profile
    • Location Work enter Calendar "meeting" - Vibrate profile.
    • (Now I was in Car and Work both at once, with no intervening time, so the "Not in Areas" never triggered, as I was in one or the other area and there was no Leaving" action).
  • If you live close to work, you can get better results using WiFi than Cell towers. Work and Home for me share a cell tower, and Work is near a busy road with lots of places I might go to eat or shop, so when I first set it up, I was always at Work and at Home. WiFi definitely works better. Also in this case...
  • Avoid using "Learn" unless you're only going for cell towers. "Learn" automatically adds cell towers to your current location, even if they're already added elsewhere. I like looking at the "Recent" tab and manually adding them. More on why later.
  • MAC addresses are even better than WiFi names. If you start picking every WiFi name, you'll find that if Llama sees "Guest" or "Linksys" it'll think you're in two different Areas at once. There's a possibly-useful exception below which I'll talk to in the next point. Which leads me to...
  • I made a few "Bit Bucket" Locations. These help prevent me from inadvertently setting up Llama to think it's in two places at once. Because they're less useful, and Llama sorts Uppercase before lowercase, I name them with "yyy{restofname}" and "zzz{restofname}"
    • If I am in one Area and see something come up that I've already defined in another distinct Area, I have a "zzzBad or Redundant" Area defined that I don't use in any Actions. If I just removed it from all Areas I might accidentally pick it again in one of those Areas. I use this especially for the above-mentioned "guest," "Linksys" and also some cell towers like the -1:-1:-1:-1 that shows up.
    • On the other hand, I found that at Work we have multiple locations that use the same WiFi names. Those go into a "Work - all areas" Area (which I've yet to find a use for ... so far if I'm another location it's either a Data Center (Loud profile) or a meeting offsite (Vibrate profile). But it may come in handy someday.
    • Also, just because it might be useful to know a general area, I tend to keep cell findings in separate Locations. Whenever I'm somewhere in my home town of Ann Arbor if I'm adding an area, I add all the cells to "yyyAnn Arbor area." Maybe someday that will come in handy if, say, there's an enhancement where I can have it send a text as an Action. I can have it text my partner to tell her I'm almost home or something like that. Maybe it'll never come in useful but what the heck. why not.
  • Llama will eat your battery if you use other than the default Cell settings. Part of the reason why...
  • If it turns your WiFi on and your WiFi connects, Llama won't turn it off. It sounds like that's a limitation. I wonder if the Android OS has any sort of system call that says "Turn on the WiFi but DON'T connect," or if Llama could be enhanced to keep track that Llama itself just turned it on, and turn it back off at the end of the check.
More as I think of/discover more!

Saturday, August 21, 2010