[{"id":"68d3475.1420eb8","type":"inject","z":"ad66278e.6d8fa8","name":"Setup","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":240,"wires":[["a734b592.153ac8"]]},{"id":"696781ce.4e23","type":"inject","z":"ad66278e.6d8fa8","name":"Loop","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":380,"wires":[["30faf8c5.210de8"]]},{"id":"a734b592.153ac8","type":"change","z":"ad66278e.6d8fa8","name":"","rules":[{"t":"set","p":"gameState","pt":"global","to":"stopped","tot":"str"},{"t":"set","p":"timeRemaining","pt":"global","to":"3600000","tot":"str"},{"t":"set","p":"currentTime","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":240,"wires":[[]]},{"id":"f5e76077.727ef","type":"function","z":"ad66278e.6d8fa8","name":"Format Time As HH:MM:SS","func":"// msg.time is in milliseconds\nvar t = msg.timeRemaining / 1000;\nvar h = Math.floor(t / 3600);\nvar m = Math.floor(t % 3600 / 60);\nvar s = Math.floor(t % 3600 % 60);\n\n// Format into hh:mm:ss\nmsg.timerText = (\"0\" + h).slice(-2) + \":\" + (\"0\" + m).slice(-2) + \":\" + (\"0\" + s).slice(-2);\n\n// Update the editor node\nnode.status({fill:\"green\", shape:\"dot\", text:msg.timerText});\n\n// Forward the message along the flow\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":380,"wires":[["c01e5e0a.472a1","bcce0bc9.a53148"]]},{"id":"30faf8c5.210de8","type":"function","z":"ad66278e.6d8fa8","name":"Update Game Timer","func":"// The current timestamp is injected at the start of the flow\nvar currentTime = msg.payload;\nvar lastTickTime = global.get(\"lastTickTime\") || currentTime;\nvar timeRemaining = global.get(\"timeRemaining\") || 0;\nvar gameState = global.get(\"gameState\")\n\nif (gameState == \"playing\"){\n timeRemaining -= (currentTime - lastTickTime);\n global.set(\"timeRemaining\", timeRemaining);\n}\n\nmsg.timeRemaining = timeRemaining;\nglobal.set(\"lastTickTime\", currentTime);\n\n\nnode.status({fill:\"green\",shape:\"dot\",text:timeRemaining});\n\n// Pass value along the flow\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":410,"y":380,"wires":[["f5e76077.727ef"]]},{"id":"c01e5e0a.472a1","type":"ui_template","z":"ad66278e.6d8fa8","group":"bfd571d7.39a74","name":"Remaining Time","order":0,"width":"20","height":"10","format":"<div ng-bind-html=\"msg.timerText\">\n <div class=\"timerText\" >\n {{msg.timerText}}\n </div>\n</div>\n\n<style>\n#inRoom_Timer_cards {\n margin-top: 200px;\n font-size: 200px !important;\n text-align: center;\n}\n</style>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1020,"y":380,"wires":[[]]},{"id":"f717d60f.eef928","type":"ui_template","z":"ad66278e.6d8fa8","group":"cd9fd577.8b6588","name":"","order":1,"width":0,"height":0,"format":"<style>\n \n #toolbar{\n display: none;\n }\n body {\n background-color: black !important;\n }\n .nr-dashboard-template {\n background-color: black !important;\n color: white !important;\n }\n .ng-scope.visible {\n background-color: black !important;\n border-style: none;\n }\n #inRoom_Default_cards {\n background-color: black !important;\n }\n\n \n</style>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":790,"y":240,"wires":[[]]},{"id":"483daaff.2034d4","type":"comment","z":"ad66278e.6d8fa8","name":"Setup","info":"","x":640,"y":160,"wires":[]},{"id":"bcce0bc9.a53148","type":"ui_text","z":"ad66278e.6d8fa8","group":"6d5368d4.52c8f8","order":1,"width":0,"height":0,"name":"","label":"Time Remaining","format":"{{msg.timerText}}","layout":"col-center","x":1020,"y":320,"wires":[]},{"id":"c96968a.26ee298","type":"ui_template","z":"ad66278e.6d8fa8","group":"d24ddc84.67761","name":"Clue","order":0,"width":"20","height":"10","format":"<div ng-bind-html=\"msg.clueText\">\n <div class=\"clueText\">\n {{msg.clueText}}\n </div>\n</div>\n\n<style>\n #inRoom_txtClue_cards {\n margin-top: 50px;\n font-size: 200px !important;\n text-align: center;\n }\n</style>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":1050,"y":506,"wires":[[]]},{"id":"6157f88a.8dfbf8","type":"trigger","z":"ad66278e.6d8fa8","name":"","op1":"","op2":" ","op1type":"pay","op2type":"str","duration":"20","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":590,"y":506,"wires":[["2cb112ca.73857e"]]},{"id":"2cb112ca.73857e","type":"change","z":"ad66278e.6d8fa8","name":"","rules":[{"t":"set","p":"clueText","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":790,"y":506,"wires":[["c96968a.26ee298"]]},{"id":"64c23252.e53b9c","type":"comment","z":"ad66278e.6d8fa8","name":"Display Text","info":"","x":650,"y":440,"wires":[],"icon":"node-red/parser-html.svg"},{"id":"edc22206.a61b4","type":"change","z":"ad66278e.6d8fa8","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"group\": {\"hide\": [\"inRoom_Timer\"],\"show\": [\"inRoom_txtClue\"], \"focus\": true}}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":606,"wires":[["36fb20a3.aa769"]]},{"id":"36fb20a3.aa769","type":"trigger","z":"ad66278e.6d8fa8","name":"","op1":"","op2":" {\"group\": {\"hide\": [\"inRoom_txtClue\"],\"show\": [\"inRoom_Timer\"], \"focus\": true}}","op1type":"pay","op2type":"json","duration":"20","extend":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":730,"y":606,"wires":[["2a8b789.2389888"]]},{"id":"16de9de1.6a5db2","type":"delay","z":"ad66278e.6d8fa8","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":400,"y":506,"wires":[["6157f88a.8dfbf8"]]},{"id":"2a8b789.2389888","type":"ui_ui_control","z":"ad66278e.6d8fa8","name":"","events":"all","x":1040,"y":606,"wires":[[]]},{"id":"8096c2f.0ede04","type":"inject","z":"ad66278e.6d8fa8","name":"","props":[{"p":"payload","v":"Here's a clue!","vt":"str"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Here's a clue!","payloadType":"str","x":170,"y":600,"wires":[["16de9de1.6a5db2","edc22206.a61b4"]]},{"id":"605230c6.55af5","type":"ui_button","z":"ad66278e.6d8fa8","name":"","group":"240ed09b.e4ad9","order":0,"width":0,"height":0,"passthru":false,"label":"Here's a clue!","tooltip":"","color":"","bgcolor":"","icon":"","payload":"Here's a clue!","payloadType":"str","topic":"","x":160,"y":520,"wires":[["16de9de1.6a5db2","edc22206.a61b4"]]},{"id":"2ec43e51.75f482","type":"inject","z":"ad66278e.6d8fa8","name":"show vidclue","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"group\": {\"show\": [\"Room_vidClue\"], \"focus\": true}}","payloadType":"json","x":1010,"y":920,"wires":[["68989094.53119"]]},{"id":"a2b7d580.ed0948","type":"inject","z":"ad66278e.6d8fa8","name":"hide vidclue","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"group\": {\"hide\": [\"Room_vidClue\"], \"focus\": true}}","payloadType":"json","x":1010,"y":1000,"wires":[["68989094.53119"]]},{"id":"67e2dbd7.bb0944","type":"inject","z":"ad66278e.6d8fa8","name":"show imgclue","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"group\": {\"show\": [\"Room_imgClue\"], \"focus\": true}}","payloadType":"json","x":1010,"y":760,"wires":[["145f9bc9.320934"]]},{"id":"d52f9821.20b9e8","type":"inject","z":"ad66278e.6d8fa8","name":"hide imgclue","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"group\": {\"hide\": [\"Room_imgClue\"], \"focus\": true}}","payloadType":"json","x":1010,"y":840,"wires":[["145f9bc9.320934"]]},{"id":"89cec276.7de2e","type":"inject","z":"ad66278e.6d8fa8","name":"show txtclue","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"group\": {\"show\": [\"Room_txtClue\"], \"focus\": true}}","payloadType":"json","x":590,"y":920,"wires":[["c566197a.830618"]]},{"id":"f5e18152.0c092","type":"inject","z":"ad66278e.6d8fa8","name":"hide txtclue","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"group\": {\"hide\": [\"Room_txtClue\"], \"focus\": true}}","payloadType":"json","x":590,"y":1000,"wires":[["c566197a.830618"]]},{"id":"f46ea310.8f4d9","type":"inject","z":"ad66278e.6d8fa8","name":"show timer","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"group\": {\"show\": [\"Room_Timer\"], \"focus\": true}}","payloadType":"json","x":580,"y":760,"wires":[["87e404d2.43ffd8"]]},{"id":"c9abb390.7f76a","type":"inject","z":"ad66278e.6d8fa8","name":"hide timer","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"group\": {\"hide\": [\"Room_Timer\"], \"focus\": true}}","payloadType":"json","x":580,"y":840,"wires":[["87e404d2.43ffd8"]]},{"id":"b338231e.47227","type":"comment","z":"ad66278e.6d8fa8","name":"Room Controls","info":"","x":560,"y":680,"wires":[]},{"id":"98a72fc4.d05d2","type":"inject","z":"ad66278e.6d8fa8","name":"play","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":760,"wires":[["db5dad75.117dc"]]},{"id":"f98cdfa4.2e004","type":"inject","z":"ad66278e.6d8fa8","name":"stop","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":880,"wires":[["72ee5ea1.0b8bf"]]},{"id":"db5dad75.117dc","type":"change","z":"ad66278e.6d8fa8","name":"","rules":[{"t":"set","p":"gameState","pt":"global","to":"playing","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":760,"wires":[[]]},{"id":"72ee5ea1.0b8bf","type":"change","z":"ad66278e.6d8fa8","name":"","rules":[{"t":"set","p":"gameState","pt":"global","to":"stopped","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":880,"wires":[[]]},{"id":"bce7b82a.eb56b8","type":"inject","z":"ad66278e.6d8fa8","name":"reset","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":1000,"wires":[["b31b7cfa.72df3"]]},{"id":"b31b7cfa.72df3","type":"change","z":"ad66278e.6d8fa8","name":"","rules":[{"t":"set","p":"timeRemaining","pt":"global","to":"3600000","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":1000,"wires":[[]]},{"id":"34348e78.5c6652","type":"ui_button","z":"ad66278e.6d8fa8","name":"","group":"6d5368d4.52c8f8","order":2,"width":0,"height":0,"passthru":false,"label":"Play","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":120,"y":680,"wires":[["db5dad75.117dc"]]},{"id":"10a7952f.ffa0db","type":"ui_button","z":"ad66278e.6d8fa8","name":"","group":"6d5368d4.52c8f8","order":3,"width":0,"height":0,"passthru":false,"label":"Stop","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":110,"y":820,"wires":[["72ee5ea1.0b8bf"]]},{"id":"ffa617b6.6a9728","type":"ui_button","z":"ad66278e.6d8fa8","name":"","group":"6d5368d4.52c8f8","order":4,"width":0,"height":0,"passthru":false,"label":"Reset","tooltip":"","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":110,"y":940,"wires":[["b31b7cfa.72df3"]]},{"id":"87e404d2.43ffd8","type":"ui_ui_control","z":"ad66278e.6d8fa8","name":"","events":"all","x":760,"y":800,"wires":[[]]},{"id":"c566197a.830618","type":"ui_ui_control","z":"ad66278e.6d8fa8","name":"","events":"all","x":760,"y":960,"wires":[[]]},{"id":"145f9bc9.320934","type":"ui_ui_control","z":"ad66278e.6d8fa8","name":"","events":"all","x":1220,"y":800,"wires":[[]]},{"id":"68989094.53119","type":"ui_ui_control","z":"ad66278e.6d8fa8","name":"","events":"all","x":1220,"y":960,"wires":[[]]},{"id":"6882e3c2.c60a6c","type":"ui_microphone","z":"ad66278e.6d8fa8","group":"82e5f052.a70a","order":4,"width":0,"height":0,"name":"click to speak","maxLength":"20","timeslice":0,"x":150,"y":1080,"wires":[["98cd1368.62fd3"]]},{"id":"98cd1368.62fd3","type":"ui_audio","z":"ad66278e.6d8fa8","name":"","group":"cd9fd577.8b6588","voice":"en-US","always":"","x":1100,"y":1080,"wires":[]},{"id":"bfd571d7.39a74","type":"ui_group","z":"","name":"Timer","tab":"7b633966.786a88","order":1,"disp":false,"width":"20","collapse":false},{"id":"cd9fd577.8b6588","type":"ui_group","z":"","name":"Default","tab":"7b633966.786a88","order":3,"disp":false,"width":"1","collapse":false},{"id":"6d5368d4.52c8f8","type":"ui_group","z":"","name":"Time Control","tab":"b71ff150.a0cce","order":6,"disp":true,"width":"6","collapse":false},{"id":"d24ddc84.67761","type":"ui_group","z":"","name":"txtClue","tab":"7b633966.786a88","order":2,"disp":false,"width":"20","collapse":false},{"id":"240ed09b.e4ad9","type":"ui_group","z":"","name":"Text Clues","tab":"b71ff150.a0cce","order":2,"disp":true,"width":"6","collapse":false},{"id":"82e5f052.a70a","type":"ui_group","z":"","name":"Push to talk","tab":"b71ff150.a0cce","order":3,"disp":true,"width":"6","collapse":false},{"id":"7b633966.786a88","type":"ui_tab","z":"","name":"inRoom","icon":"dashboard","disabled":false,"hidden":false},{"id":"b71ff150.a0cce","type":"ui_tab","z":"","name":"Master","icon":"dashboard","disabled":false,"hidden":false}]
this is part of the code,
- I have two dashboards,inRoom, which is to be displayed inside the room
- and, Master which supposed to be for the game master.
- the play, stop, and reset buttons work just fine.
- the clue button in the master dashboard does not work.
- when I try to push a text clue by the inject node it works.
Thanks Mr. Colin for your help