Node-RED nodes for hubitat

Anyone using Grafana? I'm trying to figure out why I have both devices going into my influxdb node yet in grafana I can only see/select the bottom node of that debug list from grafana's list?

Because it overwrites the entries maybe rather than accumulates? I don't use Grafana yet but that was my first thought.

Are the "msg.topic"'s the same?

yes they are both going into the "energy" portion of the database, I can see 10 other devices just not the "monthly total" device. listed in that debug. I was trying to see if something different was output as to maybe why?

What is the "msg.topic" you are using for that node or is there some other property you need to define while passing a msg to the Grafana node?

I guess I don't understand. I believe it would be "energy"

You don't need to guess. Put a debug node after it (compete message) and see.

If it is the same as the other non-monthly values then it will likely go into that measurement (depending on how you are sending the values to influxdb that is) and not make a separate measurement item.

1 Like

I should not continue as I am not experienced in Grafana... apologies for jumping in.

Here is the flow I have, I just added the change node to see if it made a difference

If you hover over the item you want, 3 buttons will appear. 1st will copy the path; 2nd will copy value; and 3rd will pin that value open in debug window. If you copy path, you can paste it into your change node.

2 Likes

That's what I did a few posts above

That debug looks like it is msg.payload only not the entire message, unless I'm reading it wrong (I am on my phone, so could be). To see the whole message you have to configure the debug node that way.

I do my node-red to influxdb completely differently, so I might not be much help here. I wanted a very specific influxdb tag/field layout, so I run all my hubitat data through a function node to put it in the right format before it goes to influxdb.

I do this:

Function Node
var newMsg = {};
var fields = {};
var tags = {};
var myArray = [fields, tags];

//myArray[0].test = "test1";
//myArray[1].grade = "grade1";
//node.warn(msg.payload.value);
//node.warn(Number(msg.payload.value));

if (!isNaN(Number(msg.payload.value))) {
    msg.payload.value = Number(msg.payload.value);
}

// Add measurement
newMsg.measurement = msg.payload.name 

// Add fields
myArray[0].value = msg.payload.value;

// Add tags
myArray[1].deviceName = msg.payload.displayName;
myArray[1].deviceId = msg.payload.deviceId;
//myArray[1].attribute = msg.payload.name;
myArray[1].desc = msg.payload.descriptionText;
myArray[1].unit = msg.payload.unit;
myArray[1].type = msg.payload.type;
myArray[1].hub = msg.payload.hub;

// Attach payload
newMsg.payload = myArray;

return newMsg;
3 Likes

That function node did the trick. I just had my hubitat devices going straight into my influxdb node. Now going through the funciton node first I see the device.

Any help on adding multiple node payloads into a combined total payload would be appreciated.

msg.payload = {};
msg.payload.node1 = {name:"node1",value:"28"};
msg.payload.node2 = {name:"node2", value:"node2Value"};
return msg;
1 Like

Or the "join" node if you don't want to write code. Depends on the format you want it in.

2 Likes

His way is more standard, I'm just used to writing my own code for things (old dog new tricks sorta thing... :sunglasses:)

I almost always do joins in a function node, too, actually. Usually because I want it in a certain format that would take too many individual in-box nodes to do (not that you couldn't use in-box nodes though).

1 Like

I tried using the join node couldn't figure it out. There will be alot of devices so a function would probably be better. Sorry for the hand holding request this is a bit over my skill level.
Here is what I have so far.



I'm looking to add the 178 and the 15 from the two devices together and for it to do it automatically when each device updates itself

That gets a wee bit more complicated. I generally go to flow variables

Edit: Flow Removed

I'm getting this error?
format