Setting up Node-RED to send MQTT Data to FacilityBot

Node-RED is a programming tool for wiring together IOT devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows.

Node-RED can act as a powerful intermediate platform that allows IOT devices and sensors of all kinds to be integrated with FacilityBot’s MQTT broker. Node-RED accepts MQTT, Http, Websocket, TCP and UDP inputs. Functions can be applied to the data injected and formatted to be sent to FacilityBot’s MQTT broker.

Setting up Node-RED

Guidance for Node-RED setup can be found here

Setting up a Node-RED Flow

Set up the “MQTT Out” node with the FacilityBot MQTT broker information found within FacilityBot. In the Connection tab, do not select TLS and use MQTT V3.1 protocol. In the Security tab, enter the MQTT broker Username and Password found within FacilityBot.

Node-RED allows data to be injected from many protocols and many functions to be applied to the data. Node-RED’s tutorials describe the possibilities.

FacilityBot requires MQTT data in the simple format

Topic: A unique token value provided by FacilityBot

Payload: A simple score in a simple JSON format. E.g. {score: 1}

Therefore, a simple Node-RED flow can be set up as below. In this case, the score 4.5 will be received by FacilityBot and FacilityBot can trigger a Request and alert a Responder for follow up.