Bulk creation of feeds?

Is there any way to create a bunch of feeds, without having to use the GUI to create each one individually?

I have some Govee sensors, each with four values, that I’ve exported from Home Assistant and that has created the Inputs, but now I need to create the corresponding Feeds.

I’d like to be able to do this by writing a few little scripts to munge the data into some CSV or JSON or YAML or whatever format and then feed that to emoncms somehow to create the feeds.

Is this doable?

In the Feed API Help (top right on the Feed Page) - it gives you a sample URL.


I note there is a ‘Options’ parameter, but no documentation I fear as to what options are available.

Setting the Unit would be useful.


I pull this sort of thing off using Node-RED addon in HA. Just pulls everything that is a ‘temperature’ sensor, packages the data into a JSON and sends it across.

I do it for lots of different sensors :slight_smile: I do not create all of them into feeds, but it does mean if I add a new sensor to HA the data just gets sent to emoncms.

Thanks for that, Brian. It looks like it’ll be very helpful. As you say setting the unit is important!


What is engine 5?

And is there any way to connect the feed to some input data?

Is this doing the same kind of thing as the emoncms_history integration? I appreciate the mechanism might be different, but is it producing any different results?

Ah that is the Feed Type (PHPTimeseries etc). Cannot remember which is which number. The settings.ini file might say in the engines section.

Sort of. Using Node-RED I can control the rate of update so I trigger these to send a new value every 30s. I also send a time with it so all the items get the same timestamp in emoncms.

I’ve just taken a look at the code. The options appear to be handled in Modules/feed/feed_model.php and they don’t seem very helpful. For engine types Engine::MYSQL and Engine::MYSQLMEMORY you can have name, type or entry (whatever they mean) and for engine type Engine::PHPFINA you can have interval as per the example. So not much help there.

Some way to set the unit and some way to link the feed to an input would be useful :imp:

Somewhere else I found a statement that PHPFina is 5 and PHPTimeSeries is 2.

I just took another look at the code. Using the Feed API page as an example I modified the code in feed_api_obj.php to add a new line after line 137 (and a comma at the end of that line!):

    "options" => array( "default" => json_encode(array("interval"=>10))),
    # djh 2024-04-03 added unit
    "unit" => array( "default" => "W" )

And that works. So there is a way to set the unit; it’s just not shown for some reason.

I’m currently confused because there’s nothing in the GET request to apache to indicate from which input to create this feed. So not very clear at all. I suspect there’s a load of complication buried there.