Closed davthomaspilot closed 3 years ago
Disregard the below. I missed a commit on my side, I suck sorry working to fast and to blind on this.
Code is updated now on github and I just double checked it. You need this line.
Looks like chemID might be mispelled on line 80 in the Intellichem driver:
20
21-06-29 02:39:13.342 pm errorjava.lang.NullPointerException: Cannot invoke method toInteger() on null object on line 80 (refresh)
What do you see when you look at the Intellichem device in Hubitat in the Data section under "Device Details"? This error is happening because there is no chemID defined in the data for your Intellichem device. That should be getting set when it is created per line 320 in the pool-controller.
The chemID should be there as a value, sort of like this:
I don't see any typos looking at the code - everyplace I am looking I see chemID - lowercase with capital ID.
I went into the Pool Controller Device to change the log level (I get a log every second or two with it at debug). I noticed there was a new Intellichem 1 device getting created every two seconds:
Not sure what would happen if I stayed on the device page. When I leave it and come back, there is just one inititally, then it keeps creating more (with null)
I honestly have no idea where this is coming from. Some code is calling SendEvent(name: "IntelliChem 1", value: null) to cause that to happen but I can not find any code that would cause that on the pool controller or intellichem devices. Do you have any extra debugging code on your system or anything?
I copy the pool_controller.groovey from your reference above. It didn't compile due to a missing comma near where you edited for chemID. So, I fixed that.
I don't see any data items that look like chemID in the Data section of the Intellichem device:
I have NOT been getting that error message about trying to run toInteger on a null object, even before I got this latest change. Maybe that code only runs at certain log levels--I'll have to investigate some more.
I don't think I have any debug code laying around. I'll check more thoroughly and see if I can chase down what's causing the null Intellichem devices to get created.
Line 320 is where you need to add a comma to get the code to compile
When I added a return at the begining of parse() to stub the function out, the creation of the null Intellichem children ceased. Yet, when I commented out all the case statements, I got the same issue--continuous creation of null Intellichem devices.
So, I added an explicit return statement at the end of the parse, and I no longer see the null Intellichem devices in the pool controller device page!
I don't know groovy that well. Apparently, something different is pushed on the stack with an explicit return statemen versus leaving the return statement out? And, looking at the invocation of parse in the pool Controller parent device, why does the return value even matter?
But, it's 100% reproducible.
Also, now I see chemID on the Intellichem device page:
Pasting the modified parse method. Thinking maybe it's something with code flow, missing break statement, or something hard to spot. But I sure can NOT see why adding the return "fixes" anything.
// Process the results from /state/chemController/{id}
def parse(section) {
section.each { key, v ->
switch (key) {
case "ph":
parsePh(v)
break;
case "orp":
parseORP(v)
break;
case "alarms":
parseAlarms(v)
break;
case "warnings":
parseWarnings(v)
break;
case "status":
sendEvent(name: "status", value: v.name)
break;
case "lastComm":
sendEvent(name: "lastComm", value: v)
break;
case "alkalinity":
sendEvent(name: k, value: v)
break;
case "calciumHardness":
sendEvent(name: k, value: v)
break;
case "cyanuricAcid":
sendEvent(name: k, value: v)
break;
default:
logger( "No handler for incoming Intellichem data element '${key}'","trace")
break
}
}
return
}
Line 320 is where you need to add a comma to get the code to compile
Thanks - got this fixed now.
Pasting the modified parse method. Thinking maybe it's something with code flow, missing break statement, or something hard to spot. But I sure can NOT see why adding the return "fixes" anything.
// Process the results from /state/chemController/{id}
def parse(section) { section.each { key, v -> switch (key) { case "ph": parsePh(v) break; case "orp": parseORP(v) break; case "alarms": parseAlarms(v) break; case "warnings": parseWarnings(v) break; case "status": sendEvent(name: "status", value: v.name) break; case "lastComm": sendEvent(name: "lastComm", value: v) break; case "alkalinity": sendEvent(name: k, value: v) break; case "calciumHardness": sendEvent(name: k, value: v) break; case "cyanuricAcid": sendEvent(name: k, value: v) break; default: logger( "No handler for incoming Intellichem data element '${key}'","trace") break } } return }
This is not clear to me either, but I see no harm, so I added it to the main code and pushed it up.
So now that your child device has a chemID, has the other error with null on toInteger() gone away? I think this should have you back to working and getting attributes updated on your Intellichem device.
Yes, everything looks good now. Thanks! On Wednesday, June 30, 2021, 01:52:52 PM EDT, Brad Sileo @.***> wrote:
So now that your child device has a chemID, has the other error with null on toInteger() gone away? I think this should have you back to working and getting attributes updated on your Intellichem device.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Yes, everything looks good now.
Thanks!
I see this in the "verify final pool controller configuration
Create 0 intellichem.
And, there is no Intellichem device under EasyTouch 2.4 device.
I see this in the logs during discovery:
app:1582021-06-19 09:41:00.398 am debugpoolConfig STATE=[configVersion:[lastUpdated:2021-06-19T09:39:21.114-0400, equipment:0, master:0], devices:[B827EBFE850A:[serialNumber:, verified:true, networkAddress:C0A800E0, mac:B827EBFE850A, deviceAddress:1068, ssdpTerm:urn:schemas-upnp-org:device:PoolController:1, hub:1, name:NodeJS Pool Controller, ssdpPath:/device, model:, ssdpUSN:uuid:806f52f4-1f35-4e33-9299-b8:27:eb:fe:85:0a::urn:schemas-upnp-org:device:PoolController:1, ssdpNTS:null]], controllerType:easytouch, bodies:[[manualHeat:false, circuit:6, setPoint:87, name:pool, id:1, type:0, isActive:true, heatMode:0, master:0, capacity:17000], [manualHeat:false, circuit:1, setPoint:99, name:Spa, id:2, type:1, isActive:true, heatMode:0, master:0, capacity:1000]], valves:[[isReturn:false, circuit:3, isIntake:false, name:Cleaner, id:1, isVirtual:false, type:0, isActive:true, master:0], [isReturn:false, circuit:0, isIntake:false, name:Valve B, id:2, isVirtual:false, type:0, isActive:true, master:0], [isReturn:false, circuit:6, name:Intake, isIntake:true, id:3, isVirtual:false, type:0, isActive:true]], pool:[owner:[email2:davethomaspilot@bellsouth.net, phone:19192726695, name:Dave Thomas, phone2:, email:davethomaspilot@bellsouth.net, master:0], options:[clockMode:12, manualHeat:false, clockSource:manual, pumpDelay:false, units:0, adjustDST:true], alias:, location:[zip:27523, country:United States, address:357 Black Willow Drive, city:Apex, latitude:35.79981, timeZone:134, state:NC, master:0, longitude:-78.95631], master:0], equipment:[shared:true, tempSensors:[[name:Air, id:air, isActive:true, calibration:0, master:0], [name:Water, id:water1, isActive:true, calibration:0, master:0], [name:Solar, id:solar1, isActive:true, calibration:0, master:0]], maxPumps:2, maxBodies:2, maxCircuitGroups:0, maxChemControllers:1, maxCustomNames:10, maxValves:4, maxSchedules:12, maxFeatures:10, modules:[[bodies:2, valves:4, part:ET2-4, maxPumps:2, chemControllers:1, type:2, master:0, features:10, chlorinators:1, name:ET24, id:0, circuits:4, desc:EasyTouch2 4]], maxLightGroups:1, bootloaderVersion:1.010, dual:false, maxChlorinators:1, maxCircuits:4, equipmentIds:[features:[start:11, end:22], circuitGroups:[start:192, end:223], circuits:[start:1, end:4], invalidIds:[7, 8, 9, 10, 19], virtualCircuits:[start:128, end:136]], model:EasyTouch2 4, maxIntelliBrites:8, softwareVersion:2.140], pumps:[[address:96, primingTime:0, maxSpeed:3450, type:128, isActive:true, master:0, primingSpeed:1000, speedStepSize:10, name:Intelliflo VS, model:0, id:1, minSpeed:450, circuits:[[circuit:4, id:1, units:0, speed:2770, master:0], [circuit:6, id:2, units:0, speed:2400, master:0], [circuit:1, id:3, units:0, speed:2930, master:0], [circuit:3, id:4, units:0, speed:3200, master:0]]], [address:97, primingTime:0, maxSpeed:3450, type:128, isActive:true, master:0, primingSpeed:1000, speedStepSize:10, name:Intelliflo VS, model:0, id:2, minSpeed:450, circuits:[[circuit:132, id:1, units:0, speed:1400, master:0], [circuit:11, id:2, units:0, speed:2500, master:0]]]], hubPlatform:Hubitat, subscribed:false, features:[[freeze:true, name:Jets, nameId:46, id:11, type:0, isActive:true, eggTimer:720, showInFeatures:true], [freeze:false, name:Feature 2, nameId:95, id:12, type:0, isActive:true, eggTimer:720, showInFeatures:true], [freeze:false, name:Feature 3, nameId:96, id:13, type:0, isActive:true, eggTimer:720, showInFeatures:true], [freeze:false, name:Feature 4, nameId:97, id:14, type:0, isActive:true, eggTimer:720, showInFeatures:true], [freeze:false, name:Feature 5, nameId:98, id:15, type:0, isActive:true, eggTimer:720, showInFeatures:true], [freeze:false, name:Feature 6, nameId:99, id:16, type:0, isActive:true, eggTimer:720, showInFeatures:true], [freeze:false, name:Feature 7, nameId:100, id:17, type:0, isActive:true, eggTimer:720, showInFeatures:true], [freeze:false, name:Feature 8, nameId:101, id:18, type:0, isActive:true, eggTimer:720, showInFeatures:true], [freeze:false, name:AUX EXTRA, nameId:93, id:20, type:0, isActive:true, eggTimer:720, showInFeatures:true]], lastUpdated:6/19/20
Note, "chemController:1" but "intellichem:null"
dashPanel sees the Intellichem and shows valid ph, ORP, alarms etc. Except for a few bugs documented in the njsPC github issues.