I’ll admit, my posts have been lame lately, but don’t worry, I just found something that I’m pretty excited about! (This is not a paid endorsement, but it will get a bit geeky. ) Automate by LamaLab is a clean, simple, fun and free (!) way to turn your IoT imagination into reality. The app puts all your Android’s interfaces at your disposal to create powerful automation and expressive working prototypes.
Automate by LamaLab is a clean, simple, and fun way to turn your IoT imagination into reality.
I found it yesterday while looking for a good way to hack together a custom Android NFC reader. After looking at a few other options, I ended up geeking out on Automate for the rest of the day! It’s awesome! So I wanted to share a quick up and running tutorial so you can join the fun with your very own “Hello World!”
Automate Task Building Basics
In short, Automate is an Android task automator that allows you to program task logic using a very clean, drag-and-drop flowchart interface. Each sequence of events, called flows, has a starting line and are constructed by connecting together several building blocks. Automate makes it easy for non-programmers to make cool stuff happen, for programmers to make cooler stuff and with a bit of understanding of the Android OS, it seems that the possibilities are all but endless.
The blocks are where the magic happens. Each block is either an action block or a decision block. Action blocks make things happen. They trigger things like turning on the flashlight, vibration, or sending a message. Decision blocks get triggered, check one of the phone’s inputs, and depending on how they are evaluated, change the course of the flow. This could be checking whether there is any ambient light or WiFi connection or explicit controls like user Yes/No dialogs.
Ok, you get the gist. That’s enough to say “Hello World!”
Time for an Android “Hello World!”
This seriously might be the easiest the “Hello World!” I have ever seen. All that it is going to do is start the flow and cause a “toast” message to be displayed with the text “When you show deep empathy toward others, their defensive energy goes down, and positive energy replaces it. That’s when you can get more creative in solving problems.” Just kidding, it’s gonna say “Hello World!”
- Create a new Flow by tapping the + at the top of the screen.
- Select the Toast Show block out of the Interface sub menu or by searching for “toast.”
- Tap the Toast Show block on the flow diagram. Set the Message to “Hello World!” and the Duration to Long.
- Drag a connector from the OK of the Flow Beginning to the IN of the Toast Show block.
- Tap the checkmark (√) at the top of the screen to save the Flow. In the following screen, tap the pencil to edit the name of the Flow by changing <Untitled> to something more interesting.
- Press Play!
It’s so simple it hardly deserves a “Hello World!” tutorial, but this is just the beginning. By now you’ve probably noticed that there are 260 other blocks you could have used. To name a few interesting ones: Google Now voice command, Audio record, Flashlight, Take picture, Tone play, Vibrate, Video record, HTTP request, NFC tag scanned, Wi-Fi connect, Calendar event add, Google Drive upload, Notifications action, Notification hide, Notification interact, Notification posted, Notification show, Screen lock set state, Screen orientation, Toast show, Geocoding, Weather, Gmail send, SMS send, Ambient light, Ambient temperature, Device acceleration, Device orientation, Screen brightness, and Call outgoing.
Try a few out and connect them together to see how they work.
Now For Something Useful
Ok, I lied. This example is not that useful but it is simple and it does demonstrate a few features that will help in making something useful. This example shows a couple more blocks, both are decision block but one causes a dialog to show.
The first block checks the device orientation to see if the device is lying flat. If it is, it continues to the next block, if not, it starts checking the device orientation again.
In the second block, the phone checks the atmospheric pressure around the phone and stores it as the variable currentPressure. Since it is not checking if the atmospheric pressure is within a range, this block will all way continue through YES.
Finally, the third block displays the current atmospheric pressure in a dialog. The interesting thing here is that the message uses string interpolation to evaluate round(currentPressure) and display the current atmospheric pressure value as an integer. The dialogue user responses are meaningless here but you can see how they could be useful to program your tasks.
Nobody said it would be life changing, but you get the idea of what’s possible. Take a look at the tips below and get started!
5 Tips To Level Up the Automation Power
- You can use variables, functions, and expressions instead of static values for inputs by clicking the fx button beside the input and output fields. Expressions should start with “=” eg. =lowerCase(“Hello World!”)
- To set variables, in the block’s Output fields enter the name you would like to give to that variable. For instance set the Dialog Input’s output variable to inputText and reference that variable as an input to other blocks.
- You can construct more expressive variables; dictionaries (key, value pairs) and arrays (sequences of values) which can be written to JSON files or sent across the web as HTTP POST payloads.
- The urlEncode() function can be used turn dictionaries in to URL query parameters. Eg. =urlEncode({yourValue : ”something”}) will be converted to &yourValue=something.
- To make a flow that is constantly listening for and reacting to a stimulus, connect the final OK connector to the IN of the block following the Flow beginning block.
Ok, go nuts! And let me know in the comments if you make anything cool!