Location based automations, with Node-RED.

Location based automations are a great way for your house to respond to your presence. Set your thermostat, alarm, and lights depending on whether you are home or not.

I do this using trigger state nodes.

This nodes considers an entity’s current and previous state and passes on the message. We’re going to use it in it’s most basic form, which is very easy.

This can work with any entity that has more than one state, but we’re using it with my life360 device tracker right now. In this instance, if my device tracker goes from “not_home” to “home” pass the message from the top output. Anything else goes from the bottom output.

Let’s put together a basic location based flow.

We’re going to grab a trigger state node and two call service nodes. Remember that if everything is true, it routes the top output, if not, bottom output. So if I go from not_home to home, top output.

The two call service nodes I’m using in this example are to control my Ecobee thermostat, but you can use yours to do whatever you like. Lights, security system, garage door…any service that can be called. Here’s how one of those look:

And here’s how the entire flow looks:

Pretty simple, but very powerful if used properly. Here’s the code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s