PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 43 forks source link

Cannot read property 'on' of undefined #137

Closed jankeesvw closed 6 years ago

jankeesvw commented 6 years ago

I'm not sure what happend, but I'm using homebridge-edomoticz with this docker Docker container https://hub.docker.com/r/marcoraddatz/homebridge/tags/ and suddenly I get this stack trace when booting (the stacktrace is in reverse order)

    at Object.Module._extensions..js (module.js:565:10)
    at Module._compile (module.js:556:32)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
    at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:80:8)
    at Server._configCachedPlatformAccessories (/usr/lib/node_modules/homebridge/lib/server.js:339:24)
    at Object.configureAccessory (/usr/lib/node_modules/homebridge-edomoticz/index.js:247:21)
    at Object.eDomoticzAccessory (/usr/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:75:10)
    at Object.publishServices (/usr/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:83:29)
    at Object.getServices (/usr/lib/node_modules/homebridge-edomoticz/lib/domoticz_accessory.js:1622:84)
TypeError: Cannot read property 'on' of undefined
PatchworkBoy commented 6 years ago

What version of homebridge? (look for the "_id": field in /usr/local/lib/node_modules/homebridge-edomoticz/package.json)

Stop homebridge, Run with DEBUG=* homebridge -D and wait for it to crash, and get the last message received prior to crashing.

jankeesvw commented 6 years ago

I noticed that domoticz_accessory.js:1622 is related to the rain sensor, I tried to disable my weather sensor but that didn't solve the problem unfortunately.

jankeesvw commented 6 years ago

It's fetching the latest version on boot, and the line number matches so I guess it's the lastest version.

PatchworkBoy commented 6 years ago

When did you last boot? There have been 4 version updates today. There is no guessing when it comes to asking for debugging information.

jankeesvw commented 6 years ago

A second ago, is version 2.1.10 the latest?

jankeesvw commented 6 years ago

I should probably also lock a version instead of picking the latest every boot...

PatchworkBoy commented 6 years ago

It is, yes. A UUID has changed for that service on this boot and can’t updated your cached accessory correctly (because the cache tries to match on UUID). Remove ~/.homebridge/accessories/cachedAccessories and restart homebridge and it should hopefully rebuild the cache again.

If that doesn’t work, remove ~/.homebridge/accessories and ~/.homebridge/persist, remove the bridge from your home & re-add.

Sadly when UUIDs have to change it generally always means rebuilding your accessory pool again, hence they don’t get changed frequently if it can be avoided (they’ve been fairly static for 2 years or so, but a lot of the eve-recognised ones changed over that time).

jankeesvw commented 6 years ago

I’ll try that tomorrow, thanks! I’ll close this issue if it works!

jankeesvw commented 6 years ago

Yes it works again! But I had to re add all the Domoticz devices in Homekit.