{"id":24436,"date":"2024-10-22T10:00:00","date_gmt":"2024-10-22T08:00:00","guid":{"rendered":"https:\/\/monraspberry.com\/?p=24436"},"modified":"2024-10-23T10:06:00","modified_gmt":"2024-10-23T08:06:00","slug":"installing-and-using-node-red-on-a-raspberry-pi","status":"publish","type":"post","link":"https:\/\/monraspberry.com\/en\/installer-et-utiliser-node-red-sur-un-raspberry-pi\/","title":{"rendered":"Installing and using Node-RED on Raspberry Pi"},"content":{"rendered":"<p><strong>Node-RED<\/strong> Node-RED is a low-code programming platform that lets you create automation and integrations through graphical workflows. Thanks to its intuitive drag-and-drop interface, Node-RED is particularly appreciated in the field of <strong>home automation<\/strong> for its simplicity and ease of integration with a wide range of protocols and services.<\/p>\n\n\n\n<p>In this tutorial, you'll learn how to install Node-RED on your Raspberry Pi and create automations for your home automation system or IoT projects.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why use Node-RED for home automation?<\/h3>\n\n\n\n<p>Node-RED connects <strong>peripherals<\/strong> such as sensors, home automation management systems, or web services by creating <strong>flows<\/strong> automation. For example, you can use Node-RED to :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Automate your home's lighting according to the brightness outside.<\/li>\n\n\n\n<li>Receive alerts on your phone when specific events occur.<\/li>\n\n\n\n<li>Control your devices with <strong>Home Assistant<\/strong>, <strong>Jeedom<\/strong>or <strong>Mosquitto MQTT<\/strong> for managing messages between different IoT devices.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Installing Node-RED on Raspberry Pi<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Preparing your Raspberry Pi<\/strong> :\n<ul class=\"wp-block-list\">\n<li>Make sure that <strong>Raspberry Pi OS<\/strong> is installed on your Raspberry Pi. If this is not the case, follow this tutorial to install <strong>Raspberry Pi OS Lite<\/strong> with <strong>Raspberry Pi Imager<\/strong>.<\/li>\n\n\n\n<li>Connect to the Raspberry Pi via <strong>SSH<\/strong> with this command:\n<ul class=\"wp-block-list\">\n<li><code>ssh pi@&lt;IP_de_votre_Raspberry_Pi><\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Install Node-RED<\/strong> Node-RED can be easily installed with a script available on GitHub. Run this command in your SSH terminal:\n<ul class=\"wp-block-list\">\n<li>Copy code : <code>bash &lt;(curl -sL https:\/\/raw.githubusercontent.com\/node-red\/linux-installers\/master\/deb\/update-nodejs-and-nodered) <\/code><\/li>\n\n\n\n<li>Validate questions with <code>y<\/code> to authorize the installation of dependencies.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Start Node-RED<\/strong> Once installation is complete, launch Node-RED with :\n<ul class=\"wp-block-list\">\n<li>Copy the code : <code>node-red-start <\/code><\/li>\n\n\n\n<li>Node-RED is now active. You can access the interface via a browser by entering the following address:\n<ul class=\"wp-block-list\">\n<li><code>http:\/\/&lt;IP_de_votre_Raspberry_Pi>:1880<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Automate Node-RED startup<\/strong> To have Node-RED start automatically each time the Raspberry Pi is booted, activate the service with this command:\n<ul class=\"wp-block-list\">\n<li><code>sudo systemctl enable nodered.service<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Create automations with Node-RED<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Example 1: Controlling lights with MQTT<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Install an MQTT broker such as <strong>Mosquitto<\/strong> on your Raspberry Pi.<\/li>\n\n\n\n<li>Use <strong>MQTT nodes<\/strong> in Node-RED to publish and subscribe to MQTT messages, enabling you to send commands to your connected lights.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Example 2: Notification of movement via Telegram<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Add a <strong>motion sensor<\/strong> compatible with your home automation system.<\/li>\n\n\n\n<li>Use <strong>input nodes<\/strong> to trigger a notification when the sensor detects movement.<\/li>\n\n\n\n<li>Add a node <strong>Telegram<\/strong> to send a message to your phone.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">Example 3: Integration with Home Assistant<\/h4>\n\n\n\n<p>Node-RED integrates directly with <strong>Home Assistant<\/strong>. You can use it to automate complex tasks such as blind control, temperature management or lighting scenarios. Simply install the Node-RED add-on from the Home Assistant interface.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p><strong>Node-RED<\/strong> is a powerful and flexible tool for home automation and IoT projects. Whether you're a beginner or an expert, you can quickly create complex workflows without writing code. With integrations for <strong>MQTT<\/strong>, <strong>Home Assistant<\/strong>and other services, Node-RED is the ideal platform for managing your connected systems.<\/p>","protected":false},"excerpt":{"rendered":"<p>Installez Node-RED sur Raspberry Pi et automatisez votre maison avec MQTT, Home Assistant et plus encore.<\/p>","protected":false},"author":1,"featured_media":24437,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[308],"tags":[],"class_list":["post-24436","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutos"],"featured_image_src":{"landsacpe":["https:\/\/monraspberry.com\/wp-content\/uploads\/2024\/10\/Node-RED-Raspberry-Pi.png",779,445,false],"list":["https:\/\/monraspberry.com\/wp-content\/uploads\/2024\/10\/Node-RED-Raspberry-Pi.png",463,265,false],"medium":["https:\/\/monraspberry.com\/wp-content\/uploads\/2024\/10\/Node-RED-Raspberry-Pi-300x171.png",300,171,true],"full":["https:\/\/monraspberry.com\/wp-content\/uploads\/2024\/10\/Node-RED-Raspberry-Pi.png",1792,1024,false]},"jetpack_featured_media_url":"https:\/\/monraspberry.com\/wp-content\/uploads\/2024\/10\/Node-RED-Raspberry-Pi.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/posts\/24436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/comments?post=24436"}],"version-history":[{"count":0,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/posts\/24436\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/media\/24437"}],"wp:attachment":[{"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/media?parent=24436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/categories?post=24436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monraspberry.com\/en\/wp-json\/wp\/v2\/tags?post=24436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}