Page 1 of 1

What is wrong with this module.json

Posted: 29 Mar 2015 18:06
by pz1
I have started a new module on the basis of an existing. The module is visible under Devices (create device) with the correct module description. Unfortunately in the next step after selecting the module and setting the name I expected to come to the module configuration settings. But there it just stops and hangs. No configuration interface fields to be filled in step 3.
solqos.PNG
solqos.PNG (7.82 KiB) Viewed 7094 times
Probably something stupid again, but I still don't see it after looking off an on for a couple of days. (Developers Manual does not yet have the info to double check my config either)

module.json

Code: Select all

{
	"dependencies" : [],
	"singleton" : false,
	"category" : "devices",
	"author" : "author",
	"homepage" : "",
	"icon" : "",
	"version" : "0.0.2",
	"maturity" : "beta",
	"repository" : {
		"type" : "",
		"source" : ""
	},
	"defaults" : {
		"title" : "SolQoS",
		"description" : "Combine several sensors into one variable",
		"polling" : ""
	},
	"schema" : {
		"type" : "object",
		"properties" : {
			"polling" : {
				"type" : "select",
				"required" : true
			},
			"iconpath" : {
				"type" : "string",
				"required" : true
			},
			"pvlogger1" : {
				"type" : "string",
				"required" : true
			},

			"pvlogger2" : {
				"type" : "string",
				"required" : true
			}
		},
		"required" : true
	},
	"options" : {
		"fields" : {
			"polling" : {
				"label" : "polling (minutes)",
				"placeholder" : "5"
			},
			"iconpath" : {
				"label" : "IconPath",
				"placeholder" : "htdocs/user"
			},
			"pvlogger1" : {
				"label" : "PVlogger a",
				"placeholder" : "PVLogger_1",
				"helper" : "Supply base name (e.g. PVLogger_24) for first logger as can be found under preferences/widgets"
			},
			"pvlogger2" : {
				"label" : "pvlogger b",
				"placeholder" : "PVLogger_2",
				"helper" : "Supply base name (e.g. PVLogger_25) for second logger as can be found under preferences/widgets"
			}
		}
	}
}

Re: What is wrong with this module.json

Posted: 01 Apr 2015 22:02
by pz1
no one?

Re: What is wrong with this module.json

Posted: 01 Apr 2015 22:10
by pofs
You may want to look at module.json for DummyDevice.

Specifically, you don't have types specified in "fields" section, and there's no "select" type in "schema" (it should be "enum" instead).

Re: What is wrong with this module.json

Posted: 02 Apr 2015 09:59
by pz1
I did take OpenWeather as the base example for my modules. That does not have type information in the options-fields section, and they work fine.

So I just changed the select in the schema section to string. That indeed did the trick.
Thanks!

Re: What is wrong with this module.json

Posted: 02 Apr 2015 14:21
by pz1
One more question about module.json in general:

What is the first item "dependencies" : [], used for?

The reason I am asking is that this module.json file is intended for a userModule that monitors Quality of Service of my two solar systems. Therefor this module requires two instances of the PVLogger userModule.

Is that the kind of intended use?

Re: What is wrong with this module.json

Posted: 02 Apr 2015 23:03
by pofs
AFAIR, it has something to do with modules' load (don't confuse with instantiate) order. But I'm not a JS developer, so could be wrong.

Re: What is wrong with this module.json

Posted: 03 Apr 2015 13:09
by dolpheen
pz1 wrote:What is the first item "dependencies" : [], used for?
As it's seen from examples modules, it's used to list modules that your module depends on :)
Ex. if your module use 'cron' module for time scheduling so it needs the 'cron' to be instantiated before your module run.

Re: What is wrong with this module.json

Posted: 03 Apr 2015 15:02
by pz1
Thanks for the confirmation. ScheduleScene does not have it though ;) , but BatteryPolling indeed specified the dependency.