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
944 stars 203 forks source link

Associations always empty when doing Advanced → Export json #2869

Open melyux opened 1 year ago

melyux commented 1 year ago

Checklist

Deploy method

Docker

Z-Wave JS UI version

8.6.2.faa2543

ZwaveJS version

10.3.1

Describe the bug

Many of my devices are in groups. However, doing an "Export json" for any given node does not include its groups. The "associations" key is invariable empty, and these associations don't seem to be found anywhere else in the json.

"associations": {},

To Reproduce

Add an association for a node. Do Advanced → Export json. No indication of the association in the json file.

Expected behavior

The device associations should be included in the json so that it will represent a complete backup of the device configuration.

Additional context

No response

robertsLando commented 1 year ago

Associations are only queried when you open the associations tab on the node for performances reason

melyux commented 1 year ago

Exporting the node as JSON is a very rare operation, so I don't think performance would come into it. Right?

robertsLando commented 1 year ago

The json you see there is just the informations that are actually available about that node, did you tried to open the associations tab and then try to export the node? Does that populates associations correctly?

melyux commented 1 year ago

Just tried it, it doesn't seem to work. The associations remain empty

robertsLando commented 1 year ago

ok just checked in the code and you are right them are not a property of node. Could I ask you why you need them there? If it's for debugging purposes you could simply press F12 on chrome and check the response of getAssociations socket call

melyux commented 1 year ago

I had to migrate Z-Wave sticks and needed a full copy of all the configurations I made to all my devices, so I could replicate them when pairing them with the new stick. I wish there were a "back up all configurations" and "restore all configurations" button, but in lieu of that, I just exported the JSON of each device one by one. Since there's also no "import JSON" button either, I had to go through the JSON of each device and try to human-read the configurations and re-apply them one by one. That's when I found that associations hadn't been exported, so I had lost that data permanently

robertsLando commented 1 year ago

That's when I found that associations hadn't been exported, so I had lost that data permanently

Ok now I got it, giving your example I think it makes sense to add them to the node, BTW giving that retriving associations could be an expensive process would it be good for you if them are present just after you open the associations tab? I could also provide you a script to refresh them on all nodes using a driver function if/when needed

melyux commented 1 year ago

I think it would work for me, but only me, since it wouldn't be very intuitive or discoverable. How about this: when you do "Export JSON", the associations should be loaded before the JSON is exported?

robertsLando commented 1 year ago

How about this: when you do "Export JSON", the associations should be loaded before the JSON is exported?

Yeah could be an alternative. BTW there is also dump nodes that should do that for all nodes in that case

melyux commented 1 year ago

thanks, I was still on the zwavejs2mqtt image and see the "Dump" option now in the newer ZWaveJS image. (No associations support on that yet either, of course, but very useful already and will be even more with this enhancement)