I'd like to introduce you to Waylay, an external data routing service that makes "things" smarter than ever.
Data sharing and visualization are critical components of the IoT. The Blues Notecard is a great option for sending data via cellular directly to Notehub, which is a secure cloud service from Blues. The Blues Notehub allows for routing of Notecard data to external systems:
Use this tutorial to learn more about Notehub data routing.
While we can get the data from Notehub via routes, the data is raw, so we need a broker to visualize it. Depending on the provider, we can visualize the data in many different ways. Waylay is an option that is a bit different from other providers.
What is Waylay?
Waylay is a simple IoT automator that can get data from a physical device or software connectors, and it can help us to visualize data feeds.
While it's similar to other IoT platforms, in Waylay we have access to additional features. Here is a simple walkthrough:
- Data Connector: A data connector defines where the IoT data comes from. Using Waylay, you can get data from many different endpoints, including sensors, software systems, and other devices.
- Automation Editor: This allows us to create our action trigger system based on incoming data.
- Waylay Storage: Waylay comes with a built-in data storage unit. Your data can be saved directly into Waylay's storage bucket.
- BYOML (Bring Your ModeL): This feature allows you to run Machine Learning or other data science models within the Waylay platform.
- Waylay Dashboard: The Waylay Dashboard provides a clean and simple UI to display real-time data through a set of widgets.
Let's look at how we can integrate Waylay with the Blues Notehub.
Connect Notehub to Waylay
Create a new user account on Waylay. Then we have to associate Data Resources with a particular customer name (customer name is metadata here, which helps us to develop a dashboard).
Next, we'll add Webscripts that access our Notehub through an http/https endpoint for data. Add a new Webscript by selecting it from the main menu. Add the following code to the body, giving it the name "Get-Note":
async function handleRequest (req, res) {
if (!req. body) {
// No body found
return
}
// Parse body if needed
let payload = req.body
if (typeof payload === 'string' || payload instanceof String)
payload = JSON.parse(payload)
/*
You can do some processing of the payload over here.
*/
// Post values to our resource
waylay.data.baseUrl = 'https://data-io.waylay.io'
await waylay.data.postSeries('replace_with_resource_id', payload, { store: true, forward: true })
.catch(e => console.error(e.message))
res.sendStatus(200)
}
This block of code will receive a routed event from Notehub.
Copy and paste that Webscript's URL into a new Notehub "General HTTP/HTTPS Request/Response" route:
Now, let's simulate sending some Notecard data from the Notecard Simulator:
Now, keep an eye on the data log from Waylay's resource page:
Implementing a Rules Engine in Waylay
The Waylay Rules Engine is made up of many plugs (e.g. sensors or actuators) and the inference engine:
- Sensors: Software-defined sensors can collect data from both physical sensors and databases or APIs.
- Actuators: Software-defined actuators that can perform a variety of tasks such as sending messages, emails, and so on.
- Inference Engine: When a sensor is executed, the Rules Engine infers the outcome, which might lead to the invocation of other sensors or actuators.
The following is an example rule engine template. Depending on your application, you can add as many as you desire.
To add a new rule and trigger condition, navigate to the Templates area in your user console and click the Add Template button. Alarms are a handy tool that allows you to examine or monitor abnormalities and alerts based on data.
To create a basic alarm flow, we will be adding the necessary blocks from the blocks menu and then configure them.
-
Add a Stream block, uncheck execute on tick and check to execute on data, then select your resource of choice.
-
Add a Condition block, uncheck execute on tick and check to execute on data, then select your resource of choice. In the condition field, write up the condition in the following format
${nodes.stream_1.rawData.stream.replace_metric}
-
Add an alarm block and insert a trigger condition as you want. Our condition looks like this:
${nodes.stream_1.rawData.stream.temp} > 30
-
Then select the alarm type (CRITICAL, MAJOR, MINOR, or WARNING), and create an alarm type. When you debug, it will display the live data flow.
Consult the Waylay documentation for additional information.
-
Once your Notehub data is in the Waylay log, go to the Task window and create a new task using the templates you just generated.
-
The next step is to design some charts to display the data. Go to the explore window and add some charts.
Now that we have a visual display in our console, let's build a dashboard for an even better view of data.
Creating a Waylay Dashboard
-
Head to the Waylay Dashboard and log in.
-
Start a new organization by clicking the plus symbol
(+)
. When creating your Resource, you must have used the same customer name as the name of the company. -
Create a new application dashboard by selecting log in as admin. Then, by clicking the Plus icon, make a new dashboard and user group.
-
Next, navigate to the Config page and add a new device (select the correct device resource). Click the Add Device button.
-
After adding the device, enter the Graph window and create various gauges and charts based on your data requirements.
Choose the widget type, add information, and then pick the widget attributes by clicking the Plus icon.
Waylay also allows you to share your dashboards using the public dashboard function. It allows you to easily share Notecard data with others.
Here is my example public dashboard:
Conclusion
Data sharing and visualization are dominating the IoT and Waylay provides several unique capabilities and options for improved data routing. We can take Cellular IoT with Blues to the next level with the assistance of Waylay.