# What is the feed template for a device with a virtual feed

**URL:** <https://community.openenergymonitor.org/t/what-is-the-feed-template-for-a-device-with-a-virtual-feed/13297>\
**Category:** Applications\
**Tags:** device\
**Created:** [12 February 2020 02:16 UTC](https://community.openenergymonitor.org/t/what-is-the-feed-template-for-a-device-with-a-virtual-feed/13297 "2020-02-12T02:16:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MyForest](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/myforest/32/16336_2.png) [@MyForest](https://community.openenergymonitor.org/u/MyForest)\
**Post date:** [12 February 2020 02:16 UTC](https://community.openenergymonitor.org/t/what-is-the-feed-template-for-a-device-with-a-virtual-feed/13297/1 "2020-02-12T02:16:37Z")

</div>

Hi @TrystanLea and @johncantor I suspect you’ll both have well-informed opinions on this.

I have an Ecodan and for four months I’ve been tinkering and I have it running well. I’m trying to share what I’ve done and OpenEnergyMonitor seems like a good way to begin. I like how you have both been sharing your experiences.

Somewhat surprisingly, I’m actually controlling it entirely with MELCloud and not using any local control hardware. I did get an MMSP package installed so that means the installer fitted a flow meter and heat meters. As you know the UK government is funding these at the moment.

Anyway…I have a device file which Emoncms’ “device” module can import. It is setting up the inputs and feeds. No surprises there. I’m POSTing all my stats since October that I snaffled from MELCloud.

So, we’re all good. Except that I keep changing my mind about how to structure things. I thought it would help to import the raw inputs and then create virtual ones for things such as “heatpump\_elec”.

I started creating a virtual feed template like this:

> ```
> {
> "name": "heatpump_elec",
> "type": "DataType::REALTIME",
> "engine": "Engine::VIRTUALFEED",
> "processList": [
> {
> "process": "source_feed_data_time",
> "arguments": {
> "type": "ProcessArg::FEEDID",
> "value": "HeatingEnergyConsumedRate1"
> }
> }
> ],
> "unit": "W"
> },
> 
> ```

but when I load it up the summary is “undefined” in a red pill (assumedly because [prepare\_feed\_processes](https://github.com/emoncms/device/blob/49070216a273a27820a76393939cb1b493be57a8/device_template.php#L223) doesn’t like it). As you can tell, I’m trying to target the auto-populating fields in the “My Heat Pump” app which is working nicely.

I’ll admit I made up the “process” value after hacking around. I know JavaScript and PHP so deduced that this is likely to be plausible.

Of course it all works fine if I manually configure the virtual feed, but where’s the fun in that? I’m hoping to use Trystan’s device module to make this easier for others in the future.

I found [some old examples](https://github.com/brultech/device/blob/b3a0849f040daa81b3b574a37c3ab09688595348/data/gem_direct.json#L1565), but I suspect they might be outdated.

I’ve been digging around for a number of hours and thought it was about time to call in some well-informed heads to guide me.

Perhaps Trystan will just tell me to use postprocess and stop trying to be clever with virtual feeds.

David Bowen

---

<div class="post-metadata">

**Author:** ![TrystanLea](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/trystanlea/32/31_2.png) [@TrystanLea](https://community.openenergymonitor.org/u/TrystanLea)\
**Post date:** [12 February 2020 08:54 UTC](https://community.openenergymonitor.org/t/what-is-the-feed-template-for-a-device-with-a-virtual-feed/13297/2 "2020-02-12T08:54:42Z")

</div>

Hello @MyForest

Great to hear your experience and efforts with the EcoDan and monitoring.

I’m not that knowledgeable on virtual feeds unfortunately, I do do all my configuration with either input processing or sometimes post processing.

The best person to ask about Virtual feeds is @nchaveiro but the issue with the device module template may well result from more recent development that I helped with.

I tried the following full template and could replicate what you describe so it looks like this is a bug. I have created an issue here to keep track of this one [Creation of device templates with virtual feeds does not work · Issue #51 · emoncms/device · GitHub](https://github.com/emoncms/device/issues/51)

```
{
    "name": "VirtualFeedTest",
    "category": "VirtualFeedTest",
    "group": "VirtualFeedTest",
    "description": "VirtualFeedTest",
    "inputs": [
        {
            "name": "raw_input_1",
            "description": "raw_input_1",
            "processList": [
                {
                    "process": "log_to_feed",
                    "arguments": { "type": "ProcessArg::FEEDID", "value": "raw_feed_1" }
                }
            ]
        }
    ],

    "feeds": [
        {
            "name": "raw_feed_1",
            "type": "DataType::REALTIME",
            "engine": "Engine::PHPFINA",
            "interval": "10",
            "unit": "W"
        },
        {
            "name": "virtual_feed_1",
            "type": "DataType::REALTIME",
            "engine": "Engine::VIRTUALFEED",
            "processList": [
                {
                    "process": "source_feed_data_time",
                    "arguments": {
                        "type": "ProcessArg::FEEDID",
                        "value": "raw_feed_1"
                    }
                }
            ],
            "unit": "W"
        }
    ]
}
```

---

<div class="post-metadata">

**Author:** ![MyForest](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/myforest/32/16336_2.png) [@MyForest](https://community.openenergymonitor.org/u/MyForest)\
**Post date:** [12 February 2020 11:38 UTC](https://community.openenergymonitor.org/t/what-is-the-feed-template-for-a-device-with-a-virtual-feed/13297/3 "2020-02-12T11:38:28Z")

</div>

Awesome, thanks Trystan, that’s a very fast response.

This isn’t blocking me - I can re-design my stuff and keep re-playing the old data through until I get the design right. So please don’t panic too much about fixing it if you’ve got other things to sort out at the moment.

Keep up the good work.
