zwave-js-ui icon indicating copy to clipboard operation
zwave-js-ui copied to clipboard

Associations always empty when doing Advanced → Export json

Open melyux opened this issue 2 years ago • 10 comments

Checklist

  • [x] I am not using Home Assistant. Or: a developer has told me to come here.
  • [x] I have checked the troubleshooting section and my problem is not described there.
  • [x] I have read the changelog and my problem is not mentioned there.

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

melyux avatar Jan 04 '23 18:01 melyux

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

robertsLando avatar Jan 05 '23 10:01 robertsLando

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

melyux avatar Jan 05 '23 10:01 melyux

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?

robertsLando avatar Jan 05 '23 13:01 robertsLando

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

melyux avatar Jan 06 '23 02:01 melyux

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

robertsLando avatar Jan 09 '23 10:01 robertsLando

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

melyux avatar Jan 09 '23 19:01 melyux

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

robertsLando avatar Jan 10 '23 07:01 robertsLando

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?

melyux avatar Jan 10 '23 07:01 melyux

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

robertsLando avatar Jan 10 '23 07:01 robertsLando

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)

melyux avatar Jan 15 '23 10:01 melyux