Home Automation, part 6: Leaving and Arriving home routine via NodeRed

Sunday, February 28, 2021

selfhostinghome-automationnodereddomoticzraspberrypi

Context

Following my previous posts about my automation flows and my night and morning routines, in this post, I want to describe the two simple routines I have in place for when I leave my place or when I come back.

It is basically about managing devices and alarms when I leave or come back home.

The involved devices are:

  • A raspberry pi 0W with a fisheye camera pointing at the door entry running

motion;

Nota: More devices will be used for the next post explaining all alarms in place.

Routine description:

Leaving Routine

When leaving my apartment, the following scenario runs: - Wait 30s and: - Switch off lights and TV (if on); - Stop kodi media server and the multi room music system if playing; - Switch off the piscreen display. - Wait 5min and: - Start entry door camera (motion); - Set “Away” mode (for alarms); - Send “good by” notification.

The NodeRed flow looks like this:

Figure 1: NodeRed leaving flow

Figure 1: NodeRed leaving flow

I will describe in the next post the alarms themselves in place and how they work so I won’t say much here except that NodeRed will send via MQTT a message. A custom python script run on the raspberry pi 0W with motion listen to this specific topic. Depending on the message, the script will start/stop motion and the camera. Stay tuned for more details.

You can read the part 4 for details on managing the devices.

5min later, I will receive a message on Telegram if everything went well saying «Away mode activated! See you soon :)».

Starting the “leaving routine”

I used to have a Bluetooth beacon to detect if I was home or not but it died. Since then, I have a more manual process. When leaving the house, I have multiple options to start the “leaving home” scenario: - On the touch piscreen, I can start the “leaving home” scenario (see this post for a screenshot of the dashboard); - By clicking on my “exit button” near the entry door. Unfortunately, this is the only unreliable z-wave device I have so I don’t really use it as it doesn’t work most of the time1; - By clicking on the right button that my multi button remote control; - By sending a Telegram command (Allow me to enable it whenever I want).

Arriving Routine

When arriving home, the following is done: - Switching off the entry camera (stopping motion); - Switch on piscreen display; - Send me a welcome message on telegram (just to make sure that if anyone else know how to stop the alerts by saying I’m home, I still receive something on telegram); - Change house mode from “away” to “home”;

The NodeRed flow looks like this:

Figure 2: NodeRed home flow

Figure 2: NodeRed home flow

Again, on the next post I’ll talk about the different alerts mechanism in more details. But same as above, a message is sent via MQTT so that the motion service is stopped.

Starting the “arrived home routine”

As said above, I do not have Bluetooth detection anymore to see if I’m home or not. To start this scenario, I can: - Click on a specific button of the remote control; - Send a telegram message (eg: when in the elevator); - Wait for the alert and indicate I’m home (read below).

The 3rd option is the one I’m using the most because when I get back home without starting the home routine ahead (which I never do since I don’t do Bluetooth detection), it will starts an alert (because door has been opened while “away mode” activated, and because the entry door camera will detect motions).

Again, I will explain in details the alarm/alerts in place, but what you need to know here is that when the entry door is opened while in “away” mode, I will receive a message via telegram asking « Stop Alert », « Real Alert », « I am Home ».

More details later, but clicking on « I am Home » will simply start the “arriving home” scenario.

Figure 3: Telegram Door Alert

Figure 3: Telegram Door Alert

So when I arrive home, I usually use this.


  1. I use this Fiboro button. Unlike all other Fibaro devices that works flawlessly, this one just doesn’t work properly. And seeing other comments online, I’m not the only one. Too bad for a device that is supposed to by used as an emergency button… ↩︎


Contact

If you find any issue or have any question about this article, feel free to reach out to me via email, mastodon, matrix or even IRC, see the About Me page for details.

See Also

RCA of my homelab cluster downtime

Home Automation, part 5: Night and Morning routines with Nodered