Phoscon Zigbee Gateway: AKA – ConBee or RaspBee – Part 5: Better Node-Red Integration

Deconz-5

Welcome to the 5th part of a series on the Phoscon Zigbee Gateway. This section is a replacement for the 4th part and will focus on a much better Node-Red Integration. Relevant text from the previous article will be replicated.

  1. Introduction
  2. Installation
  3. Connecting Devices
  4. Old Node-Red Integration – Less Efficent MQTT/Websocket Method

What is Node-Red?

From the Node-Red home page:

“Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways.
It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its run-time in a single-click.”

New to Node-Red?

Getting started with Node-Red has been extensively covered. Check out this YouTube playlist featuring videos from Opto22 – https://youtu.be/3AR432bguOY

How does Node-Red connect to deCONZ?

The deCONZ software provides a pair of interfaces to interact with your Zigbee devices.

A WebSocket server sends push notifications for real-time feedback from things like motion sensors or switches.

A REST API: This allows third-party applications easy monitoring and control of a Zigbee network from local or remote operating clients. Most functions that can be done from the Phoscon WebApp can also be done through the API.

Why Node-Red Integration?

Normally if you have a single radio hub like an Echo Plus, IKEA TRÅDFRI gateway or Sengled Element hub. You can only provide interactions between the devices it talks to. But, by interconnecting the deCONZ hub with Node-Red you can set up interactions between pretty much anything Node-Red can talk to. For example, I have a TRÅDFRI 5 button switch setup to control some Connected by TCP 6loWPAN bulbs which are a very different protocol.

Trying Something New

Our previous articles have been very picture and text-heavy. As a result, this time we’re trying out the instructions as a YouTube video. Please let us know what was good or bad about the format, so we can do better next time.

A Quick Rundown Of The Steps Followed In The Video

  • We installed node-red-contrib-deconz using the Palette Manager
  • Next, we configured the connection to Deconz. To make things easier on yourself in advance have:
    • The IP address of your Deconz host.
    • A browser opened to the advanced setting page in Deconz.
  • You need to deploy the configured node before the device list will populate.
  • We used a debug node to discover what events our remote sent.
  • A Switch node was used to separate the different events.
  • One of those outputs was assigned to a device.

So What’s Next?

In the video we connected a Zigbee button to a Zigbee light. If that’s all your intending to do. You really don’t need Node-Red, all that can be done with-in the Phoscon interface.

But what if you have MQTT enabled devices. Or some blinds from Tuya-Smartlife. Wouldn’t it be great if your cheap Xiaomi buttons or sensors could be used to trigger actions on multiple devices simultaneously? Better yet, perform different actions depending on the time of day. This is where the power of Node-Red comes into play. By integrating node just like the one we used here you can infinitely extend your interoperability. Here are a couple of example flows I have in my own system.

This first flow checks the status of a pair of contact sensors attached to my fridge doors. Consequently, if a door is left open for more than 2 minutes then the Amazon Echo devices in my home play an audible announcement that alerts me. It will do this every 2 minutes until I close the door. Even more, what if I’ve left home with a door open. In that event after 5 minutes, I will get an alert through Telegram on my phone.

Node-red Zigbee to Telegram and Alexa

This second flow is the fully fleshed-out version of the button we used in the example. Remember how it had 4 event types? Well, all are in use here. The single-click turns the ceiling lights on or off with an MQTT command. The long-press toggles a Zigbee plug on and off. Additionally, the double click turns on plug 1 of a 4 plug power bar on the Tuya-Smartlife platform. Finally, the triple-click turns on the ceiling bulbs if they’re off and sets them to full brightness.

Conclusion

Hopefully, this gives you a few ideas of what you can achieve. By combining the Phoscon Zigbee Gateway with Node-Red. For more, check out the earlier articles in this series on how to set up and configure the gateway.

  1. Introduction
  2. Installation
  3. Connecting Devices

You may also like...