encodeAsMD5 not available?

Trying to port this code from my Blue Iris ST integration:
def requestClean = "${username}:${response1.data.session}:${password}"
log.debug "Plain: ${username}:${response1.data.session}:******"
def myMD5 = requestClean.encodeAsMD5()

...that triggers:
app:4322018-07-30 17:04:07.479:errorgroovy.lang.MissingMethodException: No signature of method: java.lang.String.encodeAsMD5() is applicable for argument types: () values: [] on line 233 (virtualSwitchHandler)
app:4322018-07-30 17:04:07.445:debugPlain: minollo:6ca0000561df5b841380496b45d13c7c:******

Any way I can access to that method? Blue Iris requires that operation as part of its login handshake.

I found a workaround:
import java.security.MessageDigest
...
def generateMD5(String s){
MessageDigest.getInstance("MD5").digest(s.bytes).encodeHex().toString()
}

Works well for me.

Care to share?

...I think I did? I added the import statement at the beginning of my app, and defined the function as specified there. then you just do def myHashedVaue = generateMD5(myNonHashedValue)

I think he meant β€œcare to share the entire blue iris app/drivers?”

1 Like

Oh, sure, it's here.

Not proud of how I hardcode the max number of supported cameras - but that's the best I could come up with when I originally wrote for ST five years ago; also, you'll notice I force the IR lights on for a subset of the cameras - and that's likely unneeded in most scenarios.
You'll notice cameras on/off is triggered either by mode changes or by a (virtual) switch.

If I had to re-write it now, I would likely make most of it a device handler, as I did for my total connect alarm integration.

1 Like

Did you happen to port the Total Connect to Hubitat as well? I would love to take advantage of it.

Yes, I did; it's a device handler.

Thanks. I really just wanted to change Blue Iris profiles so I ended up porting Tony Gutierrez (pursual)'s Blue Iris Profile Integration App.

I did use your encodeAsMD5 workaround though and it worked beautifully. Thanks.

The code for my hubitat port of Blue Iris Profile Integration is posted here: https://raw.githubusercontent.com/rayzurbock/hubitat/master/apps/BlueIrisProfileIntegration/BlueIrisProfileIntegration.groovy