martijndierckx/homebridge-hydrawise

TypeError: Cannot read property 'getCharacteristic' of undefined error

Closed this issue · 8 comments

Using the latest homebridge (1.1.2) docker on top of Centos 7.

I am regularly getting this error in my console.

[8/17/2020, 8:45:27 AM] [Hydrawise] TypeError: Cannot read property 'getCharacteristic' of undefined
    at new HydrawiseSprinkler (/homebridge/node_modules/homebridge-hydrawise/src/HydrawiseSprinkler.ts:62:17)
    at /homebridge/node_modules/homebridge-hydrawise/src/HydrawisePlatform.ts:117:30
    at Array.map (<anonymous>)
    at /homebridge/node_modules/homebridge-hydrawise/src/HydrawisePlatform.ts:93:13
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

From the code, it looks like maybe it is using two different Characteristics to get the same state, maybe for backwards compatibility? Is there a way we can put an if clause to clean up when it should use the correct getCharacteristic?

// Set initial states
        service.getCharacteristic(that.platform.api.hap.Characteristic.Active).updateValue(that.zone.isRunning);
        service.getCharacteristic(that.platform.api.hap.Characteristic.InUse).updateValue(that.zone.isRunning);
AD4MD commented

Hey I just wanted to mention that I also get this error message. I am mentioning it because ticket #23 was closed with the user assuming the error was on his end.

I was the one who closed ticket 23. I was running into a situation where my hunter controller would reboot multiple times a day, when using the local setting for the plugin, so I chalked this up to a bad controller

I'm also getting this error with one of my zones, I only installed my controller on Saturday and it was fine until this morning (Monday).

[11/2/2020, 9:24:02 AM] [Hydrawise] TypeError: Cannot read property 'getCharacteristic' of undefined
    at new HydrawiseSprinkler (/homebridge/node_modules/homebridge-hydrawise/src/HydrawiseSprinkler.ts:62:17)
    at /homebridge/node_modules/homebridge-hydrawise/src/HydrawisePlatform.ts:117:30
    at Array.map (<anonymous>)
    at /homebridge/node_modules/homebridge-hydrawise/src/HydrawisePlatform.ts:93:13
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)

@martijndierckx do you have any feedback on this one for us?

Same here... i rebooted my homebridge container on my synology and I'm seeing the same error.

Downgraded to 1.1.1 and all is working fine and I no longer see these errors. I tried downgrading v2.x a few times but the errors just continued.

Downgraded to 1.1.1

Isn't 1.1.1 the latest version of this package anyway?

I've had the issue myself as well now. Seems that somehow sometimes the cached list of accessories can get corrupted. So I've tried to write a workaround which will re-add the sprinkler in v1.2.0.

But, if you still get this error, try to remove the cached sprinkler accessories.