Categories
IFTTT powershell

PowerShell: Trigger IFTTT Maker Channel using PowerShell v2

I’m in an environment where only PowerShell version 2 is available, which limits functionality and forces me into workarounds. I’ve been interested in using the Maker Channel on IFTTT in PowerShell for some time, but everybody seems to be using Invoke-RestMethod, which is unavailable in PowerShell v2. The following function uses the .NET object System.Net.WebClient to accomplish the trigger in the older version.

You have to create your trigger first on the IFTTT website (or mobile app) and include the three variables (or less, whatever), and link the associated action – I chose the “notification” option, which brings the trigger to my attention on my phone. This, of course, is incredibly versatile – you could set it up to notify somebody else, via text message, phone call, email, or whatever. IFTTT has an awesome collection of ways to act on the trigger. Check it out.

Note: There seems to be a problem with including spaces in the values sent. I’m just not including them, working fine now.

#EXAMPLE USAGE: iftttnotify "work_info" "reports" "accounting" "completed"
function iftttnotify ([string]$triggername,[string]$value1, [string]$value2, [string]$value3)    
    {
    $privatekey ="YOUR_PRIVATE_KEY"
    $URL="https://maker.ifttt.com/trigger/$triggername/with/key/$privatekey"
    $NVC = New-Object System.Collections.Specialized.NameValueCollection
    $NVC.Add("value1","$value1");
    $NVC.Add("value2","$value2");
    $NVC.Add("value3","$value3");
    $WC = New-Object System.Net.WebClient
    $WC.UseDefaultCredentials = $true
    $Result = $WC.UploadValues($URL,"POST", $NVC);
    $WC.Dispose();
    }

Categories
IFTTT

Automatically Play Music After the Game with IFTTT and Pivot Power Genius

For some reason, I’ve been trying to come up with a way to automatically (triggered somehow through the internet) play a song at the conclusion of a sporting event for some time now. I’m not a programmer, I still haven’t really put a good-faith effort toward learning how to work with Arduino, and I’m not an expert on crawling the web for data (especially when it comes to “live” data, like a sports score). Still, this works, but let me go through the limitations.

  1. The sound quality is awful. We’re going low-tech here.
  2. Requires buying a Power Pivot Genius. Only $20 though, right now anyway.
  3. There are multiple potential points of failure. Not like this should be a mission critical thing for you, but still.
  4. You might cut your hands.

First, a little bit about the Power Pivot Genius (PPG); It’s a glorified power strip with two outlets that can be controlled remotely. No dimming, just on/off. You control it through the Wink App. It can also be controlled through IFTTT.

I’ve posted about IFTTT before, so surprise, we’re using it again. We’re going to use the ESPN module as a trigger to turn on one of the outlets on the PPG. It should look like this.

Clipboard01

 

So, assuming you were able to set up your PPG, connect it to IFTTT , and then create the above recipe, you’ve now got an outlet that turns on when there is a “New final score for the Chicago Cubs”. Yep, that means win or lose. Now we just need an mp3 player with a speaker that plays our chosen file immediately upon power up. I found one.

This isn’t my video, but I find it hilarious. Anybody who forces their guests to listen to “The Final Countdown” while they use the restroom is cool by me. Anyway, you can buy one of the little players on Amazon for about $10.  When it arrives, you need to pry the cheap plastic front off. I don’t have a video for you, and the linked video doesn’t show you how. This is how I cut my hands. Take a flat-head screwdriver and work your way around the lip. You’ll break it. Once you get it off, there are four tiny phillips-head screws on the four corners – remove them so you can get to the battery. Cut the wires to the battery; we don’t want this thing charging. Only on/off. Put the screws back in.

Now, go get your song, put it on a low-capacity USB drive you don’t use anymore (or microsd, there’s a slot for it), and power it up on any wall outlet. You will need a USB to wall plug adapter (surely you have an old one not in use) to have the PPG power it. It should play after a few seconds. If it doesn’t, the switch on the side of the unit may not be set to “ON”. It won’t play if it’s on “OFF”, but it will do a disco thing (making you think it should be playing), which was confusing. If it’s playing each time you plug it in, mission (almost) accomplished. Plug it into the appropriate outlet on the PPG and you’re good to go.

However, there is one problem; we’re sending the instruction to turn on the power. This MP3 player will play your song (or list of songs, I guess) until it’s shut off. That means that we need a separate command. Through the wink app you can create a “robot” to detect specific conditions and, if met, execute a command. Not unlike IFTTT. We want to create a robot that detects whether the outlet we’re manipulating has been on for X amount of minutes. In our example, 3 is almost perfect.

Screenshot (Jul 21, 2015 9-46-02 PM)

 

So, now the outlet will be shut off and not repeat endlessly.

Katie already hates it.

Categories
IFTTT twitter

Making your Twitter User Image or Background Auto-Update with IFTTT

You can be annoying to the people that follow you on Twitter by changing your profile picture. You can be even more annoying by doing it often. Here’s how you can do just that.

Categories
IFTTT Pocket

RSS -> IFTTT -> GetPocket.com: A True Replacement for Google Reader

When Google announced that they were going to permanently shutter Google Reader, I wasn’t sure where to go. Well, that is, after the initial shock. Why, Google? Anyway, I went through and tried a bunch of different replacement services and none really felt right. So, I found a better option. Here’s how you can do it too.