End of the Year - Monitor Fireworks Celebration

GitHub Project: Firework Simulator v2

This is the flow for the FlowFuse Webinar - New Year Celebration - Sync Music with Fireworks or Light Shows

Required Nodes: Node-Red-Dashboard

[{"id":"3ddcea4f30dbeabe","type":"mqtt in","z":"d3a95d20673cd8f5","name":"","topic":"/fireworks","qos":"2","datatype":"auto-detect","broker":"10d13804a865aef3","nl":false,"rap":true,"rh":0,"inputs":0,"x":420,"y":220,"wires":[["c53fce4661cd4b13","974e10b92b15b58e"]]},{"id":"93a1095102a52f70","type":"debug","z":"d3a95d20673cd8f5","name":"debug 5","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":800,"y":200,"wires":[]},{"id":"c53fce4661cd4b13","type":"ui-chart","z":"d3a95d20673cd8f5","group":"ec50badf60ae1452","name":"","label":"chart","order":3,"chartType":"line","category":"Volume","categoryType":"str","xAxisProperty":"","xAxisPropertyType":"msg","xAxisType":"time","yAxisProperty":"volume","ymin":"","ymax":"","showLegend":true,"removeOlder":"5","removeOlderUnit":"60","removeOlderPoints":"","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"width":6,"height":8,"className":"","x":610,"y":180,"wires":[["93a1095102a52f70"]]},{"id":"974e10b92b15b58e","type":"ui-chart","z":"d3a95d20673cd8f5","group":"ec50badf60ae1452","name":"","label":"chart","order":4,"chartType":"scatter","category":"Special","categoryType":"str","xAxisProperty":"","xAxisPropertyType":"msg","xAxisType":"time","yAxisProperty":"special","ymin":"","ymax":"","showLegend":true,"removeOlder":"5","removeOlderUnit":"60","removeOlderPoints":"","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"width":6,"height":8,"className":"","x":610,"y":260,"wires":[["93a1095102a52f70"]]},{"id":"aef7bd7b4ddf7533","type":"inject","z":"d3a95d20673cd8f5","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":370,"y":460,"wires":[["d6fe29688e7351d6"]]},{"id":"d6fe29688e7351d6","type":"function","z":"d3a95d20673cd8f5","name":"function 2","func":"// const moment = require('moment-timezone');  You might need this if your on a different version of Node-RED\n\n// Get the current time in a specific time zone\nconst now = moment().tz(\"America/New_York\"); // Replace 'Your_Time_Zone' with your desired time zone\n\n// Set the target date: January 1st of the next year in the same time zone\nconst year = now.year();\nconst nextYear = year + 1;\nconst newYearsDate = moment.tz(`January 1, ${nextYear} 00:00:00`, \"America/New_York\");\n\n// Calculate the difference\nconst diff = newYearsDate.diff(now);\n\n// Convert difference into readable format\nconst days = moment.duration(diff).days();\nconst hours = moment.duration(diff).hours();\nconst minutes = moment.duration(diff).minutes();\nconst seconds = moment.duration(diff).seconds();\n\n// Create a message payload\nmsg.payload = `${days} days ${hours} hours ${minutes} minutes ${seconds} seconds`;\n\nreturn msg;\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[{"var":"moment","module":"moment-timezone"}],"x":580,"y":460,"wires":[["704072cb792cf1eb","745f98c4696d8acd"]]},{"id":"704072cb792cf1eb","type":"debug","z":"d3a95d20673cd8f5","name":"debug 6","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":800,"y":440,"wires":[]},{"id":"745f98c4696d8acd","type":"ui-text","z":"d3a95d20673cd8f5","group":"ec50badf60ae1452","order":1,"width":0,"height":0,"name":"CountDown","label":"Countdown till New Years:","format":"{{msg.payload}}","layout":"row-center","style":true,"font":"","fontSize":"33","color":"#a83e3e","className":"","x":810,"y":480,"wires":[]},{"id":"296ed9083eeef2cc","type":"ui-control","z":"d3a95d20673cd8f5","name":"","ui":"26760c824a80f83c","events":"change","x":520,"y":340,"wires":[[]]},{"id":"6cdf4751e590b5d4","type":"inject","z":"d3a95d20673cd8f5","name":"","props":[{"p":"payload"}],"repeat":"10","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"page\":0}","payloadType":"json","x":290,"y":360,"wires":[["296ed9083eeef2cc"]]},{"id":"10d13804a865aef3","type":"mqtt-broker","name":"","broker":"192.168.222.150","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"ec50badf60ae1452","type":"ui-group","name":"Group Name","page":"ef30df4835de2383","width":"9","height":"6","order":-1,"showTitle":true,"className":""},{"id":"26760c824a80f83c","type":"ui-base","name":"UI Name","path":"/dashboard"},{"id":"ef30df4835de2383","type":"ui-page","name":"Fireworks","ui":"26760c824a80f83c","path":"/","layout":"grid","theme":"b74351a14a45c853","order":-1,"className":""},{"id":"b74351a14a45c853","type":"ui-theme","name":"Theme Name","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"}}]

Flow Info

Created 1 year, 10 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x2)
  • function (x1)
  • inject (x2)
  • mqtt in (x1)
  • mqtt-broker (x1)
Other

Tags

  • FlowFuse
  • Dashboard20
  • Webinar
  • Audio
  • DigitalFireworks
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option