What is wrong with this module.json

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

What is wrong with this module.json

Post 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 7095 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"
			}
		}
	}
}
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: What is wrong with this module.json

Post by pz1 »

no one?
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: What is wrong with this module.json

Post 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).
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: What is wrong with this module.json

Post 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!
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: What is wrong with this module.json

Post 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?
pofs
Posts: 688
Joined: 25 Mar 2011 19:03

Re: What is wrong with this module.json

Post 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.
dolpheen
Posts: 119
Joined: 10 Feb 2015 00:38

Re: What is wrong with this module.json

Post 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.
Razberry B+ 2.0.1-rc25 on ZW500 + 15 devices / Razberry B 2.0.1-rc25 on ZW300 for test
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: What is wrong with this module.json

Post by pz1 »

Thanks for the confirmation. ScheduleScene does not have it though ;) , but BatteryPolling indeed specified the dependency.
Post Reply