Page 1 of 1

enum device metrics in module.json?

Posted: 05 Apr 2017 13:17
by piet66
Hello,
is it possible to enum the metric names of a special device in module.json? I want to give the operator a list of possible metric names depending on a choosen device. But I didn't found any solution. :(

At the moment the metric is entered as a string. My module.json looks like this:

Code: Select all

"sensors" : {
    "items" : {
        "fields" : {
            "device": {
                "label" : "__device-label__",
                "helper" : "__device-helper__",
                "type": "select",
                "datasource": "namespaces",
                "field": "optionLabels",
                "optionLabels": "namespaces:devices_sensorMultilevel:deviceName"
            },
           "metric" : {
               "label" : "__metric-label__",
               "helper" : "__metric-helper__"
          }
and

Code: Select all

"sensors" : {
    "items" : {
        "properties" : {
            "device": {
                "field": "enum",
                "datasource": "namespaces",
                "enum": "namespaces:devices_sensorMultilevel:deviceId",
                "required": true
    	    },
           "metric" : {
               "type" : "string",
               "required" : false,
               "default" : "level"
           }

Re: enum device metrics in module.json?

Posted: 09 Apr 2017 17:07
by piet66
Nobody knows?
It would already be helpful, if anybody can tell, it's possible or it's not possible.