Token retrievable for a non-programmer

(JosephNY) #1

I monitor my the level of propane in my tank by using a wifi-connected device called a TankUtility.

TankUtility has an API that I’ve been using to get readings into Smartthings and Grovestream.

It’s been working well until recently.

I believe that the token required expires (that’s what the error displayed is when I issue that command from a browser’s URL line).

The section of code that gets the data is:

def runCmd() {

def params = [
	uri: "$deviceID?token=$token"

try {
    httpGet(params) { resp ->   
        log.debug "response data: ${}"
        log.debug "temperature: ${}"
        log.debug "level: ${}"
        sendEvent (name: "temperature", value: (, unit:"F")
		sendEvent (name: "level", value: (, unit:"%")
} catch (e) {
    log.error "something went wrong: $e"


The deviceID remains constants, and the following call will return a current/working token:

Is there a way to get a token before each call for a reading?

Thank you!


The token seems to be for tankutility and not SmartThngs. Normally for a token you would store it and renew it when it is about to expire.

I would look more into the tankutility api for information regarding getting and renewing tokens.