works fine when typed into my browser address bar (Safari). It selects Preset 2 on the Amp and plays the linked station. However when I try the same in RM:
@Bravenel - is there any reason you can think of as to why the command in the opening post would not work within RM when it works from the browser address bar? Thanks
I guess it's something to do with https, as I cannot get it to work in node-red either (node-red returns an error of 'DEPTH_ZER_SELF_SIGNED_CERT'). I can't understand why it works every time from my browser.
Well I've resorted to Chat GPT for a driver and have had it change a few things. At this point the only command added in the driver is the "call preset" and that's what I'm trying to test it with. However regardless of the ignoreSSLIssues = True I'm still getting "connection refused" in the logs. The code is below. Is anything obvious that would cause the "connection refused"? (I realise that this thread has evolved and has sod all to do with RM anymore!)
I admire your resolve! Going the custom driver route seems like the right call. ChatGPT, on the other hand, requires a lot of prompting work to get decent code out of.
you might want to define a "test" command that calls a URL that is known to work (e.g. "https://google.com"). Gets the "does my call even get out" question out of the way.
you can make use one of the many services out there that web developers routinely use to test their code. For instance, a call to this URL won't succeed unless you set the ignoreSSLIssues flag to true : https://self-signed.badssl.com/.
Try replacing your sendHttpGetRequest with this:
def sendHttpGetRequest(String requestURL) {
Map requestParams =
[
uri: requestURL,
ignoreSSLIssues: true
]
try {
httpGet(requestParams) { resp ->
//log.debug resp
if (resp != null) {
// success
//log.debug resp.data // uncomment to log the Get response data
} else {
// failure
}
}
}
catch (e) {
// exception thrown
log.error e
}
}
Yes I was having quite the debate last night with ChatGPT. Add this, change that, 'Hubitat reports error'. Each time it apologised, before spitting out some changes for me to try .
I did look at that one but just couldn't fathom how to implement the ignoreSSLIssues as that appeared to be the root of the problem.
Eureka! I put the initial code in pastebin (I did create a Github account years ago but that's a whole world of pain and confusion when you just don't get it). I created another version with that chunk of code replaced with yours and then replaced the code in the Hubitat user driver. Calling the preset from the device page immediately started the Wiim streaming my radio station. I've then tried using RM to run a custom action on the actuator device and that's working too. A little later I will amend the other commands I want and delete those I don't.
Thanks so much for your help, I was beginning to think it wouldn't be possible.