I am in the habit of going on cooking sprees while listening to music… loudly. I only share one wall with a neighbor here in the loft, and that neighbor is very tolerant. On a Sunday afternoon, with multiple dishes going at a time, my most used smart home feature is “Alexa, set a meatball timer for 25 minutes”. Having Alexa keep track of all my timers is really helpful when my hands are full. The problem is that I rarely hear the timer, and have burned a few things not paying attention.

Using IFTTT, Node-Red, and Home Assistant I can blink the lights in the room when the Alexa timer goes off – even if I wander off to a different room.

First, some tunes

Let’s say you were attempting to make meatballs, a sauce, some pasta, and roast some carrots all while taking notes on a blog post and blasting the above Fugazi album. You might not hear your timer go off. And especially if you are me, you might wander off to do something else for a minute and forget about the timer entirely.

THE SOLUTION

I want the lights to blink 3 times, in whatever room I am in, every time an Alexa timer goes off.

Home Assistant controls the lights and keeps track of what room I was last in (using my useful Motion Last Seen sensor).

Alexa Timers can be used as an IFTTT trigger.

Node-Red can bridge the two, accepting a web request from IFTTT and then telling Home Assistant which lights to blink.





NODE-RED

First, I’m going to make a flow that will blink the lights in the closest room. If no lights are on, it looks to see if I’m watching a movie and pauses that instead.

If the lights are on, check the Motion Last Seen sensor. A function evaluates that output, and passes along which light to blink as a data override. The looptimer toggles the light so that it blinks 3 times. The JSON for this flow is available here. The function node for choosing the light looks like this:

newmsg = {} entity_id = ""; if (msg.payload == "Office Motion") { entity_id = "light.office_pendant" } else if (msg.payload == "Bathroom Motion") { entity_id = "switch.bathroom_light" } else if (msg.payload == "Kitchen Motion" || msg.payload == "Dining Motion") { entity_id = "switch.edison_pendants" } else if (msg.payload == "Living Room Motion") { entity_id = "light.middle_pendant" } else if (msg.payload == "Closet Motion") { entity_id = "light.closet" } else { newmsg = "NONE" return newmsg; } newmsg.payload = { data: {'entity_id': entity_id } } return newmsg;

Once this is working as expected, select the flow and click the hamburger menu and select “Subflows -> Create Subflow”.

This will package the flow as our own custom node that can be dropped in anywhere easily. Now, if I need to add a room or change which light blinks I can just edit the one subflow instead of multiple function nodes in multiple places.

Now let’s create a very simple flow that takes a web request from IFTTT, and triggers our new subflow.

In the http endpoint node, we give it a name and a request type:

IFTTT

Make a new applet, using the Alexa Timer as the trigger. Then we want IFTTT to make a web request to Node-Red. For the URL, use the endpoint we created above.

Save the applet and test it out, if everything triggers successfully the lights will now blink in whatever room you find yourself in when the timer concludes.