This guide provides step-by-step guide on the initial Wirepas setup process with HiveMQ MQTT broker and MQTTX client .
Note: This guide covers receiving data from the network, not positioning.
In order to proceed, create a free account on HiveMQ and setup a Cloud Cluster with Authentication credentials . A Step by step guide is available on the platform itself. This will provide a free limited MQTT broker to send data to.
Power on the gateway. Wifi LED should be blinking white. If gateway is already configured, you might need to reset it. Use the button on the side of the device:
1. On your PC or mobile device navigate to Wifi settings and check visible Wifi networks. Find the tinygateway-cd0d (name might be different).
2. Connect to the network. Password is tinygateway .
3. On your browser navigate to 192.168.4.1 and enter password blueup .
You are now connected to the gateway and can change its settings.
For the gateway to work with WNT, the following changes need to be made.
1. Go to Configuration – Wifi.
2. Change Mode from Access Point to Station.
3. Click the symbol under SSID and a list of visible Wifi networks will appear. Choose your Wifi network.
4. Enter password for the Wifi network and press Save .
5. Once a reboot banner appears, select Reboot now .
Gateway will then attempt to connect to the specified Wifi. The PC or mobile device should also automatically connect to the same Wifi network (depending on device used and its configuration). No changes should be required in order to make changes to your PC Wifi settings.
Once logged back in the gateway, under Sink configuration no changes need to be made if gateway is from Teltonika Demo kit. Settings should look like in the image provided below. If gateway was already reset, you might need to configure as per below image (for the Demo kit).
Save the settings if changed and reboot when prompted.
1. Under MQTT settings, click the checkmark next to Disabled.
This allows to configure MQTT URI and other settings.
2. Change the Uri from mqtt:// to mqtts:// by pressing here –
3. Enter the URL from HiveMQ service (image from HiveMQ platform below for reference). Change port to 8883 .
4. Select Advanced Settings and change Date Encoding to JSON.
5. Click the checkbox next to Use credentials and enter Username and Password as it is setup on HiveMQ (on HiveMQ platform navigate to your created cluster - Access Management – Authentication ).
6. Click the Cloud download button to download CA Certificate automatically.
7. After the certificate is downloaded press the Save button and then Reboot now at the top.
Once reconnected, in the Device tab you should see 4 green ticks indicating that gateway configuration is complete and it can reach the MQTT broker.
You can also check the Nodes section to see that live data is coming through the gateway.
Gateway setup is complete. These settings will remain active, unless they are reset using the physical reset button.
Use build in Web Client on the HiveMQ platform to view all live data coming to the broker.
Alternatively, you can use any MQTT client or Local MQTTX client to connect and subscribe to all topics.
1. Connect to MQTT broker as per HiveMQ credentials (same ones that were used for the gateway)
2. Subscribe to all (#) or relevant topics:
Note: The provided topics are just an example and are not universal. Please follow this structure for topic subscription:
3. A script can be used to parse the received data. Go to Script and paste provided script example.
4. Save and name the script.
5. On Connection screen, press the three dots and select Run Script .
6. Choose Applied to - Received messages, Function – script name and press confirm .
Now all incoming messages should be in a readable and understandable format.
There are different types of messages that are being received.
Example TLV (Type – Length – Value) 238/238 message – Parsing standard 238/238 endpoint for Rssi and battery info
47 11 05 1e 43 9e 89 00 80 31 9f 89 00 7a 7e 9e 89 00 84 25 00 00 00 68 48 9f 89 00 74 3e 9f 89 00 74 04 02 b7 0b 06 0a 3c 00 00 00 11 00 00 00 01 ff
47 11 – message header, sequence number incremented with every packet sent by this node.
05 – type 0x05 = Tag RSSI measurement
1e – length – 30 bytes
43 9e 89 00 – neighbor 1 (00 89 9e 43 hex -> 9018947 dec)
80 – RSSI (value x -0.5) -> -64 dBm
31 9f 89 00 – neighbor 2 9019185
7e 9e 89 00 – neighbor 3 9019006
25 00 00 00 – neighbor 4 37 (sink)
48 9f 89 00 – neighbor 5 9019208
3e 9f 89 00 – neighbor 6 9019198
04 – type 0x04 = Battery voltage
02 – length - 2 bytes
b7 0b – battery voltage 0b b7 hex -> 2999 mV dec
06 0a 3c 00 00 00 11 00 00 00 01 ff – reserved, Wirepas internal use.
Example of 11/11 TLV packet (sensor data) Parsing Custom 11/11 endpoint for Sensors data
01 02 48 11 02 04 3b 09 00 00 03 04 f6 93 00 00 05 04 00 01 00 00 06 04 90 fb ff ff 07 04 c0 fa ff ff 08 02 08 00 09 02 74 ff 0a 01 00
01 – type 0x01 – message counter
02 – length – 2 bytes
48 11 – message counter 11 48 hex -> 4424 dec
02 – type 0x02 - temperature
3b 09 00 00 – value 09 3b hex -> 2363 dec -> 23,63°
03 – type 0x03 humidity
f6 93 00 00 – 5287 – 52.87%
05 – type 0x05 Axl X
00 01 00 00 – 256 mG
06 – type 0x06 Axl Y
90 fb ff ff - -1136 mG
07 – type 0x07 Axl Z
c0 fa ff ff - -1344 mG
08 – type 0x08 pitch
0a – type 0x0a magnet status
00 – Boolean, not present
To send an app_config in JSON format, use the set_config command .
Press the green arrow button to publish the command and check topic json-gw-response/set_config/<gw_id>/<sink_id> for acknowledgement.
Note: For AppConfig payload structure refer to Wirepas positioning application manual .