forked from Isaksson/node-red-contrib-unifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunifi.html
118 lines (114 loc) · 7.21 KB
/
unifi.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<script type="text/javascript">
RED.nodes.registerType('Unifi',{
category: 'output',
color: '#C0DEED',
defaults: {
name: {value:""},
ip: {value:""},
port: {value:8443, validate:RED.validators.number()},
site: {value:"default"},
command: {value:1, required: true },
unifios: {value:false},
},
credentials: {
username: {type:"text"},
password: {type:"password"}
},
inputs:1,
outputs:1,
icon: "bridge.png",
label: function() {
return this.name||"Unifi";
}
});
</script>
<script type="text/x-red" data-template-name="Unifi">
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-ip"><i class="fa fa-globe"></i> Server</label>
<input class="input-append-left" type="text" id="node-input-ip" placeholder="IP Address" style="width: 40%;" >
<label for="node-input-port" style="margin-left: 10px; width: 35px; "> Port</label>
<input type="text" id="node-input-port" placeholder="Port" style="width:45px">
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-input-unifios" placeholder="Unifi OS" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-unifios" style="width: 70%;">Unifi OS</label>
</div>
<div class="form-row">
<label for="node-input-site"><i class="fa fa-list"></i> Site</label>
<input type="text" id="node-input-site" placeholder="Site Name">
</div>
<div class="form-row">
<label for="node-input-username"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-input-username" placeholder="Username">
</div>
<div class="form-row">
<label for="node-input-password"><i class="fa fa-lock"></i> Password</label>
<input type="password" id="node-input-password" placeholder="Password">
</div>
<div class="form-row">
<label for="node-input-command"><i class="fa fa-dot-circle-o"></i> Command</label>
<select id="node-input-command">
<option value="1">SitesStats</option>
<option value="10">SiteSysinfo</option>
<option value="20">ClientDevices</option>
<option value="30">AllUsers</option>
<option value="40">UserGroups</option>
<option value="50">Health</option>
<option value="60">Dashboard</option>
<option value="70">AccessDevices</option>
<option value="80">RogueAccessPoints</option>
<option value="90">Events</option>
<option value="100">Alarms</option>
<option value="110">WLanSettings</option>
<option value="120">ListPortProfiles</option>
</div>
</script>
<script type="text/x-red" data-help-name="Unifi">
<p>Connects to a Unifi Controller and query/control UniFi devices.</p>
<p><code>msg.payload.command</code> is used to override the command selected in the node.<br> Example how to send a command from a function Node<br> <code>msg.payload = { command: "ClientDevices"};</code></p>
<p>Available Commands:</p>
<ul>
<li><code>SitesStats</code> : Site stats</li>
<li><code>SiteSysinfo</code> : Site sysinfo</li>
<li><code>ClientDevices</code> : Online client device(s)</li>
<li><code>AllUsers</code> : All client devices ever connected to the site</li>
<li><code>UserGroups</code> : User groups</li>
<li><code>Health</code> : Health metrics</li>
<li><code>Dashboard</code> : Dashboard metrics</li>
<li><code>AccessDevices</code> : Access points</li>
<li><code>RogueAccessPoints</code> : Rogue access points</li>
<li><code>Events</code> : Events</li>
<li><code>Alarms</code> : Alarms</li>
<li><code>WLanSettings</code> : WLan Settings</li>
<li><code>ListPortProfiles</code> : List Port Profiles</li>
</ul>
<p>Special Commands: (No GUI)</p>
<li><code>DisableWLan</code> : Disable/Enable WLan { command: "disableWLan", wlan_id: "use _id from command WLanSettings", disable: true }</li>
<li><code>blockClient</code> : Block Client { command: "blockClient", mac: "client MAC address" }</li>
<li><code>unblockClient</code> : Unblock Client { command: "unblockClient", mac: "client MAC address" }</li>
<li><code>reconnectClient</code> : Reconnect Client { command: "reconnectClient", mac: "client MAC address" }</li>
<li><code>authorizeGuest</code> : Authorize Client { command: "authorizeGuest", mac: "client MAC address", minutes: "minutes until authorization expires" }</li>
<li><code>unauthorizeGuest</code> : Unauthorize Client { command: "unauthorizeGuest", mac: "client MAC address" }</li>
<li><code>restartAP</code> : Reboot an Access point { command: "restartAP", mac: "device MAC address" }</li>
<li><code>enableAP</code> : Enable an Access point { command: "enableAP", device_id: "24 char device id" }</li>
<li><code>disableAP</code> : Disable an Access point { command: "disableAP", device_id: "24 char device id" }</li>
<li><code>setAPLed</code> : Set LED for Access point { command: "setapled", device_id: "24 char device id", mode: "off/on/default" }</li>
<li><code>setSiteLed</code> : Set LED for Site { command: "setsiteled", mode: true/false }</li>
<li><code>site</code> : Connect to site name { site: "site name"}</li>
<li><code>getFirewallGroups</code> : Get list of firewall groups { command: "getFirewallGroups" }</li>
<li><code>addFirewallGroup</code> : Add firewall group { command: "addFirewallGroup", group_name: "group-name", group_type: "address-group|ipv6-address-group|port-group", group_members: ["CIDRs", "IPs"] }</li>
<li><code>editFirewallGroup</code> : Edit firewall group { command: "editFirewallGroup", group_id: "group id", group_name: "group-name", group_type: "address-group|ipv6-address-group|port-group", group_members: ["CIDRs", "IPs"] }</li>
<li><code>deleteFirewallGroup</code> : Delete firewall group { command: "deleteFirewallGroup", group_id: "group id" }</li>
<li><code>forceProvision</code> : Force provision { command: "forceProvision", mac: "device MAC address" }</li>
<li><code>setPortProfiles</code> : setPortProfiles: Set overrides for multiple ports of a device { command: "setPortProfiles", device_id: "24 char device id", port_overrides: [ {"port_idx": 1, "portconf_id": "id of the port profile", "name": "friendly name of the port", "poe_mode": "off|auto" }, ... ] }</li>
<li><code>setLocate</code> : Enable flash device LED (or other indication based on device) { command: "setLocate", mac: "device MAC address" }</li>
<li><code>unsetLocate</code> : Disable flash device LED (or other indication based on device) { command: "unsetLocate", mac: "device MAC address" }</li>
<p>Returns all data in JSON parsable strings/objects</p>
<p>For more information see the <a href="https://github.com/Isaksson/node-red-contrib-unifi" target="_blank">GitHub</a> site.</p>
<p>Version 0.1.16</p>
</script>