How to enable/disable UNIFI AP using node-red-contrib-unifi?

please assist

Hi @daniel1411

I have never used that node, but its readme does seem to list the commands it supports and what you need to pass in via msg.payload -

  • restartAP : Reboot an Access point { command: "restartAP", mac: "device MAC address" }
  • enableAP : Enable an Access point { command: "enableAP", mac: "device MAC address" }
  • disableAP : Disable an Access point { command: "disableAP", mac: "device MAC address" }


@knolleary tnx for the replay,

can you share example of code how to use it ?

and what i need to choose in command list?

As I said, I have never used the node - all I can do is point you at the readme for the node which does appear to give you some information.

I would try setting msg.payload to one of the commands it suggests. As for how to configure the node itself - no idea. You'll have to experiement.

to test it, i want to use inject node, what i need to choose here:

You should select JSON and set the value to:

{ "command": "enableAP", "mac": "XYZ" }

Note it must be valid JSON, so command and mac must have quotes around them.


I have Unifi at home so I'm installing the node and will test it out

1 Like

In installed it but its errored out on very first try

And the same 2nd time with default timestamp inject

Issue raised

I use that node but only for stats, not other commands and I've only used fixed commands so far.

Looks like the SitesStats command doesn't work as an override even though the docs suggest it does. At least some other commands do work.

I'm in discussions on github with node author - they've fixed a few things but not able to disable an AP yet

1 Like

I run the Unifi controller on a Pi to check in occasionally on the WiFi though, to be honest, I have 3 super-sensitive test units that yell at me as soon as the WiFi has the slightest hiccup so Node-RED seems a little superfluous for that purpose :grinning:

I usually just pull the ethernet cable since my main AP is within 1 stride across the office.

It is VERY rare for it to fail though, maybe once a year if that.

The latest version works for me now :slight_smile:

I can disable one AP


And I can re-enable it


You need to find your device id - which I did using


And looking thru the debug

this is the flow I used

[{"id":"9ad545ba.b15c98","type":"Unifi","z":"2d70b503.8d17ca","name":"","ip":"","port":8443,"site":"default","command":"70","unifios":false,"x":570,"y":200,"wires":[["73a654d8.077bfc"]]},{"id":"82ce8c6b.537fb","type":"inject","z":"2d70b503.8d17ca","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":200,"wires":[["cb181b81.fbdb18"]]},{"id":"73a654d8.077bfc","type":"debug","z":"2d70b503.8d17ca","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":200,"wires":[]},{"id":"cb181b81.fbdb18","type":"function","z":"2d70b503.8d17ca","name":"disableAP","func":"msg.payload = { command: \"disableAP\" , \"device_id\" :\"5ed7b5f87ede6f55984e86c0\"}; return msg;","outputs":1,"noerr":0,"x":380,"y":200,"wires":[["9ad545ba.b15c98"]]}]

Still a few issues with the node in terms of reliability and repeatability and author is still working on those

With the latest version, 0.1.13, everything works fine for me with no errors and no unexpected results :slight_smile:


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.