Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin causes Homebridge v1.3.0 beta to crash #37

Open
mlamoure opened this issue Jan 2, 2021 · 5 comments
Open

Plugin causes Homebridge v1.3.0 beta to crash #37

mlamoure opened this issue Jan 2, 2021 · 5 comments

Comments

@mlamoure
Copy link

mlamoure commented Jan 2, 2021

Hello -

I answered the call for testers for the v1.3.0 beta of homebridge. Updating results in a crash loop for me with the following in the logs:

[1/2/2021, 2:16:23 PM] TypeError: Cannot read property 'omitEventUpdate' of null at Bridge.Accessory.handleCharacteristicChangeEvent (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1808:100) at Accessory.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:552:84) at Accessory.emit (events.js:315:20) at Accessory.handleCharacteristicChangeEvent (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1797:12) at Service.emit (events.js:315:20) at Characteristic.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Service.ts:669:12) at Characteristic.emit (events.js:315:20) at Object.0.03283219355104894 (/homebridge/node_modules/@miblanchard/homebridge-big-ass-fans/index.js:180:20) at BigAssProperty.<anonymous> (/homebridge/node_modules/@miblanchard/homebridge-big-ass-fans/node_modules/BigAssFansAPI/BigAssApi.js:158:48) at BigAssFan.<anonymous> (/homebridge/node_modules/@miblanchard/homebridge-big-ass-fans/node_modules/BigAssFansAPI/BigAssApi.js:319:36)

@jmissig
Copy link

jmissig commented Jan 2, 2021

I saw the same issue, thanks for reporting

@Supereg
Copy link

Supereg commented Jan 3, 2021

The problem is this line

thisChar.emit('change', {
oldValue:thisChar.value,
newValue:getOutputMapping(newValue),
context:null });
}
.

A plugin MUST NOT fire the change event manually. This is NOT public API.
For such scenarios where you want to push an updated value to HomeKit, use characteristic.updateValue(...).

@mlamoure
Copy link
Author

mlamoure commented Jan 4, 2021

The problem is this line

thisChar.emit('change', {
oldValue:thisChar.value,
newValue:getOutputMapping(newValue),
context:null });
}

.
A plugin MUST NOT fire the change event manually. This is NOT public API.
For such scenarios where you want to push an updated value to HomeKit, use characteristic.updateValue(...).

Understand the plugin is calling a private event here. Is there a way to mitigate where this does not cause a crash of Homebridge, or has the private event changed since prior to 1.3 and now the crash is because it's being called incorrectly despite never being intended to being called by a plugin in the first place?

Does anyone know if this plugin is actively maintained? I see a number of outstanding PR's for the motion sensor and no recent commits.

@Supereg
Copy link

Supereg commented Jan 4, 2021

[...] has the private event changed since prior to 1.3 and now the crash is because it's being called incorrectly despite never being intended to being called by a plugin in the first place?

That is exactly what is happening. I see if I may be able to mitigate that.

EDIT: Indeed latest beta should not crash anymore, as of this.

However the plugin MUST still change that, as emitting a change event does not properly persist the value in the characteristic cache.

@mlamoure
Copy link
Author

mlamoure commented Jan 4, 2021

@Supereg confirmed beta 41 does not crash. thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants