Node Red Button in HA dashboard

Hi all,

I have just started with Node-Red and I am on a big learning curve with it. I am just trying to create a simple flow that will turn selected lights off at a random time. However, I want a button or slider or something on my HA dashboard that will enable me to turn this automation on or off. This is where I am stuck, I can't work out how to get a button on my dashboard. The flow works but I thought I needed ui_switch node to enable me to have a switch on my dashboard.

Can anyone help me?

[{"id":"a9c4a1566b5ddfb7","type":"delay","z":"8382bc72104d4d53","name":"","pauseType":"random","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"2","randomUnits":"minutes","drop":false,"allowrate":false,"outputs":1,"x":840,"y":220,"wires":[["aba6f7ae168e8f0e"]]},{"id":"aba6f7ae168e8f0e","type":"api-call-service","z":"8382bc72104d4d53","name":"","server":"48f1823d.df4e0c","version":5,"debugenabled":false,"domain":"light","service":"turn_off","areaId":[],"deviceId":["5bd805c97ec7eef5780d4db723b96a67","2756ab6fb47e1e87cc9b6bc0de5baf38","d35fbd285e3fe6076822b240ab3936f0","f2b06f3d5ba7a72c0376daa29dd3a0e9","05637593719c561788172f040fa5de4c","b7901bafafafc14b13d5ec46fea5ee8f"],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1050,"y":220,"wires":[[]]},{"id":"b9d751c1b69b1712","type":"inject","z":"8382bc72104d4d53","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"14 22 * * *","once":false,"onceDelay":"","topic":"","payload":"off","payloadType":"str","x":310,"y":220,"wires":[["28b3118f9bd0d9b6"]]},{"id":"28b3118f9bd0d9b6","type":"ui_switch","z":"8382bc72104d4d53","name":"","label":"switch","tooltip":"","group":"dbe5bfd91b58ac60","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"onOff","topicType":"str","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","animate":false,"className":"","x":490,"y":220,"wires":[["6b3ed136da197a9b"]]},{"id":"6b3ed136da197a9b","type":"switch","z":"8382bc72104d4d53","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":220,"wires":[["a9c4a1566b5ddfb7"],[]]},{"id":"48f1823d.df4e0c","type":"server","name":"Home Assistant","version":4,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m"},{"id":"dbe5bfd91b58ac60","type":"ui_group","name":"Default","tab":"1fb3b04341d0523d","order":2,"disp":true,"width":"6","collapse":false,"className":""},{"id":"1fb3b04341d0523d","type":"ui_tab","name":"test","icon":"dashboard","disabled":false,"hidden":false}]

If you want to block messages from getting through you can use a node-red-contrib-gate with a ui_switch connected to it to allow your lights on/off messages from getting through.
Take the ui_switch node out and get the flow working switching the lights. Then insert a gate node in the flow and feed the ui_switch into it to allow the messages through or block them.