Getting started with Node-RED

by Home assistant

So you installed Node-RED? Well done! Next step is to start with basic flows and build up your knowledge, it should not be too difficult.
If this is all new to you, Home Assistant is one of the most flexible and sophisticated open-source smart home platforms, and Node-RED is a visual programming tool making rule creation a walk in the park (ish).


Node-RED can be a bit intimidating at the beginning, but once you finish flows on this page everything will make sense. Before we start with two first flows, please have a look at a couple of tips below.

  • A basic concept of the flow is that it should start with something like inject, have logical operators between and finish with the outcome. The outcome for Home Assistant is usually an action.
  • You can test your flow using two very handy tools:
    • Debug – which allows you to see the message that leaves each of the elements in the flow
    • Inject – a basic trigger that will, for example, kick off your action if click on “inject” button
  • You can do basic commands in the window:
    • undo and redo (CTRL+ZCTRL+Y)
    • copy and paste. (CTRL+CCTRL+V)
    • delete (DEL)

Also, check our pick how you should spend first $250 on smart home, allowing you to create rules and experiment with the seven devices included.


The video shows you how to create your first flow and it should not be complicated.

  • First, we will create a flow that will use motion sensor as a trigger and if the state changes switch on the light
  • We will then put a switch node so depending on the state change, we will switch the light on or off (you see how it is already better than YAML?)
  • And then after, we will also put a check to see if the light is already on

That is it. Nothing complicated. If you managed to do the steps above, you will be able to create the majority of automations already.

To copy the flow in the video, please use the link below to copy the text to the clipboard and in Node-RED go to the menu, import > clipboard


TO CONTINUE with Node-RED, see other tutorials:

Can you help to improve this page?

Please let me know in comments if I can update something or if I got something incorrect. I am really hoping to make this page useful and keep it relevant.