Node-red and Unifi

Hey all. You have pulled me out of the mud before and hopefully you can help me again

I am trying to add a voucher to a unifi controller via node-red. I know the API is there to use but the data I google shows curl type requests. Has anyone achieved this using Node-Red?

You should be able to simply use a HTTP node for that.
See here for some more details:

There is also a set of unifi nodes

This comes rather late but you might be interested in what I created using node-red-contrib-unifi:

image

I can toggle my guest wifi on/off in the Home Assistant Dashboard but I also have a physical button guests can press to turn off/on wifi (the button turns green/red to confirm).
If no guest is connected to the network it will turn off the guest wifi after a while.
The Home Assistant Dashboard auto-generates 2 types of vouchers: 8h validity vouchers for occasional visitors and 4 year validity vouchers for e.g extended family.
If you empty the text field it will-autogenerate a new voucher.
You need to create those helper entities in Home Assistant and then below you can find the code that does all the magic in the background.

[{"id":"2f13e2ff88ec66ba","type":"Unifi","z":"34843a6c.50d986","name":"UnifiClients","server":"8f842b0c824ec9c6","command":"20","x":270,"y":4420,"wires":[["db10b16c96ec7280"]]},{"id":"8fb9d605b6dc91fd","type":"function","z":"34843a6c.50d986","name":"GetVoucherCode","func":"var payload = msg.payload;\nvar create_time = msg.create_time;\n\nfor (var i = 0; i < payload.length; i++) {\n    if (payload[i].create_time === create_time) {\n        var code = payload[i].code;\n        var slowcode = code.split('').join(' ');\n        msg.payload = code;\n        msg.slowcode = slowcode;\n        return msg;\n    }\n}\n\n// If we got here, we didn't find an object with matching create_time\nmsg.payload = null;\nmsg.slowcode = null;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":3880,"wires":[["665c4b4b082ab4ba"]]},{"id":"62d3e59660f9ca5b","type":"change","z":"34843a6c.50d986","name":"create_time & getVouchers","rules":[{"t":"set","p":"create_time","pt":"msg","to":"payload[0].create_time","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"getVouchers\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":3880,"wires":[["152d5083d459aa99"]]},{"id":"152d5083d459aa99","type":"Unifi","z":"34843a6c.50d986","name":"UNifi","server":"8f842b0c824ec9c6","command":"20","x":830,"y":3880,"wires":[["8fb9d605b6dc91fd"]]},{"id":"c15777a88a5d8a3a","type":"change","z":"34843a6c.50d986","name":"CreateVoucher","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"createVouchers\",\"minutes\":\"480\",\"count\":\"1\",\"quota\":\"1\",\"note\":\"8hNodeRed\",\"up\":\"4000\",\"down\":\"16000\",\"mbytes\":\"10000\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":3880,"wires":[["64ad0efc6552f6b1"]]},{"id":"64ad0efc6552f6b1","type":"Unifi","z":"34843a6c.50d986","name":"UNifi","server":"8f842b0c824ec9c6","command":"20","x":450,"y":3880,"wires":[["62d3e59660f9ca5b"]]},{"id":"a9c85db2a1cb5208","type":"Unifi","z":"34843a6c.50d986","name":"UnifiWlans","server":"8f842b0c824ec9c6","command":"110","x":330,"y":4200,"wires":[["0898aecffbfa0313"]]},{"id":"633dadc94db4d245","type":"change","z":"34843a6c.50d986","name":"DisableGuestwifi","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"disableWlan\",\"wlan_id\":\"5b16c470b5b6752842ddbda3\",\"disable\":true}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":810,"y":4180,"wires":[["8484992f2e7918a2"]]},{"id":"8484992f2e7918a2","type":"Unifi","z":"34843a6c.50d986","name":"UNifi","server":"8f842b0c824ec9c6","command":"20","x":970,"y":4180,"wires":[["b523979caa2ff953"]]},{"id":"bb13956de2bc7eeb","type":"change","z":"34843a6c.50d986","name":"EnableGuestwifi","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"disableWlan\",\"wlan_id\":\"5b16c470b5b6752842ddbda3\",\"disable\":false}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":800,"y":4220,"wires":[["e05c4a00860e6d1d"]]},{"id":"e05c4a00860e6d1d","type":"Unifi","z":"34843a6c.50d986","name":"UNifi","server":"8f842b0c824ec9c6","command":"20","x":970,"y":4220,"wires":[["5631b8baa2322454","b523979caa2ff953"]]},{"id":"db10b16c96ec7280","type":"function","z":"34843a6c.50d986","name":"Bezoek used?","func":"var payload = msg.payload;\nvar hasBezoek = false;\n\nfor (var i = 0; i < payload.length; i++) {\n    if (payload[i].essid === 'Bezoek') {\n        hasBezoek = true;\n        break;\n    }\n}\n\nmsg.payload = hasBezoek;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":4420,"wires":[["1d3b61a31d25cf4e"]]},{"id":"0898aecffbfa0313","type":"function","z":"34843a6c.50d986","name":"GuestWifi on?","func":"var payload = msg.payload;\nvar enabled = false;\n\nfor (var i = 0; i < payload.length; i++) {\n    if (payload[i].name === 'Bezoek') {\n        enabled = payload[i].enabled;\n        break;\n    }\n}\n\nmsg.payload = (enabled === true) ? 'on' : 'off';\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":500,"y":4200,"wires":[["b5c9a32d36877026"]]},{"id":"b5c9a32d36877026","type":"switch","z":"34843a6c.50d986","name":"on?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":650,"y":4200,"wires":[["633dadc94db4d245"],["bb13956de2bc7eeb"]]},{"id":"5631b8baa2322454","type":"trigger","z":"34843a6c.50d986","name":"Pause 8h","op1":"","op2":"","op1type":"nul","op2type":"pay","duration":"8","extend":false,"overrideDelay":false,"units":"hr","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":120,"y":4420,"wires":[["2f13e2ff88ec66ba"]]},{"id":"1d3b61a31d25cf4e","type":"switch","z":"34843a6c.50d986","name":"true?","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":590,"y":4460,"wires":[["5631b8baa2322454"],["633dadc94db4d245"]]},{"id":"92e04b29ae091a26","type":"server-state-changed","z":"34843a6c.50d986","name":"Guest wifi button pressed","server":"5c29d263.09d2ac","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.guest_wifi","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":4200,"wires":[["a9c85db2a1cb5208","1a3c5878f083031b"]]},{"id":"30c0a1ae0ed5f3e1","type":"api-call-service","z":"34843a6c.50d986","name":"Green","server":"5c29d263.09d2ac","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.living_rgb_led"],"data":"{\"transition\":\"3\",\"rgb_color\":[0,255,0],\"brightness_pct\":\"100\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1230,"y":4180,"wires":[["0e23e60d18862176"]]},{"id":"f0f92ad48c0f46b9","type":"api-call-service","z":"34843a6c.50d986","name":"Red","server":"5c29d263.09d2ac","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.living_rgb_led"],"data":"{\"transition\":\"3\",\"rgb_color\":[255,0,0],\"brightness_pct\":\"100\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1230,"y":4220,"wires":[["90b536d4c41ba3ef"]]},{"id":"b523979caa2ff953","type":"switch","z":"34843a6c.50d986","name":"enabled?","property":"payload[0].enabled","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":1100,"y":4200,"wires":[["30c0a1ae0ed5f3e1"],["f0f92ad48c0f46b9"]]},{"id":"1a3c5878f083031b","type":"api-call-service","z":"34843a6c.50d986","name":"RGBLed Transition","server":"5c29d263.09d2ac","version":5,"debugenabled":false,"domain":"light","service":"turn_on","areaId":[],"deviceId":[],"entityId":["light.living_rgb_led"],"data":"{\"transition\":\"1\",\"rgb_color\":[255,255,255],\"brightness_pct\":\"0\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":350,"y":4240,"wires":[[]]},{"id":"90b536d4c41ba3ef","type":"api-call-service","z":"34843a6c.50d986","name":"Toggle wifi state off","server":"5c29d263.09d2ac","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.guest_wifi"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1390,"y":4220,"wires":[[]]},{"id":"0e23e60d18862176","type":"api-call-service","z":"34843a6c.50d986","name":"Toggle wifi state on","server":"5c29d263.09d2ac","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.guest_wifi"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1390,"y":4180,"wires":[[]]},{"id":"f943ea70893e32c0","type":"server-state-changed","z":"34843a6c.50d986","name":"Guest wifi state change","server":"5c29d263.09d2ac","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.guest_wifi","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":120,"y":4320,"wires":[["3e923892251d7f68"]]},{"id":"3e923892251d7f68","type":"switch","z":"34843a6c.50d986","name":"changed by Supervisor (=NodeRed automation)?","property":"data.new_state.context.user_id","propertyType":"msg","rules":[{"t":"eq","v":"fcaa93e3fd5544b2b2b39aed0b38a931","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":4320,"wires":[[],["87b2b17ffadfb2c5"]]},{"id":"87b2b17ffadfb2c5","type":"switch","z":"34843a6c.50d986","name":"On/off?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":700,"y":4320,"wires":[["bb13956de2bc7eeb"],["633dadc94db4d245"]]},{"id":"665c4b4b082ab4ba","type":"api-call-service","z":"34843a6c.50d986","name":"Show 8h voucher","server":"5c29d263.09d2ac","version":5,"debugenabled":true,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.guest_wifi_8h_voucher"],"data":"{\"value\": \"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1190,"y":3880,"wires":[[]]},{"id":"0d23e5b4d7e1f576","type":"server-state-changed","z":"34843a6c.50d986","name":"8h voucher empty?","server":"5c29d263.09d2ac","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_text.guest_wifi_8h_voucher","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"^$","halt_if_type":"re","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":90,"y":3880,"wires":[["c15777a88a5d8a3a"],[]]},{"id":"2a4bebd46a4b6ad9","type":"function","z":"34843a6c.50d986","name":"GetVoucherCode","func":"var payload = msg.payload;\nvar create_time = msg.create_time;\n\nfor (var i = 0; i < payload.length; i++) {\n    if (payload[i].create_time === create_time) {\n        var code = payload[i].code;\n        var slowcode = code.split('').join(' ');\n        msg.payload = code;\n        msg.slowcode = slowcode;\n        return msg;\n    }\n}\n\n// If we got here, we didn't find an object with matching create_time\nmsg.payload = null;\nmsg.slowcode = null;\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":3980,"wires":[["acaa9cfc948f4abf"]]},{"id":"b0daa62bbd84ff82","type":"change","z":"34843a6c.50d986","name":"create_time & getVouchers","rules":[{"t":"set","p":"create_time","pt":"msg","to":"payload[0].create_time","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"getVouchers\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":3980,"wires":[["ed9d27d80d851c0e"]]},{"id":"ed9d27d80d851c0e","type":"Unifi","z":"34843a6c.50d986","name":"UNifi","server":"8f842b0c824ec9c6","command":"20","x":830,"y":3980,"wires":[["2a4bebd46a4b6ad9"]]},{"id":"8d42ba723a35055d","type":"change","z":"34843a6c.50d986","name":"CreateVoucher","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"createVouchers\",\"minutes\":\"2000000\",\"count\":\"1\",\"quota\":\"1\",\"note\":\"4yNodeRed\",\"up\":\"8000\",\"down\":\"16000\",\"mbytes\":\"50000\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":300,"y":3980,"wires":[["f2b66ba231cd1fc5"]]},{"id":"f2b66ba231cd1fc5","type":"Unifi","z":"34843a6c.50d986","name":"UNifi","server":"8f842b0c824ec9c6","command":"20","x":450,"y":3980,"wires":[["b0daa62bbd84ff82"]]},{"id":"acaa9cfc948f4abf","type":"api-call-service","z":"34843a6c.50d986","name":"Show 4y voucher","server":"5c29d263.09d2ac","version":5,"debugenabled":true,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.guest_wifi_4_year_voucher"],"data":"{\"value\": \"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1190,"y":3980,"wires":[[]]},{"id":"52a7a2704517d8b4","type":"server-state-changed","z":"34843a6c.50d986","name":"4year voucher empty?","server":"5c29d263.09d2ac","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_text.guest_wifi_4_year_voucher","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"^$","halt_if_type":"re","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":100,"y":3980,"wires":[["8d42ba723a35055d"],[]]},{"id":"f0fb88f5b5637e80","type":"change","z":"34843a6c.50d986","name":"getVouchers & store4y&8h","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"getVouchers\"}","tot":"json"},{"t":"set","p":"8hvoucher","pt":"msg","to":"$globalContext(\"homeassistant.homeAssistant.states['input_text.guest_wifi_8h_voucher'].state\")","tot":"jsonata"},{"t":"set","p":"4yvoucher","pt":"msg","to":"$globalContext(\"homeassistant.homeAssistant.states['input_text.guest_wifi_4_year_voucher'].state\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":4080,"wires":[["ed9bd3404c157a8f"]]},{"id":"ed9bd3404c157a8f","type":"Unifi","z":"34843a6c.50d986","name":"UNifi","server":"8f842b0c824ec9c6","command":"20","x":470,"y":4080,"wires":[["b130d9af7e0cdc56"]]},{"id":"7a215ec2c330213e","type":"inject","z":"34843a6c.50d986","name":"Daily","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 22 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":90,"y":4080,"wires":[["f0fb88f5b5637e80"]]},{"id":"3208d631e3aa4ed2","type":"Unifi","z":"34843a6c.50d986","name":"UNifi","server":"8f842b0c824ec9c6","command":"20","x":1230,"y":4080,"wires":[[]]},{"id":"738c4fc7403a18c6","type":"change","z":"34843a6c.50d986","name":"revokeVouchers","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"revokeVouchers\",\"voucher_id\":payload}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":4080,"wires":[["3208d631e3aa4ed2"]]},{"id":"b130d9af7e0cdc56","type":"function","z":"34843a6c.50d986","name":"ScanVouchers","func":"var payload = msg.payload;\nvar voucher8h = msg['8hvoucher'];\nvar voucher4y = msg['4yvoucher'];\n\nvar found8h = false;\nvar found4y = false;\n// Loop through each object in the input array\nfor (var i = 0; i < payload.length; i++) {\n    var obj = payload[i];\n    var note = obj.note;\n    var code = obj.code;\n\n    if (note === '8hNodeRed' && code === voucher8h) {\n        found8h = true;// confirm that the 8hcode in Home Assistant is still OK\n    }\n\n    if (note === '4yNodeRed' && code === voucher4y) {\n        found4y = true;// confirm that the 4ycode in Home Assistant is still OK\n    }\n// Check if the code is not listed in Home Assistant and can thus be deleted.\n    if ((note === '8hNodeRed' || note === '4yNodeRed') &&\n        code !== voucher8h && code !== voucher4y) {\n        var output = {\n            payload: obj._id\n        };\n        node.send(output); //send an output for each voucher to be deleted\n    }\n}\n\nif (!found8h) {\n    var missing = {\n        payload: 'voucher8hmissing'\n    };\n    node.send(missing); //send an output that the 8hvoucher no longer exists\n}\n\nif (!found4y) {\n    var missing = {\n        payload: 'voucher4ymissing'\n    };\n    node.send(missing); //send an output that the 4yvoucher no longer exists\n}\n\nreturn null;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":4080,"wires":[["d1b185f2b61bd92a"]]},{"id":"d1b185f2b61bd92a","type":"switch","z":"34843a6c.50d986","name":"Missing OR ToRemove?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"voucher8hmissing","vt":"str"},{"t":"eq","v":"voucher4ymissing","vt":"str"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":830,"y":4080,"wires":[["c15777a88a5d8a3a"],["8d42ba723a35055d"],["738c4fc7403a18c6"]]},{"id":"7fc6edc64e3ecf13","type":"comment","z":"34843a6c.50d986","name":"Create Wifivoucher 8h validity & send to HA Dashboard","info":"","x":220,"y":3840,"wires":[]},{"id":"a267c959ca43bf01","type":"comment","z":"34843a6c.50d986","name":"Create Wifivoucher 4 year validity & send to HA Dashboard","info":"","x":230,"y":3940,"wires":[]},{"id":"959d3eeb7da7548e","type":"comment","z":"34843a6c.50d986","name":"Daily overbodige vouchers wissen & check of nieuwe vouchers nodig","info":"","x":260,"y":4040,"wires":[]},{"id":"59627a0ad7ee8829","type":"comment","z":"34843a6c.50d986","name":"Toggle GuestWifi if toggled in HA Dashboard","info":"","x":190,"y":4280,"wires":[]},{"id":"699d748b094ed582","type":"comment","z":"34843a6c.50d986","name":"Turn off Guest Wifi if not used 8hours","info":"","x":170,"y":4380,"wires":[]},{"id":"bbb44fe538b30712","type":"comment","z":"34843a6c.50d986","name":"Toggle GuestWifi if button next to Thermostat pressed","info":"","x":220,"y":4160,"wires":[]},{"id":"8fe5f5f0793c97af","type":"comment","z":"34843a6c.50d986","name":"Status led briefly white&off","info":"","x":570,"y":4240,"wires":[]},{"id":"b9b5529305dce709","type":"comment","z":"34843a6c.50d986","name":"Status led green/red and set Guest wifi toggle in correct state","info":"","x":1400,"y":4140,"wires":[]},{"id":"8f842b0c824ec9c6","type":"unificonfig","name":"unifi controller","ip":"192.168.0.8","port":"8443","site":"default","unifios":false,"ssl":false},{"id":"5c29d263.09d2ac","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"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","enableGlobalContextStore":true}]
2 Likes

HI

image

I made the settings in HA and also in Node Red
Do I need to configure anything inside the UNIFI AP?

As you can see in the requirements of this unifi node this is what is needed:

Requirements:
Installed UniFi-Controller version v4, v5, v6, v7 or v8
Unifi controller user must have at least ‘administrator’ rights (not read-only)