Skip to header Skip to main navigation Skip to main content Skip to footer

Search form

Site branding

Home
What's up, home?

Main navigation

  • Home
  • Story mode
  • About
  • Features
  • Hardware list
  • Videos
  • GitHub (opens in new tab)
  • Daily AI generated stories (opens in new tab)

Part 125: Alert if IoT hub miscalculates if we are at home or not

Breadcrumbs

Breadcrumb

  • Home
  • Part 125: Alert if IoT hub miscalculates if we are at home or not

Main page content

By whatsuphome | 10:01 PM EEST, Tue July 22, 2025

TL;DR

I monitor Cozify's home and away scene status with Zabbix to catch cases where the IoT hub might switch to the wrong mode. A Python script polls the Cozify API and sends the scene data to Zabbix, where triggers alert on unexpected changes. This prevents
What's up, home? part 125 cover image

When leaving your home, the traditional background chatterbox in your head can be thinking things like "Did I lock the front door?", "Did I turn off the oven?" and so forth. 

With an IoT hub like Cozify, there's another one. For example, if my parents -- who are not very technological -- will come to our house to entertain and look after the puppy whilst we are somewhere away with my wife and our toddler, without Zabbix my head would think "Did I remember to switch Cozify to such mode that it won't change the Home scene status to Away scene?". 

(Caveat emptor, just to keep any Cozify users/developers reading this happy: with Cozify, this is a non-issue as with its alert rules, I can also make it to alert with Cozify notifications about any scene changes. This is just a demo of a potential monitoring target for Zabbix, and which I also use for statistical purposes.)

With Away scene, Cozify is in guard mode, simulating that we would be at home by turning some lights on and off for random periods of time when it's dark enough, and also would be alerting about door openings, movement, other stuff. I don't want to turn our house to haunted house and scare/wake up my parents with a wrong scene.

Zabbix to the rescue!

As monitoring our Cozify was how this whole blog started, home status is one of the first things I added to monitoring. How does it work? This is one of the parts I should completely rewrite and rethink, as my small experiment grew to this monster I have... anyway, Python I wrote back in 2022, just prints the scenes it can find from my Cozify:

#!/usr/bin/python3
from cozify import cloud,hub
import json
cloud.authenticate()
scenes = hub.scenes()
for id, scn in scenes.items():
   print('"Scene":"{0}", "isOn": {1},'.format(scn['name'], format(scn['isOn'])))

... producing a list (starting) like this

"Scene":"AWAY", "isOn": False,
"Scene":"HOME", "isOn": True,
"Scene":"Living room dim light 💡", "isOn": False,
"Scene":"Dining area dim lights 💡", "isOn": False,
"Scene":"Bedroom light 💡", "isOn": False,

My Zabbix ingests this by reading the file that gets produced once per minute with the usual Zabbix agent stuff, and then for this particular "Are we at home?" situation finds the home scene & uses item preprocessing to convert the boolean to decimal.

Boolean to decimal preprocessing

Time for some useful data

So, this then produces me some useful, or at least interesting data. Not to show any summer holiday statuses, here's an example from late May when we spent few days in a rental summer house and were not at home.

Now, if I travel back in time in the Problems view, I can then exactly see for how long we were away.

Alerting during special cases

The above alert trigger is extremely simple, alerting immediately if the home scene status changes to false:

In case someone else not technologically very savvy would be here in our house when we are not, I can then just raise the severity of this alert temporarily to notice me about any unexpected scene changes. This way, I don't need to let my inner chatterbox to bother me.

 

whatsuphome
zabbix
cozify
scenes
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
I monitor Cozify's home and away scene status with Zabbix to catch cases where the IoT hub might switch to the wrong mode. A Python script polls the Cozify API and sends the scene data to Zabbix, where triggers alert on unexpected changes. This prevents

Search

Who am I?

  • Janne Pikkarainen from Finland 🇫🇮
  • Began with computers in 1986 with C64
  • Doing IT for living since 1999
  • Principal Site Reliability Engineer at Forcepoint
  • A Zabbix Summit speaker every year since 2022
  • Walking, talking Zabbix commercial

Support my project

Buy me a coffee 

Footer menu

  • Contact

What's up, home? | Janne Pikkarainen | contact(at)whatsuphome.fi | 2022 - 2026

Developed and Designed by Janne Pikkarainen