config.json, loadObject, etc. We Really Need Better Docs!

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
markolbert
Posts: 64
Joined: 16 Oct 2014 06:09

config.json, loadObject, etc. We Really Need Better Docs!

Post by markolbert »

In my effort to try and decipher how z-way-server is put together I came across this line from the docs:
The automation folder consists of several files and subdirectories. The most important file
of the automation is called config.json. This file contains the information about all automation
modules and their instances. This file is automatically generated and should be changed without
proper knowledge.
So I figured I'd check out config.json and see if, I don't know, maybe it contained information on what modules to load (I'm trying to create a module which will bind to various devices and raise events whenever a light turns on or off).

Only there is no config.json file that I can find, anywhere in the system. I say this because I tried:

Code: Select all

sudo find / -name "config.json"
and it couldn't find the file. Pretty weird for a file that's that critical :).

I then took a look at main.js. It contains this:

Code: Select all

config = loadObject("config.json") 
so clearly an attempt is made to load config.json. But how does loadObject work?

That's hard to tell, too. Because I could not find any definition of loadObject in my system, either. And a google search didn't turn up anything that looked promising.

I really hope the developers get around to writing some better docs, with examples, one of these days. It'd be sad for the z-way project to disappear because no one can extend it or utilize it.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: config.json, loadObject, etc. We Really Need Better Docs

Post by pz1 »

You are absolutely right in your conclusins.

config.json is their shorthand for:

Code: Select all

/opt/z-wa-server/automation/storage.configjson-06b2d3b23dce96e1619d2b53d6c947ec.json
The alfa-numeric part may be different for you. Why it needs to be there I don't know.
Since 29-12-2016 I am no longer a moderator for this forum
User avatar
PoltoS
Posts: 7649
Joined: 26 Jan 2011 19:36

Re: config.json, loadObject, etc. We Really Need Better Docs

Post by PoltoS »

Alphanumeric is same for you. It is MD5 of the name and is needed since object name in JS can have almost any character, while filesystem can't. So, we strip all unwanted chars, but to avoid colision of two similar names we add MD% from the original. Like to avoid config-json and config.json and config/json to become same configjson.

As for the doc, totally agree with you! This comes from old times where the file was indeed config.json.
Post Reply