# Node-red-contrib-unifi

**URL:** https://discourse.nodered.org/t/node-red-contrib-unifi/27653
**Category:** General
**Created:** [2 June 2020 09:10 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653 "2020-06-02T09:10:10Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![daniel1411](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@daniel1411](https://discourse.nodered.org/u/daniel1411)
#### Post date: [2 June 2020 09:10 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/1 "2020-06-02T09:10:10Z")

</div>

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

please assist

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [2 June 2020 09:12 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/2 "2020-06-02T09:12:31Z")

</div>

> [@daniel1411](#):
>
> node-red-contrib-unifi

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` - [node-red-contrib-unifi (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-unifi)

> - 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" }

---

<div class="post-metadata">

### Author: ![daniel1411](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@daniel1411](https://discourse.nodered.org/u/daniel1411)
#### Post date: [2 June 2020 09:21 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/3 "2020-06-02T09:21:58Z")

</div>

Hi

@knolleary tnx for the replay,

can you share example of code how to use it ?

and what i need to choose in command list?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/a/9a5e7c9e35b4b5c1672da73120294810c8623b23.png)

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [2 June 2020 09:31 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/4 "2020-06-02T09:31:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![daniel1411](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@daniel1411](https://discourse.nodered.org/u/daniel1411)
#### Post date: [2 June 2020 09:41 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/5 "2020-06-02T09:41:44Z")

</div>

> [@knolleary](#):
>
> sed that node, but its readme does seem to list the commands it supports and what you need to pass in via

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f835bb6829ab945300e14d015e2c2f1a9c8797f2.png)

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [2 June 2020 09:44 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/6 "2020-06-02T09:44:05Z")

</div>

You should select `JSON` and set the value to:

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

```

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

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [2 June 2020 09:49 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/7 "2020-06-02T09:49:23Z")

</div>

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

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [2 June 2020 10:03 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/8 "2020-06-02T10:03:31Z")

</div>

In installed it but its errored out on very first try

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e48e17c3ed847d901e002fb67544a5afda8932ab.png)

And the same 2nd time with default timestamp inject

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/f/4fe1d2144199aceed9b72829f9f7402184669c15.png)

Issue raised

> <https://github.com/Isaksson/node-red-contrib-unifi/issues/33>
>
> Using this
> getiing this

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [2 June 2020 14:20 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/9 "2020-06-02T14:20:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [2 June 2020 14:29 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/10 "2020-06-02T14:29:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [2 June 2020 19:35 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/11 "2020-06-02T19:35:54Z")

</div>

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 😀

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.

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [3 June 2020 16:49 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/12 "2020-06-03T16:49:22Z")

</div>

The latest version works for me now 🙂

I can disable one AP

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/2/7201ad64898bc8024d627fcc089db26f52cf309e.png)

And I can re-enable it

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/9/f9df7decaadb5150be659476e021f28fbfe7baf9.png)

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

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/941e38a86c13691cfc9f66d58e190907bb82675c.png)

And looking thru the debug

this is the flow I used

```auto
[{"id":"9ad545ba.b15c98","type":"Unifi","z":"2d70b503.8d17ca","name":"","ip":"192.168.0.23","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"]]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/e/8e5af5dbdd28e70ad9e4288a9089e89cf679c8ef.png)

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [4 June 2020 08:33 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/13 "2020-06-04T08:33:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)
#### Post date: [6 June 2020 18:43 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/14 "2020-06-06T18:43:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [5 August 2020 18:43 UTC](https://discourse.nodered.org/t/node-red-contrib-unifi/27653/15 "2020-08-05T18:43:57Z")

</div>

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