This Tutorial will walk you through connecting your device to scriptr.io using the creatr wizard page.
You do not need an actual physical device, you can simulate one if you know what you will need later,
but you do need a scriptr.io account, Click here to learn how to get one.
We also recommend you setup your github account inside the scriptr workspace under setting which will allow you to download bigger projects from the sample choices of projects
Whether you have your device or will soon get one you need to decide if that device will push data directly to your scriptr account, or if it will push data to a service or platform that scriptr will retrieve data from such as watson/amazon etc . A few steps are different in case of pushing or pulling data so we recommend knowing ahead.
In case of pulling the data from the service it’s probably best to connect the actual or virtual device to the platform, and knowing the method through which this platform will be contacted.
Configuring your github account
It’s better to have your github configured, this section will quickly show you how to do it, it’s optional but will make it easier to install larger sample applications at the end of the creatr process.
Login to your scriptr.io account, or create one, click on the gear icon -> github
You will need a github account, an access token, and while you’re there a repository to upload a copy of your files to:
- Login to your github account https://github.com/
- Create a repo in https://github.com/maxwildcat?tab=repositories
- Go to https://github.com/settings/tokens to review/create your token, make sure it can read and write.
Fill in the information in the github section of the scriptr workspace and then we’ll move through creatr page by page with explanation for each .
In the rest of this tutorial we will go through the pages of creatr and give a brief explanation of each.
The path is almost the same whether you wish to push or pull so we will cover push and explain the slight difference when selecting pull.
Let’s Start by heading to the creatr page.
The instruction page greets the user with what to expect along the way, feel free to give it a read before moving on.
Select your Data Source
This page like many is common to both push and pull and is the first step towards picking either. Multiple devices will be added later to this page, so you will be able to select your device if you have it .
Currently only two options are available to you, the first one is clicking on the generic other device if your device will communicate directly with scriptr.io,
the other is clicking on other platform if your device will communicate with a platform and the platform will communicate with scriptr.io.
Onboard your device Page
This page allows you to name the device/platform which will communicate with scriptr.io, this is your last chance to change your mind to either push or pull, name your device or platform something meaningful to you before moving forward.
Note: The console at the bottom of the page will relay actions as they occur on the back-end, they are useful if you wish to learn more about scriptr or wish to check if the steps happened successfully: creating device, a required channel if needed, a script which is subscribed to channel … etc
Select your Protocol Page
This page is different depending on your choice, we will outline the different pages based on your choice here
If you chose push, to send your data directly from the device to scriptr.io, you will be offered a list of protocols for communicating between the device and scriptr. All information on this page can be retrieved later but you can copy this information from here if you need to use it on the device.
Note that choosing the MQTT or AMQP protocols will start a trial for premium features, as indicated by the text on top of the different buttons, the text above the next button will inform you with Clicking ‘Next’, you will enable the Message Queuing and Broadcasting premium feature in trial mode.
The next page allows you to generate code that you will, deploy and run on your device to connect and send data to scriptr.io. You can choose one of the suggested languages from the list to generate the corresponding code.
For the sake of example we chose bash and copy pasted the generated code inside the command line to help visualise the following step.
If you chose pull this is where you will need to enter the data to communicate with you device via the platform. Select the protocol first then enter the rest of the information.
Visualise your data Page
Whichever method you chose before, this page will attempt to retrieve data from your device, directly or via platform, and show it. If you are not sending data from a real device now you may choose to simulate the data by selecting the visualize button.
Clicking the button after the data is displayed and your device is found will allow you to map said data, and then save that mapping . Mapping is a simple way to convert the payload sent by the device to a format expected by the demo application, the content of “temp” in this example would be mapped to the expected variable name “temperature” and so on, this can also be done manually if the data sent from the devices is binary, or needs any type of conversion or decryption, by clicking raw data and writing the mapping code yourself.
You will also be offered a choice of installing a sample application, ready made and out of the box solution.
The installation will take some time, and this is where setting up the github account becomes useful if the sample app is too big. If the installation fails for some reason you will receive that reason and will be offered a chance to retry or resume installation.
Once the installation is complete, a start demo button will appear that allows you to load a fully functioning app with your device connected to it.
Created apps have admin as user and password the first time they load. We hope you enjoy using our new creatr feature and will find it helpful to quickly setup a working example.