Isaksson / node-red-contrib-unifi

MIT License
52 stars 20 forks source link

No GUI Commands #21

Closed ril3y closed 4 years ago

ril3y commented 4 years ago

Hi there, not sure where to put this. Can you explain how to use "non-gui" commands? I am trying to use the block client command but not sure how to inject the command?

Thanks!

Isaksson commented 4 years ago

Hello. This is an example that I have for the Command disableWLan

Add a function node and the below code to trigger the command disableWLan.

msg.payload = {command:"disableWLan",wlan_id:"5a5a6860e4b073cbb84a0a45",disable:true}; return msg;

In your case you will check the information about the command Block Client Block Client { command: "blockClient", mac: "client MAC address" }

And then you will create a function node with this code msg.payload = {command:"blockClient",mac:"clientmac"}; return msg;

Let me know if you need any more help with this.

nodered

ril3y commented 4 years ago

Thanks! I was really close. One more thing. Is there a way to do multiple blocks on 1 api call? I have a button i press and I want to ban my kids devices. What do you think the best way to go about this is? I am still a bit new to node-red.

Thanks for the help.

Riley

On Wed, Mar 18, 2020 at 4:58 AM Kristoffer Isaksson < notifications@github.com> wrote:

Hello. This is an example that I have for the Command disableWLan

Add a function node and the below code to trigger the command disableWLan.

msg.payload = {command:"disableWLan",wlan_id:"5a5a6860e4b073cbb84a0a45",disable:true}; return msg;

In your case you will check the information about the command Block Client Block Client { command: "blockClient", mac: "client MAC address" }

And then you will create a function node with this code msg.payload = {command:"blockClient",mac:"clientmac"}; return msg;

Let me know if you need any more help with this.

[image: nodered] https://user-images.githubusercontent.com/4119080/76943018-f59e5e00-68fe-11ea-8422-c2a85b8ab670.PNG

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Isaksson/node-red-contrib-unifi/issues/21#issuecomment-600501064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABYSM5ZE7OEDAY2MEV634LRICELZANCNFSM4LOAA5DQ .

Isaksson commented 4 years ago

Its not possible to make multiple block on same call. But you could add multiple Function nodes with one device in each node and connect them to the same Unifi node and trigger the Function nodes at the same time (dont know what you use to trigger them) You could also make one Function node with multiple outputs, one output / device you will block and connect them to the Unifi node.

ril3y commented 4 years ago

This is still not working. What do you set the dropdown to in the unifi gui block? I leave it on siteStats then adjust the playload like you did above. All i get on debug is sitestats and no blocked clients.

Any ideas?

On Wed, Mar 18, 2020 at 10:47 AM Riley Porter rileyporter@gmail.com wrote:

Thanks! I was really close. One more thing. Is there a way to do multiple blocks on 1 api call? I have a button i press and I want to ban my kids devices. What do you think the best way to go about this is? I am still a bit new to node-red.

Thanks for the help.

Riley

On Wed, Mar 18, 2020 at 4:58 AM Kristoffer Isaksson < notifications@github.com> wrote:

Hello. This is an example that I have for the Command disableWLan

Add a function node and the below code to trigger the command disableWLan.

msg.payload = {command:"disableWLan",wlan_id:"5a5a6860e4b073cbb84a0a45",disable:true}; return msg;

In your case you will check the information about the command Block Client Block Client { command: "blockClient", mac: "client MAC address" }

And then you will create a function node with this code msg.payload = {command:"blockClient",mac:"clientmac"}; return msg;

Let me know if you need any more help with this.

[image: nodered] https://user-images.githubusercontent.com/4119080/76943018-f59e5e00-68fe-11ea-8422-c2a85b8ab670.PNG

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Isaksson/node-red-contrib-unifi/issues/21#issuecomment-600501064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABYSM5ZE7OEDAY2MEV634LRICELZANCNFSM4LOAA5DQ .

Isaksson commented 4 years ago

It does not matter what you select on the dropdown, when you send a command it will pick that command instead of the one from the dropdown.

Could you please paste what you use in the Function node.

Isaksson commented 4 years ago

Do you still struggle with this?