I kind of got it working by having all the various functions that use the cachedZigbeeDevices pass in and return the variable but then I deleted all my log messages and it stopped working. I don't know what I did but I must have messed something up. But it didn't really matter, I would need to do the zwave too and one of the functions touches both zigbee and zwave cached variables and I would have to split those up, too. And then I would have to worry about new versions of the app. And I knew I was doing it wrong anyway because the @Field static variables should work (in my opinion). I don't know if its a scope issue or a race issue or what but I finally decided to just ask.
I gave this code to Claude and he/she/they/it made the helpful suggestion (along with some unhelpful ones) to change @Field static to assigning cachedZigbeeDevices and the lastZigbeeCacheTime to state. This seems to have fixed the issue although it may be taking away from the point of using the @Field static assignment in the first place. But it works for me. I made the same change for the ZWave devices.
One more thing. In order to get zwave to work with the last time message you need to change the controllerType from ZW to ZWV. So in the two files, these lines need to be changed.
Device Activity Check 3
Line 352: else if (dev.controllerType == "ZW" && useZwaveInfo) {
Change to else if (dev.controllerType == "ZWV" && useZwaveInfo) {
Device Activity Check 3 Group Child
Line 108: if (settings.devices.any { it.controllerType == "ZW" }) {
Change to if (settings.devices.any { it.controllerType == "ZWV" }) {
DAC isn't causing this -- it's the driver. I believe there were some Z-Wave JS changes that made however the (custom) driver was inferring this change on recent platform versions. It might be able to be addressed at the platform level or perhaps the driver author can change something, but using another detection method is probably a better idea in the meantime, if you even need mains-powered devices in DAC at all.