{"id":22039497,"url":"https://github.com/mpolinowski/nodered-getting-started","last_synced_at":"2025-03-23T13:14:55.124Z","repository":{"id":111483990,"uuid":"145404380","full_name":"mpolinowski/nodered-getting-started","owner":"mpolinowski","description":"An Overview of Node-RED Developement under Windows 10","archived":false,"fork":false,"pushed_at":"2018-08-20T10:44:31.000Z","size":1145,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T19:17:42.396Z","etag":null,"topics":["getting-started","node-red","node-red-flow","windows-10"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mpolinowski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-20T10:44:21.000Z","updated_at":"2024-03-18T06:48:44.000Z","dependencies_parsed_at":"2023-05-09T17:16:34.562Z","dependency_job_id":null,"html_url":"https://github.com/mpolinowski/nodered-getting-started","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolinowski%2Fnodered-getting-started","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolinowski%2Fnodered-getting-started/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolinowski%2Fnodered-getting-started/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpolinowski%2Fnodered-getting-started/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpolinowski","download_url":"https://codeload.github.com/mpolinowski/nodered-getting-started/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245104529,"owners_count":20561380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["getting-started","node-red","node-red-flow","windows-10"],"created_at":"2024-11-30T11:11:00.577Z","updated_at":"2025-03-23T13:14:55.079Z","avatar_url":"https://github.com/mpolinowski.png","language":null,"readme":"# Getting Started with Node-RED (Windows 10 Edition)\n\nThis guide will help you get Node-RED installed and running in just a few minutes.\n\n\u003c!-- TOC --\u003e\n\n- [Getting Started with Node-RED (Windows 10 Edition)](#getting-started-with-node-red-windows-10-edition)\n  - [Installation](#installation)\n  - [Adding Nodes](#adding-nodes)\n  - [Creating a flow](#creating-a-flow)\n    - [Add an Inject node](#add-an-inject-node)\n    - [Add a Debug node](#add-a-debug-node)\n    - [Wire the two together](#wire-the-two-together)\n    - [Deploy](#deploy)\n    - [Add a Function node](#add-a-function-node)\n    - [Source Export / Import](#source-export--import)\n  - [Creating a flow that does an HTTP Request](#creating-a-flow-that-does-an-http-request)\n    - [Add an Inject node](#add-an-inject-node-1)\n    - [Add an HttpRequest node](#add-an-httprequest-node)\n    - [Add a CSV node](#add-a-csv-node)\n    - [Add a Debug node](#add-a-debug-node-1)\n    - [Wire them all together](#wire-them-all-together)\n    - [Add a Switch node](#add-a-switch-node)\n    - [Add a Change node](#add-a-change-node)\n    - [Add a Debug node](#add-a-debug-node-2)\n    - [Deploy](#deploy-1)\n    - [Export](#export)\n\n\u003c!-- /TOC --\u003e\n\n## Installation\n\nInstall Node-RED is to use the node package manager, npm, that comes with Node.js. Installing as a global module adds the command node-red to your system path:\n\n```bash\nnpm install -g --unsafe-perm node-red\n```\n\nWe should now go to the root directory inside our Windows User folder and define a public directory (in the screenshot below I created a folder `./static` inside the root for that purpose) and create a Admin Login - this can be done in `./settings.js`:\n\n\n![Node-RED](./node-red_01.png)\n\n\nThe Admin password is securely hashed using the bcrypt algorithm. To generate a suitable password hash, you can use the node-red-admin command-line tool:\n\n```bash\nnpm install -g node-red-admin\n\nnode-red-admin hash-pw\n```\n\nThe tool will prompt you for the password you wish to use and then print out the hash that can be copied into the settings file.\n\n\n![Node-RED](./node-red_02.png)\n\n\nYou can now use the `node-red` command to start the application:\n\n\n![Node-RED](./node-red_03.png)\n\n\n\nThe Node-RED can now be accessed via `http://127.0.0.1:1880/` - login with the created Admin account:\n\n\n![Node-RED](./node-red_04.png)\n\n\n![Node-RED](./node-red_05.png)\n\n\n## Adding Nodes\n\nNode-RED comes with a core set of useful nodes, but there are a growing number of additional nodes available for install from both the Node-RED project as well as the wider community.\n\nYou can search for available nodes in the [Node-RED library](http://flows.nodered.org/).\n\nYou can install nodes directly using the editor. To do this select Manage Palette from the menu (top right), and then select the install tab in the palette. You can now search for new nodes to install, update, and enable and disable existing nodes.\n\n\n![Node-RED](./node-red_06.png)\n\n\n## Creating a flow\n\n### Add an Inject node\n\n\u003e The __Inject__ node allows you to inject messages into a flow, either by clicking the button on the node, or setting a time interval between injects. Drag one onto the workspace from the palette.\n\n### Add a Debug node\n\n\u003e The __Debug__ node causes any message to be displayed in the Debug sidebar. By default, it just displays the payload of the message, but it is possible to display the entire message object.\n\n### Wire the two together\n\n\u003e Connect the Inject and Debug nodes together by dragging between the output port of one to the input port of the other.\n\n### Deploy\n\n\u003e At this point, the nodes only exist in the editor and must be deployed to the server. Click the __Deploy button__. With the Debug sidebar tab selected, click the Inject button. You should see numbers appear in the sidebar. By default, the Inject node uses the number of milliseconds since January 1st, 1970 as its payload.\n\n\n![Node-RED](./node-red_07.png)\n\n\n### Add a Function node\n\n\u003e The Function node allows you to pass each message though a JavaScript function.\n\u003e \n\u003e Wire the Function node in between the Inject and Debug nodes. You may need to delete the existing wire (select it and hit delete on the keyboard).\n\u003e \n\u003e Double-click on the Function node to bring up the edit dialog. Copy the follow code into the function field:\n\n```js\nvar date = new Date(msg.payload);\n// Change the payload to be a formatted Date string\nmsg.payload = date.toString();\n// Return the message so it can be sent on\nreturn msg;\n```\n\n\u003e Click Ok to close the edit dialog and then click the deploy button.\n\u003e \n\u003e Now when you click the Inject button, the messages in the sidebar will be more readable time stamps.\n\n\n![Node-RED](./node-red_08.png)\n\n\n![Node-RED](./node-red_09.png)\n\n\n### Source Export / Import\n\n\u003e The flow created in this example is represented by the following json. It can be imported straight into the editor by pasting the json into the Import dialog (Ctrl-I or via the dropdown menu):\n\n\n```json\n[[{\"id\":\"aafc0f94.6fc66\",\"type\":\"tab\",\"label\":\"Flow 1\",\"disabled\":false,\"info\":\"\"},{\"id\":\"43533492.9531bc\",\"type\":\"inject\",\"z\":\"aafc0f94.6fc66\",\"name\":\"\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":89,\"y\":67,\"wires\":[[]]},{\"id\":\"6cee6953.f69478\",\"type\":\"inject\",\"z\":\"aafc0f94.6fc66\",\"name\":\"\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":92,\"y\":169,\"wires\":[[\"f2173234.8ac2\"]]},{\"id\":\"99de335e.f26fc\",\"type\":\"debug\",\"z\":\"aafc0f94.6fc66\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":334,\"y\":376,\"wires\":[]},{\"id\":\"f2173234.8ac2\",\"type\":\"function\",\"z\":\"aafc0f94.6fc66\",\"name\":\"time format\",\"func\":\"// Create a Date object from the payload\\nvar date = new Date(msg.payload);\\n// Change the payload to be a formatted Date string\\nmsg.payload = date.toString();\\n// Return the message so it can be sent on\\nreturn msg;\",\"outputs\":1,\"noerr\":0,\"x\":212,\"y\":273,\"wires\":[[\"99de335e.f26fc\"]]}]]\n```\n\n\n![Node-RED](./node-red_10.png)\n\n\n## Creating a flow that does an HTTP Request\n\n\u003e This example is slightly more complex and starts to bring in data from external sources to do something useful locally.\n\u003e \n\u003e * It will go out to an external web site\n\u003e * grab some information\n\u003e * read and convert that into a useful form\n\n\n### Add an Inject node\n\n\u003e For this example, the Inject node will be configured to trigger the flow at a regular interval.\n\u003e \n\u003e Drag an Inject node onto the workspace from the palette.\n\u003e \n\u003e Double click the node to bring up the edit dialog. Set the repeat interval to every 5 minutes.\n\u003e \n\u003e Click Ok to close the dialog.\n\n\n![Node-RED](./node-red_11.png)\n\n\n### Add an HttpRequest node\n\n\u003e The HttpRequest node can be used to retrieve a web-page when triggered.\n\u003e\n\u003e After adding one to the workspace, edit it to set the URL property to `https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_week.csv`:\n\n\n![Node-RED](./node-red_12.png)\n\n\n### Add a CSV node\n\n\u003e Add a CSV node and edit the properties, and tick the `Input - [x] First row contains column names`:\n\n\n![Node-RED](./node-red_13.png)\n\n\n### Add a Debug node\n\n\u003e Add a Debug node to the output.\n\n\n### Wire them all together\n\n\u003e * Wire the Inject node output to the HttpRequest node input.\n\u003e * Wire the HttpRequest node output to the CSV node input.\n\u003e * Wire the CSV node output to the Debug node input.\n\n\n### Add a Switch node\n\n\u003e * Wire a Switch node to the output of the CSV node.\n\u003e * Configure the property to be `msg.payload.mag`\n\u003e * Configure the test to be \u003e= and the value to be `7`\n\n\n![Node-RED](./node-red_14.png)\n\n\n### Add a Change node\n\n\u003e * Wire a Change node to the output of the Switch node.\n\u003e * Configure the node to Set, `msg.payload` to be `PANIC!`.\n\n\n![Node-RED](./node-red_15.png)\n\n\n### Add a Debug node\n\n\u003e * Wire a Debug node to the output of the Change node\n\n\n![Node-RED](./node-red_16.png)\n\n\n### Deploy\n\n\u003e Click the Deploy button.\n\u003e\n\u003e With the Debug sidebar tab selected (Ctrl-Space, or via the dropdown menu, then click the Debug tab), click the Inject button. You should see a list of entries with some contents that look like:\n\n\n![Node-RED](./node-red_17.png)\n\n\n\u003e You can now click on the little arrow to the left of each property to expand them and examine the contents\n\u003e\n\u003e If there were any quakes with a magnitude greater than 7 you will also see some output like:\n\n```\nmsg.payload : string(6)\nPANIC!\n```\n\n\u003e You can use the green buttons to the right of each debug node to turn on and off that particular debug node - for example deactivate the first debug node to only be notified if there was an earthquake with mag 7 or higher.\n\n\n### Export\n\n```json\n[{\"id\":\"79a02957.897548\",\"type\":\"tab\",\"label\":\"Flow 3\",\"disabled\":false,\"info\":\"\"},{\"id\":\"843d22f1.0f3db\",\"type\":\"inject\",\"z\":\"79a02957.897548\",\"name\":\"Check every 5min\",\"topic\":\"\",\"payload\":\"\",\"payloadType\":\"date\",\"repeat\":\"300\",\"crontab\":\"\",\"once\":false,\"onceDelay\":0.1,\"x\":110,\"y\":69,\"wires\":[[\"9bfe934.885317\"]]},{\"id\":\"9bfe934.885317\",\"type\":\"http request\",\"z\":\"79a02957.897548\",\"name\":\"sig. earthquake\",\"method\":\"GET\",\"ret\":\"txt\",\"url\":\"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_week.csv\",\"tls\":\"\",\"x\":154,\"y\":169,\"wires\":[[\"3553ec48.07f1d4\"]]},{\"id\":\"3553ec48.07f1d4\",\"type\":\"csv\",\"z\":\"79a02957.897548\",\"name\":\"\",\"sep\":\",\",\"hdrin\":true,\"hdrout\":\"\",\"multi\":\"one\",\"ret\":\"\\\\n\",\"temp\":\"\",\"skip\":\"0\",\"x\":185,\"y\":275,\"wires\":[[\"3fe68794.f74ce8\",\"38ac2b9d.22ded4\"]]},{\"id\":\"3fe68794.f74ce8\",\"type\":\"debug\",\"z\":\"79a02957.897548\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":257,\"y\":371,\"wires\":[]},{\"id\":\"38ac2b9d.22ded4\",\"type\":\"switch\",\"z\":\"79a02957.897548\",\"name\":\"\",\"property\":\"payload.mag\",\"propertyType\":\"msg\",\"rules\":[{\"t\":\"gte\",\"v\":\"7\",\"vt\":\"str\"}],\"checkall\":\"true\",\"repair\":false,\"outputs\":1,\"x\":351,\"y\":217,\"wires\":[[\"a59b3ed8.5c641\"]]},{\"id\":\"a59b3ed8.5c641\",\"type\":\"change\",\"z\":\"79a02957.897548\",\"name\":\"\",\"rules\":[{\"t\":\"set\",\"p\":\"payload\",\"pt\":\"msg\",\"to\":\"PANIC!\",\"tot\":\"str\"}],\"action\":\"\",\"property\":\"\",\"from\":\"\",\"to\":\"\",\"reg\":false,\"x\":495,\"y\":143,\"wires\":[[\"1ac95f41.27a1c1\"]]},{\"id\":\"1ac95f41.27a1c1\",\"type\":\"debug\",\"z\":\"79a02957.897548\",\"name\":\"\",\"active\":true,\"tosidebar\":true,\"console\":false,\"tostatus\":false,\"complete\":\"false\",\"x\":629,\"y\":45,\"wires\":[]}]\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpolinowski%2Fnodered-getting-started","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpolinowski%2Fnodered-getting-started","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpolinowski%2Fnodered-getting-started/lists"}