Working from home: Email notification lights!


#1

Though I’d share my piston for “working from home” since this is the case for quite a lot of people. It might be useful for others to use or build on top of.

Highlights:

  • Keeps track of emails from Outlook and Gmail
  • Changes Lifx lights to green, yellow, orange or red depending on total email count.
  • Clears emails and lights to when no new emails.
  • Breathes blue for outlook and red for Gmail when a new email comes in.
  • Sends a push notification when there are more than 10 emails. Shows total and what is coming from Outlook and Gmail.

I hope it’s useful to others!

Also, I’m more on the new user side of Webcore, so if anyone has ideas on how to simplify and be more efficient I’m open to suggestions.

Best,

Julio


#2

I love this kind of dynamic programming!! Kudos! :+1:

Bonus points for keeping the count (and count reset) entirely in webCoRE.
(so we don’t see 4,187 unread messages, LOL)


I am curious what type of programming you are using to turn on “Work email” and “Gmail” switch??
(not seen here)


#3

@WCmore,

Yeah, that was the most difficult part since there’s no direct integration with Outlook 365 or Gmail to ST. Also, there is no direct integration with the email services with IFTTT (there is for outlook 365, but it never worked)! so I had to get really creative with that and use Microsoft Flow.

Here’s what I did to get the email services to turn on the work email and gmail virtual switches:

  1. Created an automation task in Microsoft Flow: When new Outlook email comes in, create a Trello card in the email board under the Outlook list.
  2. Same for Gmail, but on the Gmail list on the same board (it’s nice that Microsoft Flow supports Gmail).
  3. Then on IFTTT turn on the email switches when a new card is created in Trello.

Quite a few chains there, but it actually works pretty well with about a 3 - 5-second delay. I couldn’t figure out a faster way. :frowning:

If you have any other ideas, let me know!


#4

I don’t want to commit to $15 a month for the app, but I wonder if you can make a web request as your action in Flow. If so, you could bypass Trello & IFTTT entirely, and simply make a web request to trigger a piston that simply turns on the appropriate SimSwitch.

At that point, your piston above would take over.


#5

I get access to Microsoft Flow through my work, so I don’t have to pay the monthly fee. :smile:

Cool. Thanks for the tip. I’ll try to do the web request.


#6

If Flow can send it, here is a link showing how we can use the External URL to trigger a piston.


#7

Got it working! Thank so much for the tip, it’s so much faster, almost instant!

On ST, I used an If condition and set virtual device to IFTTT named my value and pasted the “URL IFTTT Maker Channel” into Flow. So when the email comes in, it pushed it to ST and triggers the if statement.

Found some more cool stuff I can do too. I can pass my calendar events start and end time and change light to red outside office so the kiddos don’t come running in during a meeting. lol

This is so awesome, so manny possibilities!

Thanks again!


#8

You may also be able to go a step farther and bypass IFTTT, if alternatively you:
► pasted a “piston’s External URL” into Flow

The External URL should point to a new piston that only does one thing:
► Turns on Gmail switch

Your original piston above could take it from there.


Pro Tip:

You could create two mini-pistons, but my preference would be to simply add arguments to the end the External URL to allow for two different links to activate the same piston.
(with the sole task of turning on either the “Work email” or “Gmail” switch)


#9

Tried that, works much faster too. However, it just keep turning on the “Work email” switch over an over again, even if I didn’t get an email (after the first initial email comes through).

How can I stop it after one request came through?


#10

When you say “it”, do you mean Flow is doing a web request to the new mini-piston more than it should?


#11

From my understanding, it’s only sending it once, as it was with IFTTT Maker Channel. The only thing I changed on Flow was the URL.

I checked Flow and it only runs once when a new email comes in (sends the request once). However, on the Webcore the piston runs over and over again with just one email coming through. Not sure what I’m doing wrong. I think the issue is on the Webcore side? I’ve never used the External URL from WebCore, so I might be building the piston correctly?

WebCore:


Flow:


#12

I think the issue is you are making a web request in the same piston that is toggling the Gmail switch.

What I was trying to explain is slightly different:

Flow sends HTTP web request to a new piston…
That piston has only one command: Turn on Gmail switch
(You do not want a web request in that piston)

  • This way, when Flow sees a new email, it does the HTTP request, and nothing else.
  • The piston it points to does one thing, turns on the Gmail switch, and nothing else
  • Your original piston sees the switch turning on, and does all the heavy lifting.

#13

Makes sense, I got it working now. Got a little confused for moment.

Thanks for the help on this! Makes everything so much better!


#14

Glad to be able to help.

I think Flow was triggering the piston once, and then the web request in that piston called itself, which triggered the piston again… Ad infinitum…


#15

LOL. Yes! At one point I couldn’t get into the piston, it was giving me an error, so I couldn’t turn it off (pause it). Lights just kept flashing. :rofl:


#16

LOL, been there, done that!

Don’t feel bad though. I think all of the pros have had at least one “runaway loop” get out of hand.
(I might even consider it an unplanned type of “initiation”, LOL)

I guess it is only fitting that I say, “Welcome to the family!”


#17

Very cool!!

I get hundreds of emails a day so I fear my lights will never turn off :weary: