Chatbots and Internet of Things with thethings.iO IoT platform

Most of the IoT projects where thethings.iO works today use a mobile application as a user interface. Some of these users are different actors of the project, can go from final clients to technicians or managers. That means that some of them don’t need any specific user experience, they just need an interface to interact with the connected devices. Ask questions, such as last values, change configurations, and offer a kind of a “bidirectional” communication.

At that moment, clients have different choices, build their own mobile application for each of the actors of the project, or just start prototyping these applications with a chatbot. And actually at thethings.iO we love chatbots. We think it’s a great tool to prototype apps and to get first insights from the actors of the project interacting with the connected things.

For that situation, we have created a chatbot framework with thethings.iO Cloud Code to enable our clients to use chatbot technology, such as Telegram and others coming soon, as the interface to talk with the connected things. And the results are great!

Telegram chatbot connected with thethings.iO

Telegram is an instant messaging platform that provides a lot of flexibility to developers. Telegram offers an easy way to create chatbots with an API integration. As we did in the past with Twilio, Mailchimp and others, we have integrated automagically Telegram with thethings.iO Cloud Code.

The Telegram + thethings.iO Cloud Code service let you send a Telegram message to a Telegram account using a Telegram Bot from thethings.iO. On of the most important requirements is that the user have to acknowledge, starting a conversation, to received a message from the bot. In some cases is not allowed to push information without this acknowledgement.

We have created a demo, so you can play with it on Cloud Code. So download the Telegram Instant Messaging application and search for the thethings.iO bot.

Get into the bot and click the button START on the bottom or just write /start.

At that point the thethings.iO Bot will send you a welcome message with a chat_id.

Every conversation between a user and a bot have a chat_id, it’s important that you can manage these chat_ids from Cloud Code in case you want to have more than one user. For this demo, we are only going to have one user. So we are going to copy and paste this chat_id into the Cloud Code code (Trigger).


function main(params, callback){
var chat_id = 12345;
var message = 'Hello world';

var options = {chat_id : chat_id, text: message};

telegram.sendMessage(options, function(err, result)
{
if(err) return callback(err)
callback(null, result)
})
}

In that case, every time we execute this Trigger we will send to the user a Hello World message.

That’s great right?!

In the previous example you are using thethings.iO Telegram bot. In case that you are building your own bot, find here the code to introduce your own custom_bot ID.


var chat_id = 12345;
var message = 'Hello world'
var custom_bot = 'abcdefghijklm'
var options = {chat_id : chat_id, text: message, custom_bot: custom_bot};

This is the first part of this tutorial. In next tutorials about chatbots and Internet of Things we will showcase how to manage multiple chat_ids of different users from the project into one thethings.iO Cloud Code function, among other features. And of course, expect other chatbot integrations. Anyway if you have a chatbot technology and you think it could be interesting to integrate it with thethings.iO, feel free to contact us!

Enjoy thethings.iO IoT Platform experience! Let’s stay connected

How to integrate Prometheus time series with thethings.iO IoT platform


Today we would like to explain how to integrate the Prometheus time series server and database with thethings.iO IoT platform using exclusively thethings.iO Cloud Code Functions and Triggers. Rendering real-time sensor data is not a problem with thethings.iO IoT platform but computing historical metrics – like how many times a button has been pressed within a certain time period – is a lot harder unless you are thethings.iO Cloud Code proficient. There is another possibility, so we shall use a time series database, Prometheus, to store time series data and compute time series metrics. Learn here more about Prometheus.

Assumes that you are using 4 things (e.g. wireless push buttons) connected to thethings.iO via the Sigfox IoT network. The 4 buttons make up a customer feedback survey panel, labelled as: Excellent, Good Job, Fair, Poor. Each button shall be connected to thethings.iO via the standard Sigfox callback provided by thethings.iO.

Prometheus system shall use the time series data to compute a new metric named button_presses_5m, which is the incremental number of button presses in the past 5 mins. The computed metric is pushed back into thethings.iO via a Cloud Code Function and stored in thethings.iO things resources that correspond to each of the four things in thethings.iO IoT platform. The computed metric is then rendered in a thethings.iO dashboard.

This demonstration uses Prometheus to compute a simple time series metric. Prometheus supports sophisticated time-series queries that have been used for monitoring highly complex computer networks in real time. Details on the advanced time series functions supported by Prometheus.

Find on thethings.iO github repository the code to replicate the integration among Prometheus time series and thethings.iO.

Benchmark IoT platforms for Sigfox products

Today we have the pleasure to publish an invited guest post made by a UPC student. Daniel Torán Mercadé was a student of the Department of Electronic Engineering at ETSEIB-UPC and he has been working on a master thesis named Comparison of different Internet of Things Platforms. Dani tested different IoT platforms such as AWS, IBM Watson IoT, Microsoft Azure and thethings.iO using the data provided by a temperature sensor of a Sigfox device and today he is going to explain the benchmark of all of these IoT platforms with Sigfox.

On his master thesis the student configured a Sigfox device with several IoT platforms. The Sigfox device is sending periodically temperature readings to the Sigfox Cloud and these are sent from there to the different IoT platforms, which have been configured to receive and store the data. Once the data is stored in the IoT platforms, the main objective is to get useful insight from them. Therefore, graphical visualizations have been carried out. The report explains in detail how to configure these platforms in order to receive and analyze data, conveyed by a Sigfox device.

The added value provided by this project is that the reader can get a broader vision of how to configure and deploy an IoT architecture and, more importantly, which IoT platform
better fits with the requirements of each and every project. To make things easier, a comparison of the platforms, considering features such as easiness to connect and data analysis, pricing, flexibility or services, has been checked.

Comparing features of the IoT platforms

This is the result table of comparing the different IoT platforms AWS IoT, Microsoft Azure IoT, thethings.iO and IBM Watson.

In relation to the thethings.iO IoT platform, it has been configured in order to receive the data from the Sigfox Cloud with the provided Callback URL. Then, by means of a Sigfox parser, the data has been addressed and given an attribute. Finally, a table and a graphic visualization have been created in order to watch the trend of the temperature during a period of time.

The steps followed to connect the Sigfox devices are much simpler with thethings.iO than the steps done in the other IoT platforms. The physical thing, which corresponds to the Sigfox device, which is conveying data, is registered / provisioned in the IoT platform cloud automatically and the data automatically stored after generating a Sigfox payload parser.

With reference to the strengths of thethings.iO IoT platform, it can be stated that it is simple to configure the connection between the Sigfox Cloud and the thethings.iO platform. Moreover, it has a different internal structure than the other platforms which makes relatively easy to make an analysis right after the data reaches the platforms in comparison with the other IoT platforms. A feature that singles out thethings.iO IoT platform is that it is software and hardware agnostic, therefore, it can be connected to any device whereas the other platforms had a few group of hardware to which they can be connected.

This post and project has been developed by Daniel Torán Mercadé graduated in Industrial Engineering at ETSEIB-UPC and it has been mentored by Manuel Moreno Eguílaz UPC Senior Researcher. Further information of how to configure the platforms can be found here on Daniel Torán master thesis.

Geocoding location coordinates to addresses from GPS-trackers

Today we talk about geocoding. Geocoding is a very interesting art! Geocoding consist of converting addresses (e.g. streets) into geographic GPS coordinates (i.g. latitude and longitude). On the other hand, we have reverse geocoding that is the reverse process: transforming a pair of geographic GPS coordinates into an address (street with number and city).

You might be wondering what geocoding can be used for. From simple analysis to business and customer management to distribution techniques, there is a wide range of applications for which geocoding can be used. At thethings.iO we are helping companies for which is important to geocode the GPS coordinates into addresses for the fleet management, route planning, among others.

At thethings.iO we usually receive the location as geographic GPS coordinates (latitude and longitude). It is known that it is the best way if you want to represent your assets on a map. However, geographic coordinates are not meaningful if they are not represented on a map. That’s why some customers ask us for the possibility of the integration of geocoding services in thethings.iO IoT platform.

Thanks to the Cloud Code service, we help you to integrate third-party services that enable you to transform the data from your connected things into information that will be useful to your daily activities.

Here you can see an example. In the table, you can see the addresses where the devices are located in:

Geocoding services

Although there are many geocoding services, today we will talk about two of them:

  • OpenCage Geocoder
  • Google Maps Geocoding API

Both are free up to 2.500 requests per day. In the case of Google will charge us $0,5/1.000 requests up to 100k daily requests if we overlap the free limit. For OpenCage we have different plans, e.g the x-Small plan includes 10k requests per day and it cost $50 per month.

Some lines below you will find information on how to use it. The first step is to get the API key or token.

Obtaining the API key

OpenCage

OpenCage Geocode is a very simple geocoding service (as we like). You only have to sign-up and follow all the registrations steps. After that you will see your dashboard like this:

Copy and keep the API key. We will use later!

Google Maps Geocoding API

If you have decided to use the Google Maps Geocoding API you must follow these steps:

1. You have to sign in with your Google account and follow this link:

2. Click on ‘Get a Key’ button and follow the instructions.


3. You will obtain your API key. Keep it! We will need it later!

 

Using geocoding services at thethings.iO

Once you get your API key, you are ready to use the geocoding services on our platform. In the following link, you can find a repository with the functions and examples of how to use these services.

In the repository, you can find two folders and two files. The folders contain the code for the httpRequest with both the OpenCage and Google Maps API geocoding and inverse geocoding services.

With that code, we build two examples that could be useful for your business requirements. Anyway, do not hesitate to contact us if you have further questions regarding this topic. We can provide you with more examples!

       1. Example 1. Trigger (Inverse geocoding with Open Cage API)

With this code every time you send data to the platform that contain location information, the trigger will be executed and we will transform the coordinates from the resource $settings.geo into a physical address. Then we will save it into the resource address. You just have to create a new trigger in the cloud-code. Then copy and paste the following code.

      2. Example 2. Function (Inverse geocoding with Google Maps Geocoding API)

In this case, we transform all the addresses of all the things of one product just in one cloud-code execution. Create a new function, choose the product and copy and paste the code from the file. Finally, introduce “{}” in the Preview Params (Check the picture below). The function will calculate the address for all the devices that contain information in the resource $settings.geo and will be saved in the resource address of each thing.

We hope all this information will be helpful for you. If you want to know more about us, you can create an account by clicking here, sign up to receive our monthly newsletter or follow us on Twitter! Stay tuned and be the first in knowing the latest news of the IoT world and thethings.iO

3 Reasons to Start Tracking Your Assets on the Supply Chain with IoT

Let’s imagine, you are the operations VP of a company or even the country manager of a European company who needs to get profitability of the operations of your assets. How are you going to optimize the supply chain of your company? Nowadays the cost associated at the information from your supply chain is cost effectiveness. New technologies and networks are appearing into the market with the goal of making the supply chain a very optimized workflow with real-time information. Low power devices with trustable instruments are available in the market for a very interesting price that makes the supply chain a use case where the payback is less than one year.

This is what we are getting from our experience on the supply chain with thethings.iO. Our coldthings: The cold chain monitoring solution and trackthings: the supply chain tracking solution products and helping companies to optimize their cold chain and supply chain and getting the project profitable in less than one year. Does it make sense for your company?

thethings.iO helping supply chains with IoT

thethings.iO helping supply chains with IoT

The GPS tracking market is currently on the rise and continuing to expand from fleet management towards supply chain and similar use cases. The future of GPS (or non GPS) location trackers looks very promising with the new low power networks appearing in the market. The new trackers that are more trustable, low power and simple are making this expansion viable due the newest low cost connectivity models.

Meet here the 3 main reasons why your company should start tracking your assets on the supply chain investing on Internet of Things technology:

Always moving phylosophy

If your company owns trucks or vans can’t afford a parked or inactive fleet. Without reports that showcase real-time situation of the vehicles and what are they doing, the companies actually don’t have enough information to evaluate the profitableness of a vehicle. It’s important in the 21st century take quick decisions to optimize the workflows of your company. Don’t bring your company on a complex situation without data to take decisions.

The start up cost of location tracking services is very affordable today. At thethings.iO large up front costs are replaced with low fees (depending on your needs CAPEX or OPEX) that enables your companies to get correct data from the situation of your vehicles, if they are moving, parked, at your clients warehouse, following the proposed route, among others. Prices of location trackers have even dropped over the past years, which is one reason more and more businesses are investing in these tracking devices. In addition, the location trackers are becoming more technologically advanced as their prices drop. Different pricing structures are offered by thethings.iO so affordable and fair pricing can be offered to both small and large companies whom may track a few to thousands of assets.

Once you start tracking your supply chain, pallets or vehicles, as more data your collect more information and more data-driven decisions are your going to be able to take to improve the efficiency and productivity of your company. When the productivity of your pallets or vehicles improve it also increase the profitability of your business.

Automatization of the processes

This reason could belong to the Industry 4.0 but it is also applicable at the supply chain industry. The continuous movement of your vehicles and pallets makes complex to follow them, even on a thethings.iO beautiful dashboards under your own brand. The dashboards allow you and your customers to analyze the delivery data improving their satisfaction during the transit process. Nevertheless real-time or daily generated KPIs are much needed in order to get relevant information about the situation of your actives.

It is a must to maximize the hours of your workers and the solution of having vehicles or pallets generating perfect reports from all the supply chain it’s perfectly done through thethings.iO.

Simplicity

thethings.iO provides the most simple enterprise IoT platform. So we make it very simple to connect an end-to-end solution.

We do help companies to install the location trackers to delivery trucks, other vehicles, pallets, boxes or any other assets companies would like to track. The time to market is very easy and quick. Immediately our clients are able to visualize all the data from beautiful and customized dashboard to focus on delivering their customers the best products and experiences. And of course, they can configure their own dashboards for them or their clients in a really simple way. Finally they have the tools to apply business logics on the top of the data, enabling them to generate alarms or other notifications.

Our goal is to enable our clients with a tool which makes their business more trustable and efficient by their clients. The trackthings and coldthings by thethings.iO are essential tools for logistic companies that help them to improve the profitability of their vehicles and to bring assets to destination in perfect conditions. Don’t waste more time and try thethings.iO. Contact us here.

,

How to integrate LoRa with thethings.iO IoT platform

As you know, thethings.iO is the most simple enterprise IoT platform. An IoT platform consists of helping and improving life of developers that are connecting products to the Internet. And as good makers, we love integrating new systems and platforms to thethings.iO that enable our clients of connecting to the Internet more devices.

In today’s post we will show you what is LoRa and its basics. We’ll also show how can it be integrated within thethings.iO platform.

LPWAN protocols

Nowadays, there is a growing interest to connect devices to the Internet, and there is an emphasis on low power wireless commutations (LPWAN).

LPWAN is designed to allow long range communications at a low rate transmission among low power connected things. LPWAN stands for Low Power Wide Area Network standard.

Devices, such as ESP8266 are capable to connect to WiFi networks. We all know that its reach is limited to few meters around the access point. IoT devices require to bridge much bigger distances since we want to use them everywhere. IoT devices usually work on batteries and we don’t have lots of power for transmission.

The dilemma is… how to reach many kilometres without spending too much power? To create radio connections for a certain distance we can either increase transmission power of the system or decrease the bandwidth of the channel and that’s the key of LPWAN protocols. LPWAN is not comparable with WiFi or 2G networks, and not all a replacement for these technologies since size of data payload is not a strong point of LPWAN. On the other hand, we have all the numerous benefits that we commented before.

As you probably know there are different LPWAN protocols such as SigFox, NB-IoT or LTE-M. As you know thethings.iO is the most simple IoT platform for Sigfox, is getting compatible with NB-IoT (I don’t want to spoiler now). Nevertheless today we want to connect thethings.iO with LoRa.

LoRa

LoRa is a Low Power Wide-Area Network (LPWAN) solution coming out France and it is intended for systems that require the ability to send and receive low amounts of data over a range of many kilometres without high power costs. It is not an open protocol as it is driven by a chip company called Semtech.

The LoRa wireless system makes use of the unlicensed frequencies that are available worldwide. The most widely used frequencies / bands are 868 MHz (Europe), 915 MHz (North America) and 433 MHz (Asia). LoRa is capable of providing data rates from between 0.3kbps to 50kbps which varies based on required range and interference. The LoRaWAN protocol provides both signing and encryption for parts of LoRaWAN packets.

LoRa topology. Source: https://www.mwrinfosecurity.com/

LoRa solutions are made up of nodes and gateways that communicate with a network server. Nodes represent connected things and they are typically low powered and communicate wirelessly with one or many gateways. Gateways are fewer in number, and transfer data from the nodes back to the network server using standard IP connections. A LoRa solution therefore follows a “star of star” topology, where multiple nodes talk to one or more gateways. Network server represents the edge of the systems that would store and parse the data sent from the nodes.

About The Things Network

The Things Network is a community-based, global initiative to provide free LPWAN coverage over LoRa. LoRaWAN coverage is entirely crowdsourced. Members also contribute by providing support or through software development.

The Things Network Backend route messages from gateways to the right application through the Internet, and back. In our case, the application would be thethings.iO platform. The question is, how can we integrate The Things Network data with our platform? How can receive the data  sent through The Things Network in thethings.iO

Integrating The Things Network within thethings.iO

In order to integrate both platforms we encourage you to read this article https://developers.thethings.io/docs/http-integrations#section-a-integration-example-with-the-things-network in our Developer Center at the thethings.iO, but here you can find a summary of the steps.

  1. Get and customize your callback URL with the productid and the hash. You can find both parameter in the Product Details of the Things Manager. The base path of the URL should be like this https://subscription.thethings.io/http/{productId}/{hash}?idname=dev_id*.
  2. Insert this url at the HTTP Integration section of The Things Network Platform.
  3. Finally, go back to thethings.iO Cloud Code section a create function with the name http_parser. Here you can find an example:
function main(params, callback){
  var result = [
      {
        "key": "temperature",
        "value": params.payload.payload_fields.temperature
      },
      {
        "key": "$settings.name",
        "value": params.payload.hardware_serial
      },
      {
        "key": "$geo",
        "value": [params.payload.metadata.longitude,params.payload.metadata.latitude]
      },
  ];

   callback(null, result);
}

Once the URL is configured and the Cloud Code function is coded, everything is ready to start receiving data and monitoring from thethings.iO IoT Platform.

We hope all this information will be helpful for you. If you want to know more about us, you can create an account by clicking here, sign up to receive our monthly newsletter or follow us on Twitter! Stay tuned and be the first in knowing the latest news of the IoT world and thethings.iO

How to display data from your things on a map with thethings.iO IoT platform

Some customers just contact at thethings.iO because they heard that it’s super simple to use thethings.iO IoT platform to visualize their devices, draw some points in a map or apply business logics on their connected devices. And that’s right! thethings.iO is the most simple IoT platform. Nowadays we are helping hundreds of companies and developers to reduce the time to market of their IoT projects just using thethings.iO IoT solution.

One of the most popular question is how to display data from connected devices on a map. Seriously it’s very simple to do it with thethings.iO IoT platform. Nevertheless, there are tricks to have more fancy maps, it all depends if you have 2, 3 or five minutes 🙂

How to send geolocated data to the IoT platform

First of all, it’s important to understand that thethings.iO has 2 ways to geolocation things.

Locate the device

We call this $geo resource, or also magic resource. This magic resource allows the update of the current thing position in GeoJSON format. GeoJSON and legacy [long, lat] pairs are accepted as valid input value, or you can use the geo attribute: the final value will be saved in GeoJSON format.

Find here the code to send data to locate the device.


{
"values":
[{
"key": "$geo",
"value" : {
"type": "Point",
"coordinates": [2.154007, 41.390205]
}
},
// OR using legacy [long, lat]
{
"key": "$geo",
"value" : [2.154007, 41.390205]
},
// OR using geo attribute object
{
"key": "$geo",
"value" : null,
"geo" : {
"lat": 41.390205,
"long": 2.154007
}
}]
}

Locate a sensor read in the space and time

Sometimes the GPS reading does not correspond to a sensor read position, so this is the reason why we differentiate among them. Find here the code to send data with this second way to geolocate a device or a sensor read.


{
"values":
[{
"key": "my-geolocated-key",
"value" : 23,
"geo" : {
"lat" : 41.4121132,
"long" : 2.2199454
}
}]
}

How to show things on a map

Now that we have geolocated devices, let’s paint the devices and routes on a map.

It’s simple right? Feel free to register at thethings.iO and contact us if you have any question.

Announcing Sigfox & thethings.iO partnership

Today at thethings.iO we are excited to announce a strategic partnership between Sigfox and thethings.iO to bring the most simple enterprise IoT platform with the most simple connectivity solution to the business world.

Since few weeks ago, thethings.iO became an official partner of Sigfox connectivity. That means that thethings.iO is able to sell Sigfox connectivity for their customers, including this price on thethings.iO service.

At thethings.iO, this milestone is an important mark in our company’s journey. Sigfox simplicity enables companies to create successful business cases around Internet of Things and connectivity that were not possible before LPWAN was properly working and business available. With this partnership thethings.iO can provide in a most simple way the state of the art IoT platform to help companies to collect their data, analyze it and visualize it in a very simple way and ready to go.

Currently, thethings.iO serves hundreds of companies using Sigfox and millions of requests worldwide.

Sigfox and thethings.iO are strong believers of how the Internet of Things can be a gamechanger for most of the companies in several verticals. This is the reason why thethings.iO with Sigfox wants to offer a very tangible and plug&play solution at the market. thethings.iO has achieved the partnership to re-sell Sigfox connectivity. So from now your company can enjoy an IoT solution for your industry in a really simple way.

Contact us if you need further information about what thethings.iO can offer to your business.