Community
OpenEnergyMonitor

Community

Finding the corresponding feed of a "topic" in Node-RED

Tags: #<Tag:0x00007f6e13dc2fc0> #<Tag:0x00007f6e13dc2e58> #<Tag:0x00007f6e13dc2930>

Hi everyone,

I am currently using Node-RED to catch MQTT channel and send information directly to an other server than Emoncms.
Thanks to MQTT I receive only these kind of informations on each message :

{ "topic": "emon/emonth6/temperature", "payload": "24.9", "qos": 2, "retain": false, "_topic": "emon/emonth6/temperature", "_msgid": "dd6989d2.229678" }

Now, I would like to know the specific feed number of this topic. Is there any way to achieve this using Node-RED ? Do any of you guys know where is located the information ?

Have a great day,
Cheers

Sorry I don’t understand. Please try and explain? Are you trying to find the Emoncms feed ID?

See example nodeRED flow:

This flow should be ready built into the emonPi as standard:

Exactly. I would like to programmatically find the Emoncms feed ID corresponding to a specified “topic” (ex: emon/emonth6/temperature). Currently I manage it manually, but I would really like it to be automatic. Any idea ?

Thanks for the documentation, already used it but I do not remember anything about feed ID in it.

MQTT topics don’t have any particular emoncms feed ID associated with them. The MQTT data appears in the Inputs section of Emoncms (via the MQTT input script) then the user can log the Emoncms Inputs to Feeds. It is at this point that the feed ID is assigned. The Feed ID’s can be obtained via the emoncms API: https://emoncms.org/site/api#input

The same API works for both local and remote emoncms. See example of feed ID in Emoncms:

e.g. use feed is ID 2990 and use_kwh feed is 101700