Remember that I am embedding Grafana panels in Node-RED dashboard. Since there is no time selector in Node-RED, I defined some time variables in javascript like this:
var p_30d = 1000*60*60*24*30 ; //30 Days
var p_7d = 1000*60*60*24*7 ; //7 Days
var p_1d = 1000*60*60*24 ; // 1 Day
var p_hr = 1000*60*60; //1 Hour
var d = new Date();
var current = d.getTime();
msg.fromdate = "now-" + msg.payload +"h";
msg.enddate = "now";
return msg;
I fed the above into a dashboard template node that contains this:
panelid=6
msg.payload= "https://192.168.9.224:3000/d-solo/JN4PSLnnz/furnace-12?orgId=2"+
"&refresh=1m"+
"&theme=dark"+
"&from="+ msg.fromdate +
"&to="+ msg.enddate +
"&panelId="+panelid
return msg;
Here is what the flow looks like:
and here is the what the dashboard looks like: