Dropdown list of user created drivers?

Yes, you can use this function:

def getThisVersion() {
    return "1.2.4"
}

def getLatestVersion() {
    try {
        httpGet([uri: "https://raw.githubusercontent.com/ryancasler/cast-web-api-Hubitat/master/Drivers/version.json"]) { resp ->
            logger('debug', "response status: ${resp.status}")
            String data = "${resp.getData()}"
            logger('debug', "data: ${data}")
            
            if(resp.status==200 && data!=null) {
                def msg = parseJson(data)
                def latestVersion = msg.version
                return latestVersion
            } else {
                return null
            }
        }
    } catch (e) {
        logger('error', "something went wrong: $e")
        return null
    }
}

def checkForUpdate() {
    def latestVersion = getLatestVersion()
    def thisVersion = getThisVersion()
    latestVersion = latestVersion.replace(".","")
    thisVersion = thisVersion.replace(".","")
    if (latestVersion == null) {
        logger('error', "Couldn't check for new version, thisVersion: " + getThisVersion())
        sendEvent(name: "updateStatus", value:"ERROR", displayed: true)
        return null
    } else {
        logger('info', "checkForUpdate This Version: $thisVersion , Latest Version: $latestVersion")
        if (thisVersion.equals(latestVersion)){
            sendEvent(name:"updateStatus", value: "NOT REQUIRED", displayed: true)
        }
        else if (thisVersion > latestVersion){
            sendEvent(name:"updateStatus", value: "BETA", displayed: true)
        }
        else if (thisVersion < latestVersion){
            sendEvent(name:"updateStatus", value: "REQUIRED", displayed: true)
        }
    }
}

I made it a little simple for myself, it outputs to an attribute as REQUIRED, NOT REQUIRED or BETA. You just have to create a file in the github repo that contains the version number so you can pull it.

I'm already reading a file from Github. I'm trying to read the version from the driver as stated above. And as Chuck said, this can not be done.

How can you not know what version of the driver is installed?

def getThisVersion() {
    return "1.2.4"
}

Will return 1.2.4. That's the version.

again, not what I'm trying to do. Chuck answered my question.

Nothing to see here, move along...

1 Like

You seriously blocked that post! lol Wow, having a bad day are you?

I never said that, but now I will. I would prefer you NOT post on my questions.

Thank you.

1 Like