Zigbee Shed Security

This project extends my exploration of Zigbee, MQTT, Grafana, RESTful APIs, and NodeRED by integrating them to enhance the security of my shed. While sheds typically don’t require high-level security, mine is frequently accessed by the kids for balls, rackets, and other outdoor items. Unfortunately, they often forget to close the doors, leaving the shed vulnerable to prying eyes.

The primary goal of this project is to ensure I receive timely alerts whenever either shed door opens, but at the same time, I don't get alert spam.

Hardware Setup

I leveraged the existing Zigbee network I had installed in my home for energy monitoring. I added two ThirdREALITY door sensors to the network, seamlessly integrating them by simply allowing network access and powering them up.

Data Collection and Visualization

To monitor the door states, I continued to use Grafana as the visualization tool. This required updating the Influx Telegraf collection platform to connect to my local MQTT broker as a new client, parsing messages from the two door sensors. The sensors use a JSON payload with a contact key, indicating whether the sensor is closed (contact == true) or open (contact == false). Although Influx can store strings, I found it more useful to store these states as numbers: 1 for true (closed) and 0 for false (open). This required some transposing of data as part of the Telegraf collector.

       [[processors.enum]]
          [[processors.enum.mapping]]
          field = "contact"
          [processors.enum.mapping.value_mappings]
              false = 0
              true = 1

This resulted in the following visualizations:

Grafana showing door state over time

Grafana showing door state over time

In addition to door status, I also tracked other useful metrics, such as signal strength, battery percentage, and a battery_low key — perfect for triggering alerts when the battery level drops.

Alert System

With the door history logged, I moved on to setting up an alert system using NodeRED and Pushover for ease of customization. The key objective was to receive alerts only when necessary, avoiding constant notifications for every door movement. I configured NodeRED to monitor the time of day in my area, allowing me to set up the following alerts:

  • An alert if either shed door is opened after dark.
  • An alert if either shed door is still open at 10 PM.
  • An alert if either shed door remains open for more than 30 minutes.

Next steps include integrating the state of my Nest Camera system. When the camera system is set to “away,” the alert configuration will automatically change to notify me instantly of any shed door activity.

This project has been both enjoyable and practical, sparing me from nightly trips outside to check if the shed doors are closed. Plus, it’s given me a bit of an edge during hide and seek with the kids —

“Hey Dad, how did you know we were in the shed?”.