Lesson 4 Node Red - Water-Monitor/IoT-Portfolio-FJS GitHub Wiki

We got an introduction about MQTT and started with NodeRed. We played around with making programs in NodeRed and setting up MQTT.

Step by step to get node red

  • Go in Linux Manjaro to the software manager
  • Click on the hamburger menu > preferences > third party > enable AUR
  • Go back and go to AUR, search for node-red and install it
  • In the terminal, execute 'node-red'
  • Get URL and open it in the browser

Let's start with node red

  • Open node red and click on the hamburger menu
  • Menu > manage palette > install > dashboard > 'node-red-dashboard'

Create a hello world in node red

  • Take a inject and a debug node
  • Double click on the inject node: give it a name and an input. Connect it with the debug node
  • Click on deploy
  • Click on debug
  • Click on the 'switch' of the inject node

You can also add loops with intervals and it is also possible to switch to a JSON-output.

Create a button in node-red

  • Add a 'dashboard' node to the flow
  • Click on the node, select the pencil symbol and select default, then deploy
  • Copy the URL and add a /ui at the end

The functions-nodes work only with javascript. The switch node is very similar to an if-statement.

Stijn

Since we all three worked in the same wifi netwerk on the same gateway, we also worked in the same node-red. Everytime when Johanna or Fadi published their Node-Red code I lost all of my code. After that happened 4 times I have watched and cooperated with Johanna and Fadi instead of trying it myself. After the lesson I tried to write it myself in Node-Red.