The Sure PetCare Pet Door integration, ported to Hubitat by Dominick Meglio (@dman2306), after working for years on the C-7, now gives low-level JVM errors on the C-8 after migration from the C-7, yet the integration continues to work on the C-7 (and presumably, older hubs). Working with Jean May (@thebearmay), a backward-compatible fix was found (see below). Apparently, the updated JVM on the C-8 is missing an implied class cast present on the C-7.
The Sure PetCare Pet Door integration thread is here:
That community thread is now locked due to inactivity, so I can't append this post to that thread, which is where it really belongs.
Here are the errors:
Here is the code snippet causing the error. Line 692, the one throwing the error, is the line that begins with “def curfewObject =“.
//Update curfew status
def flap = resp.data.data.devices.find{device.deviceNetworkId.toInteger() == it.id}
if (flap.control.curfew && !flap.control.curfew.isEmpty()) {
def curfewObject = flap.control.curfew[0] ?: flap.control.curfew
app.updateSetting("curfewEnabled#${device.deviceNetworkId}", [type: "bool", value: true])
app.updateSetting("starting#${device.deviceNetworkId}", [type: "date", value: timeToString(curfewObject.lock_time, "yyyy-MM-dd'T'HH:mm:ss.SSSXX")])
app.updateSetting("ending#${device.deviceNetworkId}", [type: "date", value: timeToString(curfewObject.unlock_time, "yyyy-MM-dd'T'HH:mm:ss.SSSXX")])
} else {
app.updateSetting("curfewEnabled#${device.deviceNetworkId}", [type: bool, value: false])
}
The workaround is to insert, before the problematic line 692 in the integration app "Sure PetCare (Connect)", the following line:
flap.control.curfew = (HashMap) flap.control.curfew
The fixed code snippet now reads:
//Update curfew status
def flap = resp.data.data.devices.find{device.deviceNetworkId.toInteger() == it.id}
if (flap.control.curfew && !flap.control.curfew.isEmpty()) {
flap.control.curfew = (HashMap) flap.control.curfew
def curfewObject = flap.control.curfew[0] ?: flap.control.curfew
app.updateSetting("curfewEnabled#${device.deviceNetworkId}", [type: "bool", value: true])
app.updateSetting("starting#${device.deviceNetworkId}", [type: "date", value: timeToString(curfewObject.lock_time, "yyyy-MM-dd'T'HH:mm:ss.SSSXX")])
app.updateSetting("ending#${device.deviceNetworkId}", [type: "date", value: timeToString(curfewObject.unlock_time, "yyyy-MM-dd'T'HH:mm:ss.SSSXX")])
} else {
app.updateSetting("curfewEnabled#${device.deviceNetworkId}", [type: bool, value: false])
}
This workaround is backward compatible on the C-7 JVM.