Skip to content

Instantly share code, notes, and snippets.

@joelbyler
Last active August 25, 2016 13:28
Show Gist options
  • Save joelbyler/2356f957defd5a8b09bba79f88fd8bdb to your computer and use it in GitHub Desktop.
Save joelbyler/2356f957defd5a8b09bba79f88fd8bdb to your computer and use it in GitHub Desktop.
Dad's Busy Status

Add your Particle Photon to the site below (it should come with instructions for how to do this) https://build.particle.io/

Create a 'New App' in the particle online IDE (build) and copy / paste the file below. I can't remember, you may need to add the header file rgb-controls/rgb-controls.h to your 'App' in the IDE as well

Sign up or login to IFTTT and create new recipes, you'll need to create a Maker Key or something here, its been a while since I've been thru this.

Its hard to show what these look like in a gist but I'll try:

Recipe Title If Maker Event "i_am_working", then call a function

Trigger / Maker event name i_am_working

**Action / Then call (Function Name) ** stat_upd on "particle device name"

**Action / with input (Function Input) ** EventName

Repeat the above steps for each of the commands that you are interested in triggering on the photon:

  • do_not_disturb
  • i_am_working
  • i_am_driving
  • i_am_free

Clone this repo and create your .env file (requires IFTTT MAKER TOKEN) follow the instructions on the README to get this deployed to heroku

If you get to this point and it doesn't work, hit me up and I'd love to walk thru it with you to see what's missing. And hopefully clean this up a bit so it makes more sense for others. :)

// This #include statement was automatically added by the Particle IDE.
#include "rgb-controls/rgb-controls.h"
using namespace RGBControls;
int status_update(String command);
Led led(D2, D1, D0);
Color red(255, 0, 0);
Color green(0, 255, 0);
Color blue(0, 0, 255);
Color orange(255, 100, 0);
Color yellow(255, 255, 0);
Color magenta(255, 0, 255);
Color cyan(0, 255, 255);
void setup() {
Particle.function("stat_upd", stat_upd);
}
void loop() {
// led.off();
}
int stat_upd(String command)
{
Spark.publish("stat_upd", command);
if(command == "do_not_disturb")
{
led.setColor(red);
}
else if(command == "i_am_working")
{
led.setColor(orange);
}
else if(command == "i_am_driving")
{
led.setColor(blue);
}
else if (command == "i_am_free")
{
led.setColor(green);
}
else {
led.off();
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment