When configuring an alarm, you can tell PicoLog 6 to trigger an audible alert from your PC, a digital output from a compatible logger or a visual alert on the screen, but you can also run an external application using the "Run application" command line feature.
Very quickly, we can think of many interesting uses and ways to use this command line such as sending alerts via email, SMS messages, perhaps a Skype message and invoking a script or executable file. But you'll soon find yourself in hot water with your IT department, as there are fundamental security concerns over launching email clients and messaging services to automate sending an email alert from the command line, and for good reason!
This article explores a simple, secure and completely free way of using the command line to send an email message or notification to your phone, without giving your IT team a heart attack or incurring additional costs.
First, you need some background on voice-controlled devices at home to get a handle on this IFTTT thing and why it exists. If you don't own a SMART home voice assistant such as Amazon Alexa, Microsoft Cortana, Google Assistant or Apple HomeKit, and haven't quite got into automating your home yet, you probably won't have heard of this company's web service.
On the company's website, they describe their IFTTT service as "the free way to do more with hundreds of the apps and devices you love, including Facebook, Twitter, Dropbox, Evernote, Nest, Fitbit, Amazon Alexa, and Gmail". That's all very well; I've heard all this hype before, but what does it actually do?
The company goes on to say "We bring services together into Applets. Applets are specific things that can happen when you connect services — things your apps can't do on their own". I feel we're getting somewhere now.
IFTTT means "If this, then that" which simply means that if some trigger event happens, then do something. An example might be "When I leave my house in the morning, turn off my Hue lights", (Hue is a brand of Smart Lighting compatible with your chosen voice assistant).
Hundreds of devices and apps are available for IFTTT, not all of them control devices, such as a well-known pizza delivery company beginning with 'D'. So you could automate the following event: "When I'm 100 meters from home, order a double pepperoni pizza with garlic stuffed crust." It uses your phone's GPS location to know when you're nearly home from work, and then triggers the well-known pizza takeaway app to order home delivery.
When you create an account, you can link your Google or Facebook account for easier access, and IT managers ... you'll be pleased to know that two-factor authentication is available, although not turned on by default.
So that's the background covered. We're all clear on the wonderful ways IFTTT will change our lives – I'll never have to think about ordering pizza again!
At the time of writing, PicoLog 6 does not specifically support IFTTT with a special app for your PC, phone or tablet. However, IFTTT offers a way for third-party applications to send a trigger signal, which can be configured to do anything available on IFTTT (turn on lights, wake up the dog, order the groceries, turn on the heating, send an email, SMS, phone notification, order a pizza and so on). This service is called The Webhooks service, and can either be used to receive a web request (called a "Maker Request") or make a web request.
As you've guessed by now, it turns out PicoLog 6 can send a URL to make a web request from IFTTT.com. Once the Webhook is configured, a personal URL is generated for use in your application to trigger the next action. The "Run application" command line in the alarm setup dialog allows you to invoke a browser on an alarm event and trigger the personal URL generated earlier. IFTTT receives this web request and fires the "then that" action. To invoke a browser in a Windows command line, you must use the Powershell application.
In Windows 10, use the Powershell command Invoke-WebRequest, then the URL with your personal key (I've removed my personal key below and replaced with the words "personal_key"), then the -UseBasicParsing option, wihch is only required when you're using a Powershell version older than 18.104.22.168. Below is what I used in PicoLog 6 command line:
powershell.exe "Invoke-WebRequest https://maker.ifttt.com/trigger/PicoLog_alarm/with/key/personal_key -UseBasicParsing"
Indeed, PicoLog is cross-platform compatible with most supported Linux distros and macOS.
So in Linux (I tested in Ubuntu 18.10), you can use the curl command. curl is not installed as standard in Ubuntu 18, so open a terminal and type sudo apt install curl, you will probably be asked for your admin password, and then the package installs. While you're in terminal, you may as well test your new curl command with the personal key. Type the following into terminal (again I've removed my personal key and replaced it with the words "personal_key":
curl --basic https://maker.ifttt.com/trigger/PicoLog_alarm/with/key/personal_key
...after which I was greeted with the following pleasing message in terminal:
Congratulations! You've fired the PicoLog_alarm event
Now paste your whole curl command into the PicoLog 6 "Run application" command line.
For macOS, it's exactly the same command, with the one minor exception to the procedure above, that curl is already installed in macOS by default!
After sending a "Maker Request" from PicoLog 6, you want to send a notification or alert to your phone or tablet. The easiest and most economical way to do this is by downloading the IFTTT app on your iOS or Android phone (or tablet) and sign into it with the same account you created you online IFTTT account with. You can configure SMS messages, but there is a cost from IFTTT to send SMS messages, so as long as you have mobile data or WiFi the IFTTT app will serve you well for no cost. Similarly, the trigger could be configured to send an email from your favourite email client to an email address of your choice, I tested it using the "Office 365 Mail" applet in IFTTT and it worked perfectly. Various attributes can be changed such as the message content and subject headers.
As well as PicoLog 6 storing the trigger events as standard on the graph and in the event list, IFTTT also stores your trigger events so they're accessible online and in the phone app.
For now, I think I'll carry on ordering my pizza in person, but there's a glimpse of a very interesting future out there, a future where PicoLog 6 can order your pizza... the possibilities are endless.