node-red-contrib-influxdb icon indicating copy to clipboard operation
node-red-contrib-influxdb copied to clipboard

Specifying retention policy in function node

Open pkkrusty opened this issue 2 years ago • 1 comments

I've been browsing for a clear example of a function node that specifies tag, values, retention policy, precision that I can work from, but having no luck. I've tried the following, but not seeing anything show up the database.

temp=msg.payload[0];
msg.payload={
    fields: {
        value:temp.count
    },
    tags: {
        device:"Raspberry Pi"
    }
};
msg.retentionPolicy={
    value:"four_weeks"
    };
msg.measurement={
    value:"dbwrites"
    };
return msg;

and

temp=msg.payload[0];
msg.payload={
//    measurement:"dbwrites",
    fields: {
        value:temp.count
    },
    tags: {
        device:"Raspberry Pi"
    }
};
msg.retentionPolicy="four_weeks";
msg.measurement="dbwrites";
return msg;

and

temp=msg.payload[0];
msg.payload=[
    {
        value:temp.count
    },
    {
        device:"Raspberry Pi"
    }
];
msg.retentionPolicy="four_weeks";
msg.measurement="dbwrites";
return msg;

Should specify that entering the retention policy and measurement in the influxdb write node works just fine, but I was hoping to have a more generic influxdb write node that I could link multiple functions to, where RP and Measurement were passed in via functions.

pkkrusty avatar Oct 01 '22 07:10 pkkrusty

Any ideas?

pkkrusty avatar Jan 18 '24 22:01 pkkrusty