martijndierckx / homebridge-hydrawise

A homebridge plugin that creates sprinkler accessories for all your Hydrawise zones
13 stars 7 forks source link

TypeError: Cannot read property 'getCharacteristic' of undefined error #26

Closed tarunVreddy closed 2 years ago

tarunVreddy commented 4 years ago

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 4 years ago

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.

joewilliamsca commented 4 years ago

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

gussyboy commented 4 years ago

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)
gussyboy commented 4 years ago

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

SumolX commented 3 years ago

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

SumolX commented 3 years ago

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.

gussyboy commented 3 years ago

Downgraded to 1.1.1

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

martijndierckx commented 2 years ago

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.