Uni-Color Screen (using Ui-Builder)

Create a unicolor screen that changes based on Node-RED input.

(Useful for creating ambient light in large installations with lots of screens)

Requirements

[{"id":"3089ff52.896d2","type":"tab","label":"Color Example","disabled":false,"info":""},{"id":"53b19bb.fd23464","type":"debug","z":"3089ff52.896d2","name":"simple-debug","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":840,"y":180,"wires":[]},{"id":"b5ea8700.fb0bd8","type":"uibuilder","z":"3089ff52.896d2","name":"Simple Example","topic":"","url":"uib_color","fwdInMessages":false,"allowScripts":false,"allowStyles":false,"copyIndex":true,"showfolder":false,"x":580,"y":260,"wires":[["53b19bb.fd23464"],["7a78bd95.d87e14"]]},{"id":"7a78bd95.d87e14","type":"debug","z":"3089ff52.896d2","name":"uib controls","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":320,"wires":[]},{"id":"f78f1eb9.daca","type":"template","z":"3089ff52.896d2","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"#{{payload}}","output":"str","x":380,"y":260,"wires":[["b5ea8700.fb0bd8","7d273583.af43bc"]]},{"id":"f94623bf.b6a27","type":"comment","z":"3089ff52.896d2","name":"uibuilder/Color Example","info":"[Front-End](/uib_simple)\n\nThis flow takes a HTML color value, adds a hash prefix and passes it to uibuilder. It caches the result so that if you reload the page,\nyou get the last result back.\n\n## Configuration\n\nUpdate the files:\n\n* `index.html`\n* `index.js`\n* `index.css`\n\nAccording to the example(s) in the 3 other comment nodes in this example.\n\n## Usage\n\n* use the gui at <http://localhost:1880/ui>\n* view the result at <http://localhost:1880/uib_color> ","x":220,"y":80,"wires":[]},{"id":"e11c71df.c97a9","type":"comment","z":"3089ff52.896d2","name":"index.html","info":"<!doctype html>\n<html lang=\"en\"><head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes\">\n\n    <title>uibuilder color example</title>\n    <meta name=\"description\" content=\"Node-RED uibuilder - Simple example using VueJS\">\n\n    <link rel=\"icon\" href=\"./images/node-blue.ico\">\n\n    <!-- Put your own custom styles in here -->\n    <link rel=\"stylesheet\" href=\"./index.css\" media=\"all\">\n\n</head><body>\n    \n    <!-- The \"app\" element is where the code for dynamic updates is attached -->\n\t<div id=\"app\" :style=\"myStyle\">\n\t</div>\n\n    <!-- Vendor Libraries - Load in the right order -->\n    <script src=\"../uibuilder/vendor/socket.io/socket.io.js\"></script>\n    <script src=\"../uibuilder/vendor/vue/dist/vue.min.js\"></script>\n\n    <!-- REQUIRED: Sets up Socket listeners, the uibuilder and msg objects -->\n    <script src=\"./uibuilderfe.min.js\"></script>\n\n    <!-- Put your own custom code in here -->\n    <script src=\"./index.js\"></script>\n\n</body></html>","x":580,"y":80,"wires":[],"icon":"node-red/parser-html.svg"},{"id":"7406f2d9.45525c","type":"comment","z":"3089ff52.896d2","name":"index.js","info":"/* jshint browser: true, esversion: 5, asi: true */\n/*globals uibuilder, Vue */\n// @ts-nocheck\n/*\n  Copyright (c) 2019 Julian Knight (Totally Information)\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n*/\n'use strict'\n\n/** @see https://github.com/TotallyInformation/node-red-contrib-uibuilder/wiki/Front-End-Library---available-properties-and-methods */\n\nvar app1 = new Vue({\n    // The HTML element to attach to\n\tel: '#app',\n\t/** Pre-defined data\n\t *  Anything defined here can be used in the HTML\n\t *  if you update it, the HTML will automatically update\n\t */\n\tdata: {\n\t\tmyStyle: {\n\t\t    backgroundColor: '#000000'\n\t\t}\n\t},\n\n    // This is called when Vue is fully loaded\n\tmounted: function() {\n\t    \n\t    // Start up uibuilder\n\t\tuibuilder.start()\n\t\t\n\t\t// Keep a convenient reference to the Vue app\n\t\tvar vueApp = this\n\n        /** Triggered when the node on the Node-RED server\n         *  recieves a (non-control) msg\n         */\n\t\tuibuilder.onChange('msg', function(msg) {\n\t\t\tvueApp.myStyle = {\n\t\t\t    backgroundColor: msg.payload\n\t\t\t}\n\t\t})\n\n\t\t// Send message back to node-red\n\t\t// uibuilder.send({payload:'some message'})\n\n\t\t// Triggered on reciept of a control message from node-red\n\t\t//uibuilder.onChange('ctrlMsg', function(msg) {\n\t\t//    console.log(msg)\n\t\t//})\n\t},\n\t\n}) // --- End of the Vue app definition --- //\n\n// EOF","x":570,"y":120,"wires":[],"icon":"font-awesome/fa-code"},{"id":"a9ad53f.f59e7b","type":"comment","z":"3089ff52.896d2","name":"index.css","info":"#app {\n    position: fixed;\n    width: 100%;\n    height: 100%;\n    left: 0;\n    top: 0;\n}","x":580,"y":160,"wires":[],"icon":"node-red/hash.svg"},{"id":"d11eda3d.47f018","type":"ui_colour_picker","z":"3089ff52.896d2","name":"","label":"background","group":"ed77552a.262ef8","format":"hex","outformat":"string","showSwatch":true,"showPicker":false,"showValue":false,"showHue":false,"showAlpha":false,"showLightness":true,"square":"false","dynOutput":"false","order":0,"width":0,"height":0,"passthru":true,"topic":"","x":190,"y":260,"wires":[["f78f1eb9.daca"]]},{"id":"7d273583.af43bc","type":"debug","z":"3089ff52.896d2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":580,"y":420,"wires":[]},{"id":"ed77552a.262ef8","type":"ui_group","z":"","name":"Default","tab":"86f73365.b09e2","disp":true,"width":"6","collapse":false},{"id":"86f73365.b09e2","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

Collection Info

Flow Info

Created 5 years, 8 months ago
Updated 5 years, 3 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x4)
  • debug (x3)
  • template (x1)
Other

Tags

  • color
  • interaction
  • screen
  • flash
  • disco
  • simplify
  • vue
  • vuejs
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option