Wiki source code of Losant

Version 24.7 by Xiaoling on 2023/04/11 08:53

Hide last authors
Xiaoling 23.2 1 **Table of Contents:**
2
3 {{toc/}}
4
5
Xiaoling 8.2 6 = 1.  Indoor Tracking Examples base on iBeacon =
7
Xiaoling 23.5 8 == 1.1  Create a Losant Webhook ==
Xiaoling 23.2 9
Xiaoling 8.2 10
11 If you do not have a Losant Account, you can sign up for a free [[Losant Developer Sandbox>>url:https://www.losant.com/iot-platform/sandbox]] account. Once you have an account, [[create a new application>>url:https://docs.losant.com/applications/overview/#creating-applications]]. You can start from a blank application or from a [[Losant Application Template>>url:https://docs.losant.com/templates/overview/]], like [[The Things Network Application Template>>url:https://docs.losant.com/templates/the-things-network/]].
12
Xiaoling 24.2 13 Once you've created a new application, click (% style="color:blue" %)**Webhooks** (%%)and then (% style="color:blue" %)**Add Webhook**.
Xiaoling 8.2 14
Xiaoling 24.4 15
Xiaoling 8.2 16 [[image:image-20220905084626-2.png]]
17
18
19
Xiaoling 24.2 20 Enter a (% style="color:blue" %)**Webhook Name**(%%) and then click (% style="color:blue" %)**Create Webhook**(%%). You may also enter a username and password to use Basic Auth. If you use Basic Auth, you will need to [[edit your Losant Webhook in TTS>>url:https://docs.losant.com/guides/how-to-integrate-with-the-things-stack/#editing-your-losant-webhook-in-tts]].
Xiaoling 23.2 21
Xiaoling 24.4 22
Xiaoling 8.2 23 [[image:image-20220905084724-3.png]]
24
25
Xiaoling 23.2 26
Xiaoling 8.2 27 Once the Webhook is created, copy the unique identifier from the URL that comes after [[https:~~/~~/triggers.losant.com/webhooks/.>>url:https://triggers.losant.com/webhooks/]]
28
Xiaoling 23.2 29
Xiaoling 8.2 30 [[image:image-20220905084736-4.png]]
31
32
Xiaoling 23.5 33 == 1.2  Configure TTS to Use the Losant Webhook ==
Xiaoling 8.2 34
35
Xiaoling 24.2 36 In the TTS application , click on (% style="color:blue" %)**Integrations**(%%), then (% style="color:blue" %)**Webhooks**(%%), and then (% style="color:blue" %)**Add webhook**.
Xiaoling 8.2 37
Xiaoling 24.4 38
Xiaoling 8.2 39 [[image:image-20220905084816-5.png]]
40
41
42
Xiaoling 24.2 43 Click on the [[Losant Webhook>>url:https://www.thethingsindustries.com/docs/integrations/cloud-integrations/losant/]] tile. If you are using Basic Auth for this Webhook or need to subscribe to more than just (% style="color:blue" %)**uplink**(%%) messages, then please review the end of this How-To Guide in the section named [[Editing Your Losant Webhook in TTS>>url:https://docs.losant.com/guides/how-to-integrate-with-the-things-stack/#editing-your-losant-webhook-in-tts]].
Xiaoling 23.2 44
Xiaoling 24.4 45
Xiaoling 8.2 46 [[image:image-20220905084846-6.png]]
47
48
49 Enter the following information into the Losant Webhook configuration:
50
Xiaoling 24.2 51 * (% style="color:blue" %)**Webhook ID:**(%%) Make up any name that you would like. This does not have to be the ID of the webhook as it is stored in Losant.
52 * (% style="color:blue" %)**Unique ID of Losant Webhook URL:**(%%) This is the Losant Webhook unique ID that was copied to the clipboard in LOSANT Webhooks.
Xiaoling 8.2 53
54
Xiaoling 24.5 55 Finally, click (% style="color:blue" %)**Create Losant webhook**(%%). If you need to configure additional options ((% style="color:red" %)e.g. Basic Auth or additional messages to subscribe to(%%)), use the TTS Custom Webhook Template or add these options once the Webhook in TTS is created by following the last section of this guide, [[Editing Your Losant Webhook in TTS>>url:https://docs.losant.com/guides/how-to-integrate-with-the-things-stack/#editing-your-losant-webhook-in-tts]].
56
57
Xiaoling 8.2 58 [[image:image-20220905084936-7.png]]
59
60
Xiaoling 23.5 61 == 1.3  Create a Losant Application Workflow to Receive Data from the LoRaWAN Sensor and Confirm Data Flow to Losant via Uplinks ==
Xiaoling 8.2 62
Xiaoling 22.2 63
Xiaoling 23.2 64 Since TTS is now configured to forward data to the Losant Webhook, let's create a [[Losant Application Workflow>>url:https://docs.losant.com/workflows/application-workflows/]] to receive the data from TTS.
Xiaoling 8.2 65
Xiaoling 24.2 66 Click on (% style="color:blue" %)**Workflows**(%%) and then in the Application Workflow section, click (% style="color:blue" %)**Add** (%%)to create a new Application Workflow.
Xiaoling 8.2 67
Xiaoling 24.2 68
Xiaoling 22.2 69 [[image:image-20220905085017-8.png]]
70
Xiaoling 8.2 71
Xiaoling 24.2 72 Enter a name for your Application Workflow (as well as a description if you'd like) and click (% style="color:blue" %)**Create Workflow**.
Xiaoling 22.2 73
Xiaoling 24.5 74
Xiaoling 23.2 75 [[image:image-20220905091131-22.png]]
Xiaoling 8.2 76
Xiaoling 23.2 77
Xiaoling 24.2 78 Drag and drop the [[Webhook Trigger Node>>url:https://docs.losant.com/workflows/triggers/webhook/]] and the [[Debug Node>>url:https://docs.losant.com/workflows/outputs/debug/]] onto the visual workflow engine's canvas and connect them together. If you have only one webhook in this Losant application, it will be automatically selected for the Webhook Trigger. If you have multiple webhooks, select the one that was created in Webhook. Next, click (% style="color:blue" %)**Save and Deploy**(%%). Now that this workflow is deployed, click on the [[Debug Panel>>url:https://docs.losant.com/workflows/debugging-workflows/#debug-node-messages]].
Xiaoling 23.2 79
Xiaoling 24.4 80
Xiaoling 22.2 81 [[image:image-20220905085051-10.png]]
82
Xiaoling 8.2 83
84 When TTS receives new data from the sensor, it will send that data to Losant over the Losant Webhook and trigger this workflow. Each time this workflow runs, new data will be displayed in the Debug Panel as shown below.
85
86
Xiaoling 24.2 87 (% style="color:red" %)**Note:**(%%) If TTS is not automatically decoding your data as shown below in(% style="color:blue" %)** data.body.uplink_message.decoded_payload**(%%), then you can decode your LoRaWAN device data in this Losant Application Workflow. Check out the blog post [[How To Decode and Visualize Your LoRaWAN Sensor Data Using TTS and Losant>>url:https://www.losant.com/blog/how-to-decode-and-visualize-your-lorawan-sensor-data-using-the-things-network-and-losant]] to learn more about decoding LoRaWAN data in Losant.
Xiaoling 23.2 88
Xiaoling 24.2 89
Xiaoling 22.2 90 [[image:image-20220905085115-11.png]]
91
92
Xiaoling 23.5 93 == 1.4  Create a device ==
Xiaoling 8.2 94
Xiaoling 22.2 95
96 [[image:image-20220905085132-12.png]]
97
98
Xiaoling 24.7 99
Xiaoling 24.6 100 **Select the appropriate equipment. In this example, select a Standalone equipment**
Xiaoling 8.2 101
Xiaoling 22.2 102 [[image:image-20220905085201-13.png]]
103
Xiaoling 8.2 104
Xiaoling 23.2 105
Xiaoling 24.6 106 **Name is required, others can be added later**
Xiaoling 23.2 107
Xiaoling 8.2 108
Xiaoling 22.2 109 [[image:image-20220905085219-14.png]]
110
Xiaoling 8.2 111
Xiaoling 24.6 112 **Add equipment in the workflow so that data can flow to the equipment**
Xiaoling 23.2 113
Xiaoling 22.2 114 [[image:image-20220905085236-15.png]]
115
Xiaoling 8.2 116
Xiaoling 23.2 117
Xiaoling 24.6 118 **Refer to the data in debug and add parameters to the device.**
Xiaoling 23.2 119
120 [[image:image-20220905085253-16.png]]
Xiaoling 22.2 121
122
Xiaoling 23.2 123
Xiaoling 24.6 124 **Create a new dashboard.**
Xiaoling 8.2 125
Xiaoling 22.2 126
Xiaoling 24.2 127 [[image:image-20220905085323-17.png]]
Xiaoling 8.2 128
Xiaoling 22.2 129
Xiaoling 23.2 130
Xiaoling 24.2 131 [[image:image-20220905110438-1.png]]
Xiaoling 23.2 132
133
134
Xiaoling 8.2 135
Xiaoling 24.3 136 Select the appropriate template.
137
138
Xiaoling 22.2 139 [[image:image-20220905085355-19.png]]
140
Xiaoling 8.2 141
Xiaoling 23.2 142
143
Xiaoling 24.3 144 Set beacon and position.
Xiaoling 23.2 145
Xiaoling 8.2 146
Xiaoling 22.2 147 [[image:image-20220905085417-20.png]]
148
149
150
151 [[image:image-20220905085437-21.png]]
152
Xiaoling 8.2 153
154
Xiaoling 24.3 155