Shelly QuickApps for Zooz Z-Box - first release up on GitHub
I really like the Z-Box
I want to start by saying I’m genuinely impressed with the Z-Box. Most people think of it as a Z-Wave hub and leave it at that, and honestly that’s fair - it’s excellent at Z-Wave. But there’s a lot more under the hood. It runs a full Lua environment and supports QuickApps, which means you can extend it well beyond Z-Wave to integrate just about anything that speaks HTTP on your local network. I’ve been wanting to push on that capability for a while, and Shelly devices felt like the right place to start since so many of us have them sitting alongside our Z-Wave gear.
One other thing worth mentioning - the Z-Box is built on the same QuickApp platform as the Fibaro HC3. If you’re running an HC3 (or the Yubii Home), there’s a reasonable chance these QuickApps will work there too. I haven’t done extensive testing on those platforms so I can’t promise it, but the architecture is shared and others have published QuickApps that target all three. Worth trying if you have one.
Anyway, on to what I built.
I wanted local control of IP based Shelly devices, like my Shelly EM’s for power monitoring, etc. And, honestly, when testing things on the test bench the Wifi/IP devices typically have far more features and flexibility than their Wave (z-wave) counterparts. (If you haven’t checked out what those Shelly devices can do - you need to - they are impressive: local scripting, RPC calls, actions, scheduling… all local to the device. But I digress.
This QuickApp integration is direct to the Shelly device, not the Shelly cloud. The Shelly API is actually pretty nice to work with once you get past the Gen1/Gen2+ auth differences (Gen1 uses Basic Auth, Gen2 and later switched to Digest with SHA-256, which meant writing a pure Lua SHA-256 implementation since the Z-Box doesn’t give you much to work with on that front).
Five QuickApps, supporting a variety of devices
- Shelly EM Gen1 - dual-channel energy monitoring
- Shelly EM Gen3 - dual-channel energy monitoring (with auto-detection of EM1 vs PM1 RPC component across firmware versions)
- Shelly PM Mini Gen3 - single-channel power monitoring
- Shelly i4 / i4 DC - 4-input button device. This one works differently - it deploys a small JavaScript bridge script directly onto the Shelly at startup, which then fires events back to the QuickApp in real time rather than polling
- Shelly Gen3/Gen4 Switch & Plug - on/off control with optional power meter and illuminance child devices
Downloading / Installing
The project is up on GitHub. I’ve included .fqa files for easy installing on the Z-Box, as well as the .lua source code for those that want to dig in. Here’s the link:
Configuring
These QuickApps are configured via the Variables tab in each QuickApp. The variables control everything from the Shelly’s IP address and credentials, to poll interval, to which child devices get created. No code editing required - just fill in the variables and save.
Full configuration documentation is on the GitHub as well
A few QuickApps have additional variables specific to their device type.
The i4 QuickApp automatically sets up an action in the i4 to call back to the Z-box on presses so there is no delay in reaction time. Therefore it will need credentials to your Z-Box so it can receive button events. (I suggest creating a dedicated account.)
One caveats: I’ve only built this for HTTP at the moment, so if you have SSL certs on your Shellys that will likely fail. But this is the initial beta release.
So, if you are a Z-Box owner and want to give this a try, let me know your thoughts here or on the Issues in Github.