zwave-js / zwave-js-ui

Full featured Z-Wave Control Panel UI and MQTT gateway. Built using Nodejs, and Vue/Vuetify
https://zwave-js.github.io/zwave-js-ui
MIT License
920 stars 196 forks source link

Disabling zniffer kills the app #3729

Closed zackbcom closed 1 month ago

zackbcom commented 1 month ago

Checklist

Deploy method

Docker

Z-Wave JS UI version

9.13.0

ZwaveJS version

12.9.1

Describe the bug

enabling zniffer and then disabling it will cause the docker container to die.

zwave  | 2024-05-30 03:37:37.483 WARN STORE: scenes.json not found
zwave  | 2024-05-30 03:37:37.505 INFO LOGGER: Cleaning up log files...
zwave  | 2024-05-30 03:37:37.522 INFO APP: Listening on port 8091 protocol HTTP
zwave  | 2024-05-30 03:37:37.543 INFO ZNIFFERMANAGER: Zniffer is DISABLED
zwave  | 2024-05-30 03:37:37.545 INFO MQTT: MQTT is disabled
zwave  | 2024-05-30 03:37:37.554 INFO BACKUP: Backup job started with cron: 0 0 * * *. Next run: 5/31/2024, 12:00:00 AM
zwave  | 2024-05-30 03:37:37.555 INFO BACKUP: Backup job started with cron: 0 0 * * *. Next run: 5/31/2024, 12:00:00 AM
zwave  | 2024-05-30 03:37:37.566 INFO Z-WAVE: Connecting to /dev/zwave
zwave  | Logging to file:
zwave  |        /usr/src/app/store/logs/zwavejs_2024-05-30.log
zwave  | 2024-05-30 03:37:39.382 DEBUG SOCKET: New connection oXpeYRIRzo5Z8rS4AAAC
zwave  | 2024-05-30 03:37:39.383 INFO Z-WAVE: Setting user callbacks
zwave  | 2024-05-30 03:37:39.387 DEBUG SOCKET: New connection T-oFYwslkfKBvFNGAAAD
zwave  | 2024-05-30 03:37:39.428 DEBUG SOCKET: Event INITED emitted to oXpeYRIRzo5Z8rS4AAAC
zwave  | 
zwave  | /usr/src/app/server/lib/ZnifferManager.js:23
zwave  |         return this.zniffer.active;
zwave  |                             ^
zwave  | TypeError: Cannot read properties of undefined (reading 'active')
zwave  |     at ZnifferManager.get started [as started] (/usr/src/app/server/lib/ZnifferManager.js:23:29)
zwave  |     at ZnifferManager.status (/usr/src/app/server/lib/ZnifferManager.js:115:27)
zwave  |     at Socket.<anonymous> (/usr/src/app/server/app.js:509:41)
zwave  |     at Socket.emit (node:events:529:35)
zwave  |     at Socket.emitUntyped (/usr/src/app/node_modules/socket.io/dist/typed-events.js:69:22)
zwave  |     at /usr/src/app/node_modules/socket.io/dist/socket.js:704:39
zwave  |     at processTicksAndRejections (node:internal/process/task_queues:77:11)

To Reproduce

enable zniffer in configs. fill out keys and serial port.

then disable. reload page

Expected behavior

should disable

Additional context

probable fix: https://github.com/zwave-js/zwave-js-ui/blob/1c36405f0265a87acb5057ddef1782115570f66e/api/lib/ZnifferManager.ts#L74

    get started() {
        return this?.zniffer?.active
    }

No response

robertsLando commented 1 month ago

I think this happens only when zniffer is not connected for some reason, thanks for your issue. Fixed

proycon commented 1 month ago

Thanks for the quick fix. I think I'm also running into this currently on the zwavejs/zwave-js-ui:latest image from docker hub (I have zniffer disabled). The image is probably still one version behind. I'll await the new image.

zackbcom commented 1 month ago

All working now, thanks for the fix.