aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2016-08-16 20:47:02 -0700
committerMike Crute <mcrute@gmail.com>2016-08-16 20:47:02 -0700
commit31a86f84ea63d38e31421619a351009804f9b264 (patch)
tree2d5f0ff42fb4ecf356012dbbfa5cf46a2bd44e18
parent50139f4f0a5c97102c360493a4622679209cb1e4 (diff)
downloadubntmfi-31a86f84ea63d38e31421619a351009804f9b264.tar.bz2
ubntmfi-31a86f84ea63d38e31421619a351009804f9b264.tar.xz
ubntmfi-31a86f84ea63d38e31421619a351009804f9b264.zip
Update formatting and clarify docs
-rw-r--r--inform_protocol.md196
1 files changed, 101 insertions, 95 deletions
diff --git a/inform_protocol.md b/inform_protocol.md
index f6f8a8b..65e41bf 100644
--- a/inform_protocol.md
+++ b/inform_protocol.md
@@ -19,16 +19,16 @@ continues until the controller sends the next noop response. Responses never
19appear to contain multiple commands. 19appear to contain multiple commands.
20 20
21## Raw Packet Structure 21## Raw Packet Structure
22| Size | Purpose | Data Type | 22| Size | Purpose | Data Type |
23| -------- | --------------------- | --------- | 23| -------- | ------------------------- | --------- |
24| 4 bytes | magic number | integer | 24| 4 bytes | magic number | integer |
25| 4 bytes | version | integer | 25| 4 bytes | version | integer |
26| 6 bytes | hwaddr | string | 26| 6 bytes | mac address | string |
27| 2 bytes | flags | short | 27| 2 bytes | flags | short |
28| 16 bytes | initialization vector | string | 28| 16 bytes | AES initialization vector | string |
29| 4 bytes | data version | integer | 29| 4 bytes | data version | integer |
30| 4 bytes | data length | integer | 30| 4 bytes | data length | integer |
31| n bytes | AES encrypted payload | string | 31| n bytes | AES encrypted payload | string |
32 32
33## Raw Packet Constraints 33## Raw Packet Constraints
34* magic must == `1414414933` (TNBU) 34* magic must == `1414414933` (TNBU)
@@ -57,7 +57,8 @@ Output payloads are those that originate from the controller and are bound for
57the device. These always appear to contain a \_type field. I have observed the 57the device. These always appear to contain a \_type field. I have observed the
58following output payloads. 58following output payloads.
59 59
60 _type: firmware upgrade (upgrade) 60### Firmware Upgrade
61 _type: upgrade
61 url: full url to firmware.bin 62 url: full url to firmware.bin
62 datetime: rfc3339 formatted date, server time 63 datetime: rfc3339 formatted date, server time
63 server_time_in_utc: server time in UTC as a unix timestamp (string) 64 server_time_in_utc: server time in UTC as a unix timestamp (string)
@@ -66,7 +67,8 @@ following output payloads.
66 _id: unknown id string (5232701de4b0457a2f2f031f) 67 _id: unknown id string (5232701de4b0457a2f2f031f)
67 device_id: device ID from mongodb 68 device_id: device ID from mongodb
68 69
69 _type: config update (setparam) 70### Config Update
71 _type: setparam
70 port_cfg: configuration for ports as string 72 port_cfg: configuration for ports as string
71 analog_cfg: analog port config (empty for mPower) 73 analog_cfg: analog port config (empty for mPower)
72 authorized_guests: authorized guests file (empty) 74 authorized_guests: authorized guests file (empty)
@@ -77,14 +79,18 @@ following output payloads.
77 system_cfg: system config file 79 system_cfg: system config file
78 server_time_in_utc: server time in UTC as a unix timestamp (string) 80 server_time_in_utc: server time in UTC as a unix timestamp (string)
79 81
80 _type: reboot (reboot) 82### Reboot
83 _type: reboot
81 datetime: rfc3339 formatted date, server time 84 datetime: rfc3339 formatted date, server time
82 device_id: device ID from mongodb 85 device_id: device ID from mongodb
83 86
84 _type: heartbeat (noop) 87### Heartbeat / No-Op
88 _type: noop
85 interval: next checkin time in seconds (integer) 89 interval: next checkin time in seconds (integer)
90 server_time_in_utc: server time in UTC as a unix timestamp (string)
86 91
87 _type: command (cmd) 92### Command
93 _type: cmd
88 _admin: admin data object 94 _admin: admin data object
89 _id: mongodb id of admin 95 _id: mongodb id of admin
90 lang: admin language (en_US) 96 lang: admin language (en_US)
@@ -115,93 +121,93 @@ appears that mFi is just using the Unfi firmware and has hacked it a bit for
115their use-case so most of the fields outside of alarm are not relevant to the 121their use-case so most of the fields outside of alarm are not relevant to the
116mFi use-case. 122mFi use-case.
117 123
118 callback from device: javascript object 124 alarm: list of sensors
119 alarm: list of sensors 125 index: port name
120 index: port name 126 sId: sensor ID hash
121 sId: sensor ID hash 127 time: device time
122 time: device time 128
129 // For mPort Only
130 tag: kind of reading presented (magnetic, temperature, humidity)
131 type: kind of device (input, analog, output)
132 val: value (float)
123 133
124 // For mPort Only 134 // For mPower Only
125 tag: kind of reading presented (magnetic, temperature, humidity) 135 entries: list of entry objects
126 type: kind of device (input, analog, output) 136 tag: kind of reading (output, pf, energy_sum, v_rms, i_rms, active_pwr)
137 type: sensor type (output, analog, rmsSum, rms)
127 val: value (float) 138 val: value (float)
128 139
129 // For mPower Only 140 if_table: list of interfaces and stats
130 entries: list of entry objects 141 ip: interface ip
131 tag: kind of reading (output, pf, energy_sum, v_rms, i_rms, active_pwr) 142 mac: interface mac address
132 type: sensor type (output, analog, rmsSum, rms) 143 name: interface device name (dev handle)
133 val: value (float) 144 rx_bytes: bytes received on the interface
134 145 rx_dropped: packets dropped by the interface
135 if_table: list of interfaces and stats 146 rx_errors: receive errors on the interface
136 ip: interface ip 147 rx_packets: packets received on the interface
137 mac: interface mac address 148 tx_bytes: bytes transmitted by the interface
138 name: interface device name (dev handle) 149 tx_dropped: trasmit drops on the interface
139 rx_bytes: bytes received on the interface 150 tx_errors: transmit errors on the interface
140 rx_dropped: packets dropped by the interface 151 tx_packets: number of packets transmitted by the interface
141 rx_errors: receive errors on the interface 152 type: appears to be the same as name
142 rx_packets: packets received on the interface 153
143 tx_bytes: bytes transmitted by the interface 154 radio_table: list of radios in the device
144 tx_dropped: trasmit drops on the interface 155 builtin_ant_gain: gain of builtin antenna
145 tx_errors: transmit errors on the interface 156 builtin_antenna: boolean, does device have antenna
146 tx_packets: number of packets transmitted by the interface 157 max_txpower: maximum transmit power
147 type: appears to be the same as name 158 name: name of radio
148 159 radio: radio type (ex: ng)
149 radio_table: list of radios in the device 160 scan_table: list, unknown
150 builtin_ant_gain: gain of builtin antenna 161
151 builtin_antenna: boolean, does device have antenna 162 vap_table: table of joined wireless networks
152 max_txpower: maximum transmit power 163 bssid: network SSID
153 name: name of radio 164 ccq: client connection qality
154 radio: radio type (ex: ng) 165 channel: channel number
155 scan_table: list, unknown 166 essid: network friendly name
156 167 id: mode? (ex: user)
157 vap_table: table of joined wireless networks 168 name: uplink device name
158 bssid: network SSID 169 num_sta: number of connected stations (always 0)
159 ccq: client connection qality 170 radio: radio type (ex: ng)
160 channel: channel number 171 rx_bytes: bytes received on the interface
161 essid: network friendly name 172 rx_dropped: packets dropped by the interface
162 id: mode? (ex: user) 173 rx_errors: receive errors on the interface
163 name: uplink device name 174 rx_packets: packets received on the interface
164 num_sta: number of connected stations (always 0) 175 tx_bytes: bytes transmitted by the interface
165 radio: radio type (ex: ng) 176 tx_dropped: trasmit drops on the interface
166 rx_bytes: bytes received on the interface 177 tx_errors: transmit errors on the interface
167 rx_dropped: packets dropped by the interface 178 tx_packets: number of packets transmitted by the interface
168 rx_errors: receive errors on the interface 179 rx_crypts: unknown
169 rx_packets: packets received on the interface 180 rx_frags: received fragmented packets
170 tx_bytes: bytes transmitted by the interface 181 rx_nwids: received network beacons
171 tx_dropped: trasmit drops on the interface 182 tx_power: transmitting power of the radio (assumed in dBm)
172 tx_errors: transmit errors on the interface 183 tx_retries: number of transmit retries on interface
173 tx_packets: number of packets transmitted by the interface 184 usage: same as id
174 rx_crypts: unknown 185
175 rx_frags: received fragmented packets 186 hostname: hostname of device ("ubnt" unless changed)
176 rx_nwids: received network beacons 187 ip: IP of device
177 tx_power: transmitting power of the radio (assumed in dBm) 188 mac: mac address of primary interface
178 tx_retries: number of transmit retries on interface 189 mfi: boolean, indicates if an mfi device
179 usage: same as id 190 model: device model name
180 191 model_display: display name for device
181 hostname: hostname of device ("ubnt" unless changed) 192 serial: device serial number
182 ip: IP of device 193 uptime: uptime in seconds since last reboot
183 mac: mac address of primary interface 194 version: firmware version
184 mfi: boolean, indicates if an mfi device 195 default: boolean, device is unconfigured
185 model: device model name 196 cfgversion: string, unknown (ex: c3846443e1b4860b)
186 model_display: display name for device 197 guest_token: string, unknown (ex: 364E8B215D16AB963A53232E3873000C)
187 serial: device serial number 198 inform_url: string, url to which the device is reporting
188 uptime: uptime in seconds since last reboot 199 isolated: boolean, can the device reach the rest of the network
189 version: firmware version 200 localversion: string, unknown (ex: ?)
190 default: boolean, device is unconfigured 201 locating: boolean, is the device in locating mode (blinking LED)
191 cfgversion: string, unknown (ex: c3846443e1b4860b) 202 portversion: string, unknown (ex: 443eb55240f26367)
192 guest_token: string, unknown (ex: 364E8B215D16AB963A53232E3873000C) 203 time: integer, device time as unix timestamp
193 inform_url: string, url to which the device is reporting 204 trackable: boolean as string, unknown
194 isolated: boolean, can the device reach the rest of the network 205 uplink: string, unix device name (dev handle) of the primary uplink device
195 localversion: string, unknown (ex: ?)
196 locating: boolean, is the device in locating mode (blinking LED)
197 portversion: string, unknown (ex: 443eb55240f26367)
198 time: integer, device time as unix timestamp
199 trackable: boolean as string, unknown
200 uplink: string, unix device name (dev handle) of the primary uplink device
201 206
202 207
203## Config Samples 208## Config Samples
204These are some observed configuration payloads for the configuration packets. 209These are some observed configuration payloads for the configuration packets.
210In their json form it is a single line string with newlines encoded as `\n`.
205 211
206### mgmt cfg 212### mgmt cfg
207 mgmt.is_default=false 213 mgmt.is_default=false