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

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 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, 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

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

{
    "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"
        }
    ]
}

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.

1 Like