Device templates

I’m creating a device template for inputs from RFXmeter sensors that just report a “count” value that is the cumulative watt-hours figure. I can’t find any documentation so I’m working from the code and existing examples. Can anyone confirm that this looks correct?

{
  "name": "single-input RFXmeter",
  "category": "RFXcom",
  "group": "Power",
  "description": "1-input RFXmeter",
  "inputs": [
    {
      "name": "count",
      "description": "CT Power 1",
      "processList": [
        {
          "process": "scale",
          "arguments": {
            "type": "ProcessArg::VALUE",
            "value": 0.001
          },
          "process": "kwh_accumulator",
          "arguments": {
            "type": "ProcessArg::FEEDID",
            "value": "power"
          },
        }
      ]
    }
  ],
  "feeds": [
    {
      "name": "power",
      "engine": "Engine::PHPTIMESERIES",
      "unit": "kWh"
    }
  ]
}

I’d feel more comfortable but for a couple of existing templates I’ve found that have a process list along the lines of:

        {
            "name": "wh",
            "description": "Cumulative Energy",
            "processList": [
                {
                    "process": "scale",
                    "arguments": { "type": "ProcessArg::VALUE", "value": 0.001 }
                },
                {
                    "process": "wh_accumulator",
                    "arguments": { "type": "ProcessArg::FEEDID", "value": "ev_energy" }
                }
            ]
        },

I’m a little confused after looking at this one as to why the Wh input would be scaled by 0.001, presumably converting it to kWh and then passed to “wh_accumulator” rather than “kwh_accumulator”, possibly suggesting that I’ve misunderstood something.

Thanks,
James

I realise I forgot part of the confusing example. The “ev_energy” feed referenced in the second process is defined as follows:

            "name": "ev_energy",
            "engine": "Engine::PHPFINA",
            "interval": "30",
            "unit": "kWh"

futher adding to the confusion as the unit specified appears to be inconsistent with using the Wh accumulator.

James

Hello @JasF

Your template using the kwh_accumulator looks fine to me. The kwh_accumulator process was added more recently and it’s probably the case that the example template used the wh_accumulator process because that is the process that was available at the time, your template would be more correct now.

Thank you. I did in the end find a subtle problem with my original template in that I missed out a closing and opening bracket between the two entries in the processList array, but it all seems to be working now and I’m leaving it just to collect a bit of data so I have something to play with in terms of creating graphs etc.

James