0

Tank Utility Sensor API

Alexander Paredes 1 month ago in Devices / Http updated 4 weeks ago 11

Hi I would like a hand creating this API for aTank Sensor Called Tankutility

i would like to read the volume value and temperature value from comfortclick GUI

i am following this API Guide ( API Guide) how ever i am only able to get the Token Value under Response Value line

here is a picture of where i am stuck right now

+2

Hi,

Getting the token is just the first step.

Now you need to use that token to extract the information from the device.

You've created successfully the way to extract the token, now use that token to create other commands.

Get a list of devices:

curl https://data.tankutility.com/api/devices?token=<my_personal_token>

The above command returns JSON structured like this:

{"devices":["54df6a066667531535371367","54ff69057492666782350667"]}

Get data from a specific device:

curl https://data.tankutility.com/api/devices/54df6a066667531535371367?token=<my_personal_token>

The above command returns JSON structured like this:

{"device":{"name":"Sample Device","address":"6 Dane St., Somerville, MA 02143, USA","capacity":100,"lastReading":{"tank":20,"temperature":72.12,"time":1444338760345,"time_iso":"2015-10-08T21:12:40.345Z"}}}

Obviously in this case you're not going to use the curl command, but rather use a command on a Http Device on bOS.

thats the problem i am not able to create the others commands.


Ok let me show you how i am placing the commands

i am creating a new command and in the command line placing the command 

https://data.tankutility.com/api/devices?token

and in header i am selecting the response data from the previous token command

but this is the value that is displaying

am i doing something wrong, can you please help me out on how to place this commands on comfortclick?

regards

I think for the command you only use: "/api/devices?token" not the full link  as the https://data.tankutility.com is already in the http driver Host URL. And for the heather you need to have %0 in the text field otherwise it wont link to the generated token.

But Ricardo knows best, im just guessing. As i haven't had the need to use temp tokens.
Edit: Try it like this for the whole command(not the heather) line use "/api/devices?token=%0" then put the token to the properties under it.

Hi guys,

I just read the API very quickly, I haven't sat around a little bit to see closely how to do it.

The API says something about the token expiring in 24h, so maybe you'll need a workaround to extract the token at 00:00 everyday for example.

I will come back to you as soon as possible. I can try to help, but I don't have access to any device to test it.

Alexander, can you share your e-mail? If so, please share without the @ or . or whatever, to avoid any e-mail bots sniffing the posts. After you share the e-mail, you can edit the post and delete it so it doesn't stay here.

You can write something like ricardo dot pinto at visiontech dot pt

Best regards

Hi here is my email . miguel dot paredes at domytec dot com, i can share with you a old tank monitor account in case you need so you can help me out creating this integration

i case of the expiration token, i noticed that  by just changing the end cyclically delay option for http device on BOS can renew the token


Hi,

Perfect, that would be useful for testing.

I'll send you an email so you can send me that old account data.

Best regards

hi ricardo i just sent you the email with the credentials, it will be great if we acomplish to connect tank utility to comfortclick

it will add a great tool to monitor propane gas tanks

+1

Hi,

I've successfully extracted the info and created Http Device for the tank. Made it in a rush, so probably it may need some editing.

I'm attaching the file export, so you can adapt it to your needs.


TankUtility API.bos


I've set the GetToken to 86400 (24h). The API says that the token expires in 24h, so I've set it to 86400s, and the info extraction to 3600s (every hour).

I'm sending the devices set to false. Please set the devices to true, and insert your e-mail and password on the authentication (only on the first device created named as GetToken). If you want to see some results right away, you can force to send manually the commands, that's how I did it first.

Result:

Some notes:

The GetDevices command, lists all the devices available on the account

As there's only one device available, I've set the command "Device ID" token to the first device on the array: device[0]

If you have other devices on the account, you need to change the index to the one you need.

Example:

If you only have one device, keep it device[0]

If you have let's say 4 devices, and want to extract the information of the third, please change it to device[2]

(The index starts from 0...)


Hopefully you can now change it and adapt it to your needs.


Best regards

I forgot to include some items, like orientation of the tank, fuel type, and battery...


Just noticed now...

Hi Ricardo, Thanks for all the support, this is great!!, it will be great if we can share this plugin so comfortclick can add it to the example libriary list. are they still offering a jigsaw or a colibri as a reward? XD