{"id":15020678,"url":"https://github.com/candy-line/candy-red","last_synced_at":"2025-10-26T04:31:01.101Z","repository":{"id":57193582,"uuid":"44043923","full_name":"CANDY-LINE/candy-red","owner":"CANDY-LINE","description":"Low-code Programming Editor and Runtime for CANDY Pi Lite powered by Node-RED","archived":false,"fork":false,"pushed_at":"2021-06-08T00:32:04.000Z","size":4393,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-11T02:03:08.988Z","etag":null,"topics":["candy-pi-lite","node-red","raspberry-pi","raspbian"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CANDY-LINE.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-11T08:00:29.000Z","updated_at":"2024-01-22T18:57:26.000Z","dependencies_parsed_at":"2022-09-15T22:31:20.319Z","dependency_job_id":null,"html_url":"https://github.com/CANDY-LINE/candy-red","commit_stats":null,"previous_names":[],"tags_count":72,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CANDY-LINE%2Fcandy-red","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CANDY-LINE%2Fcandy-red/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CANDY-LINE%2Fcandy-red/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CANDY-LINE%2Fcandy-red/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CANDY-LINE","download_url":"https://codeload.github.com/CANDY-LINE/candy-red/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219864035,"owners_count":16555943,"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":["candy-pi-lite","node-red","raspberry-pi","raspbian"],"created_at":"2024-09-24T19:55:25.648Z","updated_at":"2025-10-26T04:30:55.200Z","avatar_url":"https://github.com/CANDY-LINE.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"CANDY RED\n===\n\n[![GitHub release](https://img.shields.io/github/release/CANDY-LINE/candy-red.svg)](https://github.com/CANDY-LINE/candy-red/releases/latest)\n[![master Build Status](https://travis-ci.org/CANDY-LINE/candy-red.svg?branch=master)](https://travis-ci.org/CANDY-LINE/candy-red/)\n\nCANDY RED is IoT gateway software designed for [CANDY Pi Lite board](https://translate.google.com/translate?hl=en\u0026sl=ja\u0026u=https://www.candy-line.io/%25E8%25A3%25BD%25E5%2593%2581%25E4%25B8%2580%25E8%25A6%25A7/candy-pi-lite/\u0026prev=search) with [Raspberry Pi](https://www.raspberrypi.org) and [ASUS Tinker Board](https://www.asus.com/Single-Board-Computer/Tinker-Board/) powered by [Node-RED](https://nodered.org).\n\n## Features\n\n* Include Node-RED flow editor/flow execution runtime\n* PAM Authentication is enabled by default\n* Running as a systemd service\n* Dashboard UI is installed by default\n* More builtin nodes\n    * [OMA LwM2M client nodes](https://www.npmjs.com/package/node-red-contrib-lwm2m)\n    * [Analog Devices SmartMesh IP™ nodes](https://www.npmjs.com/package/node-red-contrib-smartmesh)\n    * [EnOcean nodes (ESP3 over ERP2)](src/nodes/local-node-enocean)\n    * [GATT BLE nodes](https://www.npmjs.com/package/node-red-contrib-generic-ble)\n    * [Serialport node](https://www.npmjs.com/package/node-red-node-serialport)\n    * [Device Statistics node](https://www.npmjs.com/package/node-red-contrib-device-stats)\n    * [CANDY Pi Lite/CANDY Pi Lite+ 3G/4G LTE board nodes](src/nodes/local-node-candy-pi-lite) \u003csup\u003e*1\u003c/sup\u003e\n    * [CANDY EGG cloud service nodes](src/nodes/local-node-candy-egg) \u003csup\u003e*2\u003c/sup\u003e\n\n\u003cdl\u003e\n\u003cdd\u003e\u003ci\u003e*1 CANDY Pi Lite Board is required.\u003c/i\u003e\u003c/dd\u003e\n\u003cdd\u003e\u003ci\u003e*2 CANDY EGG cloud service account is required.\u003c/i\u003e\u003c/dd\u003e\n\u003c/dl\u003e\n\n## OS and Hardwares\n\n* [Raspberry Pi + Raspbian](#raspberry-pi--raspbian)\n* ASUS Tinker Board + Tinker OS (Debian) v2.0.5+\n* [OSX/Debian/Ubuntu/Raspbian for Development](#development)\n\n# Screenshots\n## CANDY RED flow editor page on browser\n\nThis is the default screen theme.\n\n![CANDY RED Screenshot](https://raw.githubusercontent.com/CANDY-LINE/candy-red/master/images/screenshot-candy-red.png \"CANDY RED Screenshot\")\n\n# Raspberry Pi + Raspbian\n\n## Prerequisites\n\n### Raspbian version\n\n * 2020-02-13-raspbian-buster\n\n### Tested Node.js versions\n\n* v10 (Active LTS)\n* v12 (Active LTS)\n\n### Supported npm version\n\n* v6.x+\n\n## Install/Version-up\n\nThe module installation will take around 30 minutes on RPi1. On RPi2+, the installation time will be shorter.\n\nPlease consider to change your hostname as [described below](#change-hostname) prior to installing CANDY RED.\n\n`--unsafe-perm` flag is required for installing this project module since npm performs privileged actions during the installation. This is discussed in the [issue](https://github.com/voodootikigod/node-serialport/issues/535).\n\nYou can ignore `npm WARN`s, `gyp WARN`s, `gyp ERR!`s and `node-pre-gyp ERR!`s unless the installation terminates normally. You can check if the installation is successful by `sudo service candy-red status` command after running `install.sh` script as well as `npm install`.\n\n** Please export your flow data prior to performing version-up **\n\nPlease refer to the following commands to install.\n\n```\n$ sudo npm install -g --unsafe-perm --production candy-red\n```\n\nYou can access `http://\u003chostname.local or ip address\u003e:8100` with your browser on the same LAN where `\u003chostname.local or ip address\u003e` is a host name with `.local` suffix or IP address.\n\n## Authentication\n\nPAM authentication is enabled by default for both Linux (Raspbian/Debian/Ubuntu) and macOS. So you need to login with your OS account such as `pi` user. You can add custom user ID/password as well by providing the following environmental variables on installation.\n\nWhen providing the credentials, PAM authentication is disabled.\n\n```\n$ sudo \\\n    CANDY_RED_ADMIN_USER_ID=... \\\n    CANDY_RED_ADMIN_PASSWORD=... \\\n    npm install -g --unsafe-perm --production candy-red\n```\n\nThe password is encrypted while the installation process.\n\nNote that PAM authentication feature (not custom credentials authentication) is disabled unless `NODE_ENV` is `production`.\n\n## Stop/Start/Status Service (Raspbian)\n\nThe service name is `candy-red`. As of Jessie, systemd comes as a default system manager.\n\n```\n$ sudo systemctl stop candy-red\n$ sudo systemctl start candy-red\n$ sudo systemctl status candy-red\n$ sudo journalctl -f -u candy-red -o cat\n```\n\n## Uninstall\n\n```\n$ sudo npm uninstall -g --unsafe-perm candy-red\n```\n\nIf you run `sudo npm uninstall -g candy-red` (without `--unsafe-perm`) and see `[ERROR] This script must be run as root` message, please run the following commands in order to reset systemd configurations.\n\n```\n$ sudo systemctl stop candy-red\n$ sudo systemctl disable candy-red\n$ sudo rm -f \"$(dirname $(dirname $(which systemctl)))/lib/systemd/system/candy-red.service\"\n```\n\n## RPi Tips\n\n### Change Hostname\n\nSince RPi hostname is `raspberrypi` by default, you will get confused when you have 2 or more devices and they're online.\n\nYou can change the host name by either `sudo raspi-config`.\n\n### BLE USB adaptor/dongle\n\nCANDY RED service tries to activate the `hci0` device if it exists on boot so that you can use BLE devices on the flow editor. This is performed silently at background and you usually don't have to care of it.\n\nHowever, you need to tell the system to restart the CANDY RED service by performing `sudo systemctl restart candy-red` when you insert the dongle after boot. Or BLE is not available.\n\n### Node-RED home\n\nThe Node-RED home path, where flow files are placed, is found at `$(npm root -g)/candy-red/.node-red/`.\nAlternately, you can provide the arbitrary path with `CANDY_RED_HOME` environment variable defined in `$(npm root -g)/candy-red/.node-red/environment` file.\n\n### BlueZ source code build\n\nThe latest Raspbian offers you to install BlueZ with `apt-get` command as described above.\nHowever, you can still use the latest version of BlueZ if you want.\n\nYou can find the installation instruction in the [article](http://www.elinux.org/RPi_Bluetooth_LE). The compilation takes around 40 minutes (RPi B+).\n\nHere is a brief instruction. (Check the latest version of BlueZ at www.bluez.org)\n```\n$ BLUEZ_VER=5.52\n$ sudo apt-get install -y build-essential libdbus-1-dev \\\n    libdbus-glib-1-dev libglib2.0-dev libical-dev \\\n    libreadline-dev libudev-dev libusb-dev make\n$ wget https://www.kernel.org/pub/linux/bluetooth/bluez-${BLUEZ_VER}.tar.xz\n$ tar xvf bluez-${BLUEZ_VER}.tar.xz\n$ cd bluez-${BLUEZ_VER}\n$ ./configure\n$ make\n$ sudo make install\n```\n\n# Configuration\n\n## Initial Welcome Flow\n\nWelcome flow is a sample flow for helping users to understand the flow editor, which is created by CANDY RED when user's flow is missing.\n\n`WELCOME_FLOW_URL` environmental variable allows users to specify the initial welcome flow file in URL form. You can set it on installation by, for example, `WELCOME_FLOW_URL=http://... npm install -g ....`.\n\nBy default, [`welcome-flow.json`](src/welcome-flow.json) is used as the initial flow.\n\nNote that the downloaded flow file will be discarded if it is not a valid JSON data.\n\n## Preinstalled nodes\n\n```\n$ sudo NODES_CSV=\"node-ed-contib-cache,\u003e=1.0.4 node-ed-contib-geneic-ble,\u003e=2.0.4 node-ed-contib-smartmesh,\u003e=1.0.0\" npm install -g --unsafe-perm --production candy-red\n```\nEither a single space` ` or `\\n` can be a delimiter of `NODE_CSV` value.\n\n# Development\n\n## Prerequisites\n\n### Supported Node.js versions\n\n* v10 (Active LTS)\n* v12 (Active LTS)\n\n## Setup for Building\n\nInstall the local dependencies.\n\n```\n$ git clone https://github.com/CANDY-LINE/candy-red.git\n$ cd candy-red\n$ DEVEL=true npm install\n# Run one of the following command to install default nodes\n$ make #=\u003e default nodes are installed into ~/.node-red/node_modules\n$ make CANDY_RED_HOME=$(pwd)/tmp #=\u003e default nodes are installed into $(pwd)/tmp/.node-red/node_modules\n```\n\n## Build\n\n```\n$ npm run build\n```\n\nThe processed files are placed under `dist` directory.\n\n## Version up\n\nJust pull the update on the `candy-red` directory and perform `npm install`.\n\n```\n$ cd candy-red\n$ git pull\n$ npm install --production\n```\n\n## Run on localhost for development use\n\nTry the following commands after `npm run build`:\n(Prepends `sudo` for Raspbian)\n\n```\n$ npm run start\n```\n\nWith a remote welcome flow file:\n\n```\n$ WELCOME_FLOW_URL=https://git.io/vKx5r npm run start\n```\n\nAnd you'll see the sensor info like this:\n\n    [INFO] Default welcome flow has been created\n    29 Jul 21:52:35 - [info] [CANDY RED] Deploying Flow Editor UI...\n\n\n    Welcome to Node-RED\n    ===================\n\n    29 Jul 21:52:35 - [info] Node-RED version: v0.14.6 [candy-red v2.6.3]\n    29 Jul 21:52:35 - [info] Node.js  version: v4.4.7\n    29 Jul 21:52:35 - [info] Darwin 15.6.0 x64 LE\n    29 Jul 21:52:35 - [info] Loading palette nodes\n    29 Jul 21:52:36 - [info] UI started at /api/ui\n    29 Jul 21:52:36 - [warn] ------------------------------------------------------\n    29 Jul 21:52:36 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node\n    29 Jul 21:52:36 - [warn] ------------------------------------------------------\n    29 Jul 21:52:36 - [info] User directory : /Users/guest/.node-red\n    29 Jul 21:52:36 - [info] Flows file     : /Users/guest/.node-red/flows_candy-red.json\n    29 Jul 21:52:36 - [info] [BLE] Set up done\n    29 Jul 21:52:36 - [info] Listen port=8100\n    29 Jul 21:52:36 - [info] Starting flows\n    29 Jul 21:52:36 - [info] [inject:89c364b0.763c98] repeat = 1000\n    29 Jul 21:52:36 - [info] Started flows\n\nWith password authentication:\n\n```\n$ CANDY_RED_ADMIN_USER_ID=admin \\\n  CANDY_RED_ADMIN_PASSWORD_ENC=`node -e \"console.log(require('bcryptjs').hashSync(process.argv[1], 8));\" password` \\\n  CANDY_RED_SESSION_TIMEOUT=3600 \\\n  npm run start\n```\n\nThe above variables allows you to use the following credentials,\n\n- username: `admin`\n- password: `password`\n- session timeout: 1 hour\n\n## Test\n\n```\n$ npm test\n```\n\n## Package\n\n```\n# Development Machine\n$ npm pack\n$ scp ./candy-red-9.11.0.tgz pi@raspberrypi.local:~\n\n# RPi (on ~)\n$ sudo npm uninstall -g --unsafe-perm candy-red\n$ sudo rm -fr /opt/candy-red # to prune user specific files if necessary\n$ time sudo npm install -g --unsafe-perm ./candy-red-9.11.0.tgz\n$ sudo journalctl -f -u candy-red -o cat # to show logs\n```\n\n### Upload dist\n\n```\n$ scp -rp ./dist/* pi@raspberrypi.local:/usr/lib/node_modules/candy-red/dist\n```\n\n## Docker\n\n### Image Building\n\n```\n$ cd candy-red\n$ docker build -t candy-red .\n$ docker build --build-arg CANDY_RED_VERSION=9.9.0  -t candy-red .\n```\n\n### Run CANDY RED container\n\nRun in foreground:\n```\n$ docker run -ti --rm candy-red\n```\n\n`Ctrl+C` to exit.\n\nRun in background:\n```\n$ docker run -tid --name candy-red candy-red\n```\n\nRun `docker rm -f candy-red` to stop (and remove) the container.\n\n### Run CANDY RED container with manually built code\n\nRun in foreground:\n```\n$ npm run build\n$ docker run -ti --rm -v ./dist:/candy-red-dist candy-red\n```\n\nRun in background:\n```\n$ npm run build\n$ docker run -tid -v ./dist:/candy-red-dist candy-red\n```\n\n### How to release\n\n1. Publish NPM package: `npm publish`\n1. Tag Release and Push\n\n## Coding Styles\n\n1. Use ES6 (except gulpfile.js and \\*.html)\n1. 2-space soft tabs\n1. Append .es6.js suffix to ES6 JS files\n1. See .jshintrc for detail\n\n## TODO\n* publish local Node-RED nodes in this project to npm repository\n\n### Files including the package version\n\n1. README.md\n1. [package.json](package.json)\n\n# Copyright and License\n\n## Source Code License\n\n© [CANDY LINE INC.](https://www.candy-line.io)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n## Creative works\n\nPNG/ICO images under src/public folder are released under [CC BY-NC-SA](http://creativecommons.org/licenses/by-nc-sa/4.0/), Copyright (c) 2019 [CANDY LINE INC.](https://www.candy-line.io)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcandy-line%2Fcandy-red","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcandy-line%2Fcandy-red","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcandy-line%2Fcandy-red/lists"}