bitfocus / companion-module-novastar-controller

This module controls some Novastar devices.
MIT License
16 stars 15 forks source link

Module crash #43

Closed istnv closed 1 year ago

istnv commented 1 year ago

Stable and beta modules crash:


error: Trace: Init failed: TypeError: Cannot read properties of undefined (reading 'brightness')
    at /home/companion/companion-x64/resources/bundled-modules/novastar-controller/main.js:2:234575
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /home/companion/companion-x64/resources/bundled-modules/novastar-controller/main.js:2:214418`

Steps:
add module, add action to a button, restart companion, module crash.
istnv commented 1 year ago

Actions are filtered by modelID to remove commands that are not available on certain units. However, the action itself uses instance.model which is created here:

https://github.com/bitfocus/companion-module-novastar-controller/blob/99d33b47371c30ad57e721396c20a69c8f1687ee/index.js#L74 ---- from this definition for the mctrl4k ---- https://github.com/bitfocus/companion-module-novastar-controller/blob/e45ee504f564132e3d3f35e660849bf92879b140/choices.js#L325

Since id does not match the object key, instance.model is undefined and throws an error when building the actions in actions.js

Two ways to fix this: