You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For more info on available MQTT commands see the 'MQTT Bridge' section below.
178
+
179
+
180
+
MQTT bridge
181
+
-----------
182
+
183
+
### Advertising
155
184
156
-
Useful MQTT advertising parts are:
185
+
Data that is received via bluetooth advertising will be relayed over MQTT in the following format:
157
186
158
187
*`/ble/presence/DEVICE` - 1 or 0 depending on whether device has been seen or not
159
188
*`/ble/advertise/DEVICE` - JSON for device's broadcast name, rssi and manufacturer-specific data
160
-
*`/ble/advertise/DEVICE/manufacturer/COMPANY` - Manufacturer-specific data (without leading company code)
189
+
*`/ble/advertise/DEVICE/manufacturer/COMPANY` - Manufacturer-specific data (without leading company code) encoded in base16. To decode use `var data = Buffer.from(msg.payload, 'hex');`
161
190
*`/ble/advertise/DEVICE/rssi` - Device signal strength
162
191
*`/ble/advertise/DEVICE/SERVICE` - Raw service data (as a JSON Array of bytes)
163
-
*`/ble/advertise/DEVICE/PRETTY` or `/ble/PRETTY/DEVICE` - Decoded service data. `temp` is the obvious one
164
-
165
-
To decode the hex-encoded manufacturer-specific data, try:
192
+
*`/ble/advertise/DEVICE/PRETTY` or `/ble/PRETTY/DEVICE` - Decoded service data based on the decoding in `attributes.js`
193
+
*`1809` decodes to `temp` (Temperature in C)
194
+
*`180f` decodes to `battery`
195
+
*`feaa` decodes to `url` (Eddystone)
196
+
*`2a6d` decodes to `pressure` (Pressure in pa)
197
+
*`2a6e` decodes to `temp` (Temperature in C)
198
+
*`2a6f` decodes to `humidity` (Humidity in %)
199
+
*`ffff` decodes to `data` (This is not a standard - however it's useful for debugging or quick tests)
200
+
*`/ble/advertise/DEVICE/espruino` - If manufacturer data is broadcast Espruino's manufacturer ID `0x0590`**and** it is valid JSON, it is rebroadcast. If an object like `{"a":5,"b":10}` is sent, `/ble/advertise/DEVICE/a` and `/ble/advertise/DEVICE/b` will also be sent.
201
+
202
+
You can take advantage of Espruino's manufacturer ID `0x0590` to relay JSON over
203
+
Bluetooth LE advertising using the following code on an Espruino board:
166
204
167
205
```
168
-
var data = Buffer.from(msg.payload.manufacturerData, 'hex');
0 commit comments