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

nodes.json import fails due to empty JSON object #156

Closed
1 of 3 tasks
phrz opened this issue Jan 5, 2021 · 0 comments · Fixed by #165
Closed
1 of 3 tasks

nodes.json import fails due to empty JSON object #156

phrz opened this issue Jan 5, 2021 · 0 comments · Fixed by #165
Assignees
Labels
bug Something isn't working

Comments

@phrz
Copy link

phrz commented Jan 5, 2021

Version

Build/Run method

  • Docker
  • PKG
  • Manually built (git clone - npm install - npm run build )

zwavejs2mqtt version: zwavejs/zwavejs2mqtt:latest as of today (2021-01-05)

Describe the bug
Following migration instructions here, I took my nodes.json file from my previous z2m installation and imported it in the zjs2m UI. It properly applied names to nodes up to a certain device, after which no names were imported. When I tried importing nodes.json a second time to see if that would load all the names, I got a toast at the bottom saying the configuration was invalid.

Opening up the nodes.json file from z2m, I saw null values for all the removed nodes that were unnamed, and I looked for the last node whose name imported successfully. Immediately following that node was an empty object rather than a null value: {}. z2m inserted this empty object here, but zjs2m did not anticipate it in the importer.

To Reproduce
Steps to reproduce the behavior:

  1. Take a nodes.json file that zjs2m would otherwise tolerate.
  2. Replace any element in the top-level array with an empty object, {}.
  3. Go to the 2js2m Web UI and click the "Import nodes.json Configuration" button
  4. Select the pathological nodes.json file that you've created in step 1.

Expected behavior
The nodes.json importer should work fine with such a file, as z2m created it like this. More specifically, it should treat an empty object (or a non-conforming object without the necessary keys) the same as null: skip over it and increment the ID.

Additional context
My workaround for this issue was to replace the empty object with null before importing my nodes.json file again. This worked fine as a quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants