koush / scrypted

Scrypted is a high performance video integration and automation platform
https://scrypted.app
Other
3.91k stars 237 forks source link

[Alexa Plugin] syncedDevices StorageSetting not created automatically #1418

Closed lippertmarkus closed 3 months ago

lippertmarkus commented 3 months ago

Describe the bug Alexa Plugin fails to store the endpoints because the syncedDevices storage setting is not present after installation of the plugin

To Reproduce Steps to reproduce the behavior:

  1. Install the Alexa Plugin
  2. Enable the Skill via Alexa app
  3. Observe errors like the following in the console when there are events (motion, button press, etc.):
    unhandledRejection TypeError: a is not iterable
    at h.saveEndpoints (/src/main.ts:361:33)
    at h.syncEndpoints (/src/main.ts:349:20)
    at process.this (node:internal/process/task_queues:95:5)
    at h.start (/src/main.ts:95:17)
    unhandledRejection TypeError: Cannot read properties of undefined (reading 'includes')
    at h.deviceListen (/src/main.ts:153:56)
    at h.<anonymous> (/src/main.ts:93:22)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
  4. Check the Plugin storage and see that the key syncedDevices isn't available, leading to the above errors.

Expected behavior syncedDevices should be automatically created with an empty array [] as content

Screenshots If applicable, add screenshots to help explain your problem.

Server (please complete the following information):

Hardware Model (please complete the following information):

Additional context The workaround is to create a key syncedDevices in the storage with value []

koush commented 3 months ago

fixed 2dd549c0