Help

Set up Node-RED Nodes

Installation

First, install Remote-RED in Node-RED. Use “Manage Palette” within the Node-RED Editor and install the package

node-red-contrib-remote

Access-Node

The access node allows you to access a website locally or remotely from the app. Usually this is your dashboard or a page of the UI Builder.

Create a node of type “remote access” for each page you want to access. Besides the name, this node contains only one config node. The configuration is outsourced to the config node, as these settings are also used for other functions like push notifications.

Config-Node

For each Access Node you create a corresponding Config Node. In this Config Node you define with which host, port and URL the connection will be established. The default values shows the dashboard as an example. It is also possible to configure other pages from the local network, as long as the Node-RED server can access them.

  • Name: With this title the page will be displayed later in the app.
  • Serving Host: The local IP of the host whose website is to be shared. “localhost” uses the Node-RED server on which the Access Node is running.
  • Protocol: The protocol used by the web server. For Node-RED this is normally http, but can be changed to https via the settings.js.
  • Serving Port: The port that will be forwarded. For Node-RED this is usually 1880, for other websites usually 80.
  • Base URL: The initial page to be called.

You can only edit the “Server location” once. Here you can specify in which corner of the world the server is located, which will be used for routing your website. For a fast connection choose the location that is closest to you.

Once you have defined these settings and installed the iOS or Android app, you can connect to an app by clicking the “Connect Remote-RED App” button. More about this in the connect app section.

Notification-Node

With this node you can send a push notification to the devices connected to the selected config node. Select a config node that you already use in an access node. You can use the same config node in several notification nodes.

Configure the title and the text of the notification. The default values assume that the payload of the incoming notification contains the strings “title” and “body”. You can also enter fixed texts or use flow or global variables.

Whenever a message arrives at the notification node, a notification is sent to your devices.

Question-Node

With this node you can send a question through a push notification to the devices connected to the selected config node. Select a config node that you already use in an access node. You can use the same config node in several question nodes.

It is important that the confg node points to your local Node-RED computer and that an access node is active with it. The base URL is irrelevant.

Configure the title and the text of the notification. The default values assume that the payload of the incoming message contains the strings “title” and “body”. You can also enter fixed texts or use flow or global variables.

You can specify up to three answers. The text of the answers can be entered directly as an string or taken from the incoming message. If the text is empty, the answer is not displayed. You can use the value to specify what the node outputs in msg.payload when you select this answer.

Whenever a message arrives at the question node, a notification is sent to your devices.

Install and connect app

Install app

You can install the apps from the Apple AppStore or the Google PlayStore. The app will ask you for the permission to send you push notifications after the first start. Allow this if you want to use the notification function.

Instances

Within the app, the term Node-RED instances are used. An instance is the connection to a config node of Node-RED. Within the app you can add multiple instances, i.e. local pages.

As long as the app is not connected to at least one config node, you can’t do much with it.

Connect app

When you connect an app it transfers certificates to access to your local site. The configuration is transferred as well. For subsequent changes to these fields, the instance in the app must be deleted and reconnected.

Open in Node-RED the config node you want to connect. Press the button “Connect Remote-RED App”. The config node now connects to one of the Remote-RED servers and shortly after that it displays a QR Code.

Within the app use the function “Connect Node-RED Instance” and scan the QR Code. The app should now be connected. To connect other apps (e.g. on another mobile phone), press the button again and generate another QR Code.

It is very important that you leave the config node with “Add” or “Update” and then save the changes with “Deploy”.

Advanced functions

Geofencing

Using geofencing it is possible to inform Node-RED when you leave or enter defined areas. To do this, open the options within the Remote-RED app and go to “Manage geofences”. A list of existing geofences may be displayed, which you can edit here. Use “Add geofence” to create a new one.

The name of the geofence will be output later in Node-RED. A geofence in Remote-RED is a circle around a coordinate, whose radius can be configured. To set the coordinate, tap on the map. Entering and leaving the geofence is then sent to the selected instance.

Within Node-RED the Remote-RED Access-Node has a corresponding “geofence output” which is used to output the changes.

Attention for Android: Another app like Maps has to actively update the location to trigger a geofence.

iOS Shortcuts

Using a shortcut, Node-RED actions can be executed directly from the iOS homescreen or via Siri voice command. To do this, you have to create the corresponding shortcuts in the Apple app “Shortcuts”. Select Remote-RED for an action under “Apps”. Then select “Execute action”. The first two fields (action and value) are simply passed as strings to the selected Node-RED instance and can be evaluated there, e.g. via a Switch Node.

Within Node-RED the Remote-RED Access-Node has a corresponding “action output” which is used to output the actions.

Example: I create two shortcuts to switch a light via MQTT. For this, I specify the action “LIGHT” and the value “ON” for the shortcut “Light on”. For the second shortcut named “Light off” I use the action “LIGHT” and the value “OFF”. In Node-RED there is a Switch Node behind the “action output”, which evaluates the JSON parameter “action” and passes everything to “LIGHT” to a Function Node. This changes the payload of the message so that only the JSON parameter “value” (ON/OFF) is contained as payload and passes it to the corresponding MQTT out.

As an additional function you can query Node-RED variables via “Determine Context” and use them within your shortcuts.

Android Widget

An Android widget offers similar functions as the iOS shortcuts. One or more widgets can be added to the home screen. You can determine the size of the widget yourself. You can access the configuration of the widget via the small gear wheel at the bottom right.

Add one or more actions to the widget. By tapping an action you open the edit dialog. Give the action a name that will be displayed in the widget. The two fields Action and Value are simply passed as strings to the selected Node-RED instance and can be evaluated there e.g. via a Switch Node. An example can be found in the section “iOS shortcuts” above. Select the instance to which the action will be sent. With Style you can add some color and with “New Row…” you can define how many actions are displayed next to each other in the widget.

Troubleshooting

Network Error inside Node-RED

The computer on which the Remote-RED Access-Node is installed within Node-RED needs internet access of course. If you get a ‘Network Error’ when connecting an app, your Node-RED machine most likely can’t reach my servers. If you use a firewall, the following paths must be allowed:

Server location ‘America (USA)’:

  • Outgoing port 443 to contact-us.remote-red.com / 5.161.113.250 / 2a01:4ff:f0:c185::1 for adding new instances
  • Outgoing port 443 to api-nodered03.remote-red.com / 5.161.113.250 / 2a01:4ff:f0:c185::1 for API communication
  • Outgoing port 22 to proxy-nodered03.remote-red.com / 5.161.113.250 / 2a01:4ff:f0:c185::1 for the SSH tunnel

Server location ‘Europe (Germany)’:

  • Outgoing port 443 to contact-de.remote-red.com / 49.13.208.138 & 49.12.191.168 / 2a01:4f8:c012:caae::1 & 2a01:4f8:c013:5d65::1 for adding new instances
  • Outgoing port 443 to api-nodered02.remote-red.com / 49.13.208.138 / 2a01:4f8:c012:caae::1 for API communication
  • Outgoing port 443 to api-nodered04.remote-red.com / 49.12.191.168 / 2a01:4f8:c013:5d65::1 for API communication
  • Outgoing port 22 to proxy-nodered02.remote-red.com / 49.13.208.138 / 2a01:4f8:c012:caae::1 for the SSH tunnel
  • Outgoing port 22 to proxy-nodered04.remote-red.com / 49.12.191.168 / 2a01:4f8:c013:5d65::1 for the SSH tunnel

Server location ‘Asia (Singapur)’:

  • Outgoing port 443 to contact-sg.remote-red.com / 194.233.74.204 / 2407:3640:3009:6554::1 for adding new instances
  • Outgoing port 443 to api-nodered05.remote-red.com / 194.233.74.204 / 2407:3640:3009:6554::1 for API communication
  • Outgoing port 22 to proxy-nodered05.remote-red.com / 194.233.74.204 / 2407:3640:3009:6554::1 for the SSH tunnel

DNS
To resolve the hostnames of my servers, DNS is needed. If your firewall restricts outgoing traffic, you need to open almost all outgoing ports (53, 853 and all higher than 1023) to your DNS server.