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 1: Marrying Zabbix and Cozify IoT hub

Breadcrumbs

Breadcrumb

  • Home
  • Part 1: Marrying Zabbix and Cozify IoT hub

Main page content

By whatsuphome | 9:37 AM EET, Fri March 18, 2022

TL;DR

I connect my Cozify smart home hub to Zabbix using an unofficial Python library that reads sensor data via the Cozify API. This lets me monitor temperatures, motion events, and device statuses directly in Zabbix and Grafana. Cozify handles the IoT device
This is how it always starts

For those of you who know me, this should not come as a surprise: I absolutely love Zabbix. It gives me the ultimate freedom to monitor whatever I need to monitor and is flexible enough to be able to monitor absolutely everything you can imagine. It's free, it's open source, and scales to whatever needs you might have.

What does a monitoring nerd who is a technical lead for monitoring in a global cyber security company do during his downtime? That's a silly question, mind you. Of course he monitors his home with a home Zabbix instance.

No alt text provided for this image

 

Hello, Cozify

We have had Cozify home automation system in our household since 2017. It is a nice central hub which supports IoT devices from plethora of vendors and vast selection of device categories, ranging from Philips Hue lights to motion sensors to cameras to fire alarm systems. You can then configure actions on some other device based on actions on one device: for example, turn on a light if a motion sensor detects movement.

Cozify is a very capable device, but where it definitely lacks is monitoring and analytics about what's going on underneath.

As a monitoring addict, that is something I simply cannot stand.

Let's build a bridge between Cozify and Zabbix

Someone has built an unofficial Python library for communicating with Cozify API. The library is a bit limited in functionality, most limiting factor being that it only supports read-only operations. However, for my monitoring purposes, that does not matter, as I anyway need to read data.

For my initial testing purposes, I wrote couple of small Python scripts to gather temperature and humidity data from our temperature sensors, and one script to monitor the general availability of the different IoT devices we have around. The scripts are run from cron every five minutes, and the results are written to text files which Zabbix reads. Zabbix has master items for temperature, humidity and reachability files, and using the dependent items, it can populate the data for all the 40+ data points I have now using just three polls.

No alt text provided for this image

Benefits of such project

Other than cool geek factor, what's the benefit of monitoring your home IoT hub? There's plenty!

 

  • I get to learn all kinds of patterns about our home status: temperatures, reliability of individual devices, amount of time any device has been on/off ....
  • I get notified immediately if a critical device such as smoke alarm does not function properly
  • I get notified if battery level on any battery operated IoT device is getting low and can react before a device dies
  • I can follow how quickly battery is draining on some device

 

Still for me to do

The current implementation is way too manual. It would be possible to utilise Zabbix low-level discovery to parse the JSON received from Cozify, but if I just dump everything from it, it contains all the possible device categories with different parameters: Philips Hue lights do report everything from their current brightness/color settings to if their firmware has been upgraded, and then the temperature or motion sensors do report back completely different set of data. That makes creating the monitored items automatically in a sane way a bit difficult.

So, I need to think a bit and figure out how to make my Cozify template more automatic.

I also need to setup a home Grafana instance speaking to Zabbix. Zabbix is excellent at collecting the monitoring data and sending out alerts, but Grafana is the perfect partner for Zabbix to do all the analytics and eye candy.

Proceed to part 2 of this blog series

I have been working at Forcepoint since February 2014 and never get tired of monitoring.

whatsuphome
zabbix
grafana
cozify
iot
part1
  • 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 connect my Cozify smart home hub to Zabbix using an unofficial Python library that reads sensor data via the Cozify API. This lets me monitor temperatures, motion events, and device statuses directly in Zabbix and Grafana. Cozify handles the IoT device

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