Closed AlCalzone closed 3 years ago
@AlCalzone Could we speak about this? I could create a script that parses the xml and creates the desired JSON files but I would need some help to understand the format and what you expect, also I think that we would need to create a github action that runs scheduled to check for updated config files
I'll see if I can spare some time later
OZW Manufacturer specific: https://github.com/OpenZWave/open-zwave/blob/master/config/manufacturer_specific.xml Config files folder: https://github.com/OpenZWave/open-zwave/tree/master/config
We could use svn to download the config folder svn checkout https://github.com/OpenZWave/open-zwave/trunk/config
IMO we could use xml2json to read manufacturer.xml and then for each manufacturer all it's products (the product file path is specified there). Also the product xml should be readed using xml2json
Are these notes for you or questions for me? ;)
Both 😂 What do you think about it?
Sounds good so far
@AlCalzone I will try to write some code today, would you like me to write it that file or create a new one? How do you run that script actually?
I run it through npm (lerna) commands
lerna run config -- manufacturers
downloads the manufacturer list from the OpenHAB configlerna run config -- download
downloads the entire OpenHAB device config DBlerna run config -- download deviceid
downloads the OpenHAB config for a single devicelerna run config -- import
imports previously downloaded config files (so you can delete or change them before importing)lerna run config -- index
updates the config file indexlerna run lint:config
checks the config files for errors and common problemsWe should probably separate the commands for OpenHAB and OZW imports or add an additional param to distinguish. Feel free to work in that file, as it all belongs together IMO.
@AlCalzone Nice! I think that list of commands would be good to place somewhere in developers docs :)
Just for reference:
lerna run <script>
runs npm run <script>
in all /packages
that contains <script>
in their package.json
, in this case it runs this
Correct - there is only one package with the config
command, so it just runs the one.
It would probably make sense to refactor this - after all the script is in the root maintenance
folder, so we could just put the script into the root package.json
Yes I think we could make it npm run config
and move it to main package.json
@AlCalzone about my idea, If you want the download of ozw things to be made by the script we should use download that's a handy script that downloads files and also allows to decompress them. Using that we could download the openzwave tar.gz
available from https://github.com/OpenZWave/open-zwave/archive/master.tar.gz and make the parsing
Alternatively we could simply add the parsing script there and make the download from github action using svn like my previous example what would you prefer?
I already have axios
in the devDependencies, so there's no need for another download utility. Decompressing could be done by executing the system utility tar
, which should be available on all relevant platforms (Unix and Windows)
Ok so we could use axios for the download and the command tar -xzf master.tar.gz open-zwave-master/config --strip-components=1
to extract the config files from the archive. I would create a .tmp
folder to store downloaded config files that can be empty once finished
Like #411 but with the files from the OpenZWave repo.