Using MQTT-Node-Red to communicate with LumenCache

Discussions about how to control LumenCache with smart phones, tablets, and control systems like Savant, Crestron, RTI, Elan g, AMX, Universal Remote (URC), Bitwise Controls, etc. The LumenCache ImPuck and the iPhone/Android app is also discussed here. Protocol specifics are typically discussed in the private dealer forums.
Post Reply
Posts: 3
Joined: Mon Oct 19, 2020 3:58 pm

Using MQTT-Node-Red to communicate with LumenCache

Post by klf »

After investigating various home automation (HA) software platforms, I decided I wanted to provide a message based interface to the Lumencache serial interface for my project. This would allow me to take my time deciding on the HA platform and give me some flexibility in evaluating and switching platforms as needed as the technology evolves.

In the IOT space, MQTT appears to be an accepted messaging standard. I've defined MQTT topics for each of the Lumencache serial commands and additional topics for the serial responses. MQTT messages consist of topics and payloads. These messages can be published and subscribed to. For example:

Turn on light zone controlled by switchpuck id 45
MQTT topic: LC/command/set-level/45 payload: 128 (range: 0-255)
MQTT reply topic: LC/reply/dim/45 payload: 50
MQTT reply topic: LC/reply/level/45 payload: ON

Note: UI Dimmer items subscribe to the LC/reply/dim/+ messsages, while the UI ON/OFF Switch items subscribe to LC/reply/level/+ messages. Unsolicited LumenCache replies are also captured from the hardware switches and are published as MQTT reply messages.

Configure the restore level of the light zone controlled by switchpuck id 45
topic: LC/command/set-restore-level/45 payload: 1 (range: 0-255)
MQTT reply topic: LC/config/45 payload: {45,5,1,2,35,220,1,0,1,0}

Note: For the LC/config/+ messages the payload is set to the actual LumenCache reply string.

I've implemented a gateway prototype using Node-Red and Eclipse Mosquitto. A Node-Red flow subscribes to MQTT messages sent by the HA client processes. The flow also publishes MQTT messages to be subscribed to by the HA clients. I'm currently using openHAB2 as the control system.

Screenshot of openHAB BASIC UI Android app.

Here is the Node-Red flow diagram and flow JSON file.

MQTT-LumenCache Serial Gateway

Node-Red Flow JSON file: ... teway.json

Node-Red Flow Description

There are two communication processes in the flow. The first, processes incoming requests from control system. The second, processes incoming serial port replies from LumenCache.

Process Incoming Requests from Control System

"LC/command/+/#: mqtt in node"
Connects to a MQTT broker and subscribes to LumenCache Command messages from the control system.

"transform command: function node"
A function block to transform the received MQTT topic and payload into LumenCache serial protocol format.
It returns a message object containing the LumenCache command.

"delay 200ms: delay node"
Delays each message passing through the node to control the delivery rate on the serial port.

"serial out node"
Provides a connection to an outbound serial port. Only the LumenCache serial command is sent.

Process Incoming Serial Port Replies from LumenCache

"serial in node"
Reads Lumencache reply data from a serial port.

"transform command: function node"
A function block to transform the received LumenCache reply payload into an MQTT reply or config topic
along with a payload containing the status based on the incoming payoad.
It returns a message(s) containing the MQTT replies.

"switch mqtt: mqtt out node"
Connects to a MQTT broker and publishes messages for use by the control system to update switch and dimmer status values.

Here is a document containing descriptions of the MQTT messages. ... ateway.txt
Ken Fickas

Post Reply