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)

Development news: Got Cozify write operations working

Breadcrumbs

Breadcrumb

  • Home
  • Development news: Got Cozify write operations working

Main page content

By whatsuphome | 7:13 AM EET, Mon January 09, 2023

TL;DR

I discovered that the unofficial Cozify Python library supports write operations, not just reads. Using a simple Python script with the cozify library, I can now turn devices like my office ceiling light on and off. I also added menu entries to Zabbix to

(I'll be posting this kind of short, almost tweet-like news to this blog, as here it feels natural and comfortable, on LinkedIn I would feel like a spammer)

I got Cozify write operations working! Some time around Christmas I realised that underneath the unofficial Cozify API Python library does support write operations after all, it's just that its documentation does not reflect that.

This morning I tried out if those do actually work, and yes, with a simple Python script I can for example turn devices on and off, I verified that with my home office ceiling light. :)

#!/usr/bin/python3
from cozify import cloud,hub
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--devicefromzabbix')
args = parser.parse_args()
cloud.authenticate()
devices = hub.devices()
hub.device_on(args.devicefromzabbix);

I also already created some menu entries to my Zabbix custom scripts. 

Screenshot from Zabbix Administration --> Scripts
Next, I'll finally need to split my IoT devices to their own hosts instead of everything being under Zabbix server as items, so controlling anything via Zabbix would be intuitive and anyway everything would be logical. And I need to make those Python scripts sensible, the one above is just a quick try if the functionality even is implemented and/or nowadays supported. 

 

whatsuphome
cozify
developmentnews
  • 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 discovered that the unofficial Cozify Python library supports write operations, not just reads. Using a simple Python script with the cozify library, I can now turn devices like my office ceiling light on and off. I also added menu entries to Zabbix to

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