Development news: Got Cozify write operations working

(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. 

 

Add new comment

Restricted HTML

  • 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.
Buy me a coffee

Like these posts? Support the project and Buy me a coffee