In the first tab, I have prepared an example flow for you to turn on or off lighting in the dollhouse. Click alternately on the two buttons for a test. Report to the course instructor if the light does not turn on in the dollhouse:
Node-Red is based on the object-oriented programming language JavaScript. Therefore, the messages exchanged between the nodes are JavaScript objects. The message flow is from left to right.
The objects that are forwarded over the connections, for example, have the following properties:
var msg = {payload: "Some data", topic: "Topic of the message", _msgid: "99dbeb61.db6b28"};
The properties mean the following:
Properties of the msg object | |
payload | stores the payload of a message to be transmitted and can take any conceivable form and complexity |
topic | stores the overarching topic of a message, so that filtering / classification is possible at the receiver |
_msgid | contains an internal ID for identifying the message |
To see during development what messages are exchanged between the nodes, the green debug nodes can be used.
Assignment (numbers correspond to the screenshot below):
Here are some remarks on this exercise:
Take a look at the configuration of all nodes by double-clicking:
Now click on the “Objekte” tab.
Complete and examine the flow in the following steps:
string
. Next to msg.topic, enter Name. Pay attention to capitalization.