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
klf
Posts: 6
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
set-level:
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
set-restore-level:
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.

Image
Screenshot of openHAB BASIC UI Android app.

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

Image
MQTT-LumenCache Serial Gateway

Node-Red Flow JSON file:
https://anaturalpathtowellness.com/wp-c ... 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.

https://anaturalpathtowellness.com/wp-c ... ateway.txt
Last edited by klf on Tue Mar 07, 2023 2:34 pm, edited 1 time in total.
Ken Fickas

klf
Posts: 6
Joined: Mon Oct 19, 2020 3:58 pm

Re: Using MQTT-Node-Red to communicate with LumenCache

Post by klf »

Attached are Node-Red Flow JSONs and an MQTT messages document updated to the
01020110.0 LumenCache LibRE Control Protocol (2021-01-15).pdf spec.
download/file.php?id=128&sid=fb4113533d ... 1ee4e6a3e8

https://anaturalpathtowellness.com/wp-c ... otype.json

https://anaturalpathtowellness.com/wp-c ... -01-15.txt

A basic Node Red dashboard has been implemented for LumenCache provisioning.

Image

Image

Image

Image

Image

Image

Image

Image
Last edited by klf on Tue Mar 07, 2023 2:47 pm, edited 1 time in total.
Ken Fickas

User avatar
dc
Posts: 172
Joined: Thu Dec 20, 2012 4:23 am
Contact:

Re: Using MQTT-Node-Red to communicate with LumenCache

Post by dc »

Ken, this is awesome! Seems the UI just needs a little tweaking to get the button management settings and scenes manageable.

Note: we're selling a version of the EGW1 as a DIY model without any locked software. It may include the basic communication bus management and API so the heavy protocol activities are handled.

Guillermo did an amazing job tightening up the messaging sections and auto-discovery and ID assignment and management so that part is automated. Seems we can bring these pieces together soon.

User avatar
dc
Posts: 172
Joined: Thu Dec 20, 2012 4:23 am
Contact:

Re: Using MQTT-Node-Red to communicate with LumenCache

Post by dc »

Seems popular combination. Just add LC.

https://youtu.be/hBEb_FCLRU8

Post Reply