Open nodecentral opened 1 year ago
Thanks for the report, I think this bug was introduced in my recent refactor. That's what I get for not having any tests 😅 I'll look into it later this week or this weekend!
@nodecentral Can you turn on Debug logging in Homebridge (UI X) settings, and share the full logs the next time this happens again? I'd like to understand more clearly exactly what the properties are of the accessory that's being updated when this error occurs.
I'm seeing a similar issue. I will open a new issue report since the output is different. I have just enabled debug logging on my homebridge.
Was there ever a fix for this?
The error seems caused due to lack of type definition in this function
Then in the constructor of a child class of AccessoryHandler
arose.
I tried to add type definition
function ensure<K, V>(map: Map<K, V>, uuid: K, updater: (item: NonNullable<V>) => void, builder: () => V) {
let item: V | null = map.get(uuid) || null;
if (item) {
updater(item);
} else {
item = builder();
if (item) {
map.set(uuid, item);
}
}
return item;
}
but a type error arose from ensureAccessoryHandler
method
I got stuck here because I'm not familiar with this repo. IMHO, I'd suggest the maintainer start from fixing the type errors
I'm still getting this error, or one like it..
Unhandled rejection TypeError: Cannot read properties of undefined (reading 'updateCharacteristic')
at ClientAccessoryHandler.update (/usr/lib/node_modules/homebridge-unifi-occupancy/src/accessory_handler.ts:147:21)
at UnifiOccupancyPlatform.updateAccessoryHandler (/usr/lib/node_modules/homebridge-unifi-occupancy/src/platform.ts:374:29)
at /usr/lib/node_modules/homebridge-unifi-occupancy/src/platform.ts:362:12
at Map.forEach (
Nothing visible that i can see, however I am still setting things up..
Unsure how to explain what it is, but have included the logs below..
It happens after a while, so it seems to be periodic,
Expected behavior:
No errors :-) ?
Logs:
Plugin Config:
Screenshots:
Environment: