After we recently had a look at how to implement nello into Homebridge we decided to keep going and today we want to introduce another application. This time, however, we won’t be talking about a Smart Home Hub that we want to synchronize nello with. Instead, we’ll be focussing on a handy little app.
The Tasker App truly is a Swiss Army knife of functionality.
It allows its users to construct both simple and complex routines and does so without requiring any knowledge about programming languages whatsoever. Automatically turn your airplane mode on after work or on weekends? Start up Spotify as soon as you plug your headphones in? Weekly changing alarm tones? The world is your oyster. In these step-by-step instructions we want to show you how to also add the door opening with nello as an executable task.
Why all this? Well, for starters you can build a routine that won’t only open your door but simultaneously the app of your smart lock. Or you could make it so nello will automatically open the door for you as soon as your phone is connected to your WiFi at home. Or you construct a widget that will end airplane mode only for a second to open the door for you. You know, in case you don’t want to be disturbed but also want to access your flat. And these are just of the top of our heads.
Even though we are huge Tasker fans, we should address two issues.
- First, the Tasker app isn’t for free. At the moment, it will set you back €2.99.
- Second, Tasker is currently only available in Google’s Play Store. iOS users are striking out.
In addition to the app itself there are a few other things we are going to need.
- Access to our public API. This can be easily done here. On the site that this link takes you, simply put the credentials for your nello account, answer a few short questions and you will get a client_id and a client_secret. Jot both of them down, we are going to need them later on. By the way, we recommend inviting a new user just for this integration.
- A REST client. Since we used a windows machine for this we opted for the Insomnia client which, however, is also available on MacOS and Linux. This article will reference Insomnia explicitly, but in principle any client would do.
- Since Tasker’s basic version won’t do everything that we want it to, we are also going to need the free plugin RESTask for Tasker.
Got everything? Sweet, then let’s get started.
- Start up the Insomnia client. Click “New Request” and choose any name you like. The type, however (drop down list on the right) should be set to GET. “Create” finalizes the initialization.
- Our goal is to get a OAuth-2.0-Token so we can authenticate ourselves for future requests to the nello backend. The address we need to send our first request to is https://auth.nello.io/oauth/token/ . Just put that in the greyed out address line over the Peace-Emoji . Now we need to tell the nello backend who it is that is requesting. Under “Body” Click “Multipart Form” and enter the following five pairs name ; value:
- grant_type ; password
- client_id ; [your client ID from our API]
- client_secret ; [your Client Secret]
- username ; [the email address you used in the API to register]
- password ; [the corresponding password]
Afterwards, switch to “Header” and enter:
- Content-Type ; application/x-wwwform-urlencoded
If you now press “Send” you should get an answer containing values for the parameters “access_token”, “scope”, “refresh_token”, and “token_type”. Only the first one of these is important, so remember to note it down.
- We still need another request before we got everything we are going to need. Replace the address with https://public-api.nello.io/v1/locations/ and modify the header so it contains ths following two pairs:
- Content-Type ; application/json
- Authorization ; Bearer [the access_token of the former request, without the “”]
What you should now get as an answer is the locations registered with your nello account as well as a value for our location_id. Please write that down as well.
- At this point we are done with Insomnia and can move on to Tasker. Please make sure that RESTask is installed as well. Having opened the app, please select “Tasks” and add a new task by clicking the plus icon. Give it any name and confirm. A new screen will open on which there is yet again a plus icon to be clicked. In the menu now please choose “Plugin” -> “RESTask”. The slider underneath “Timeout” should be kept at the far low end. Tasker will keep on trying to open the door for as long as the timeout runs if it did not succeed already. This means that if during the initial request an opening was not possible (e.g. due to bad internet connection) it might open the door several minutes or even hours later. To prevent that we recommend having this timer no higher than 20 seconds.
Next to the word “Configuration” you will see a pen icon. Click it and you will now be able to supply the actual work that Tasker will be doing. The Request Type must be chosen as PUT and under “Host” please insert the following URL: https://public-api.nello.io/v1/locations/[your location_id]/open/ . The remaining settings on this page don’t need to be changed. Choose “Header” and repeat the two entries from our second GET request, that is:
- Content-Type ; application/json
- Authorization ; Bearer [your access_token]
Save via the floppy disk icon and the nello task is done.
- The remaining steps require your creativity and imagination. You can start by further editing the task (i.e. adding more things to be done after nello opened the door) or you can switch to “Profiles” and choose triggers for your task. You might for example configure the app in such a way that it will automatically buzz the door open when your phone is connecting to your WiFi (plus icon -> “State” -> “Net” -> “Wifi connected” -> enter your SSID). By the way, tasks might also be activated directly using Widgets. The Widget can be found unter “Tasker” as “Task Shortcut”. You might e.g. configure a widget which will not only open the main entrance door with nello but will also launch the app of your smart lock (in Task Edit, click on the plus icon -> “App” -> “Launch App” -> choose your smart lock app).
Have fun using nello and Tasker!
We hope you enjoy using Tasker in combination with nello and can’t wait to hear about all the ingenious routines you come up with.