This page provides steps to access your hub's Node-RED instance.

Accessing Node-RED

Your Jilia Hub comes preinstalled with Node-RED, and it can be accessed by navigating to http://{your-jilia-hub-ip}:1337/nodered.

By default, access to the Node-RED GUI is disabled. To enable it, send the the EnableGUIAccess action to your hub's NodeRedService. In the example below, a cURL command is used to enable access for 30 minutes.

curl -XPOST https://api.jilia.io/v1/servers/{server-id}/devices/{node-red-service-id}
  -d "action=EnableGUIAccess&durationMinutes=30"
  -H "Authorization: Bearer {token}"

Find your Jilia Hub's IP

You can get your Jilia Hub's IP from your router/DHCP server or by querying the Jilia Hub's hub-management-service and viewing its network property.
Jilia Quick Start is a great way to get started querying your Jilia Hub.

Creating Flows

Take a look at Node-RED's First Flow guide to learn the components of a flow.

Jilia Nodes

We created the Jilia node group to simplify working with Jilia devices connected to your hub. The two primary Jilia group nodes are Action and Monitor.

Action Node

A Jilia Action node is used to perform an action on a device using the Jilia API. The API response becomes the node output.

Its parameters are:

  • Name (optional): the node name to show on the Node-RED canvas.
  • Device (case-sensitive) the name or id of the device to perform an action on.
  • Action (case-sensitive) the action to perform on the selected device.
  • Action Arguments zero or many name/value pairs are allowed.
    • Name the name of the argument to send with the action.
    • Value the value of the argument to send with the action.

Monitor Node

A Jilia Monitor node is used to monitor a property of a Jilia device. It can be used to send the output of the device monitor to another node.

It only has two parameters:

  • Name (optional): the node name to show on the Node-RED canvas.
  • Topic String: the full path of the topic to monitor. It consists of {device-type}/{device-id}/{monitored-property}

NOTE: Unlike topic strings created to monitor events across all hubs, the Monitor node topic string does not use a {server-name} section.

In the below screenshot, our example flow uses a Jilia Monitor node to monitor the status property of the selected motion sensor. The Jilia Monitor node output port is wired to a switch node with two configured output. The top output port is triggered when the recieved data is Active. The bottom output port is triggered when the payload is Inactive.

Two change nodes are wired to the switch's output ports. The Active path sends an 'On' action to both the Master Bedroom Jilia Action node, and to the Master Bathroom Jilia Action node; effectively turning on the lights in both rooms when motion is detected. The Inactive path sends an 'Off' action to both of the Jilia Action nodes; turning off the lights when the motion sensor sends 'Inactive'.

Here's how we configured the switch node in the above example.

Here's how we configured the change node in the above example.

Jilia Node-RED Service

The Jilia Hub exposes an API for pushing previously exported nodes to your hub.

One Rule is One Tab

The hub's NodeRedService exposes three API actions:

  1. SetRule
  2. GetRule
  3. DeleteRule

A "rule" in this case corresponds to the flow "tabs" visible in the Node-RED GUI. To create a new rule, or overrite an existing one, call the SetRule action, passing the name of the rule and the JSON formatted string, exported using Node-RED's export tool.

Please note that subflows are not supported.