NodeRed & MQTT

Hi Guys,
I’m trying to push some of my hub stats to homeassistant via MQTT.

I can pull in the value from hubitat but I can’t push it to the mqtt broker… where am I going wrong with this simple flow?

I don’t see anything being output to the debug node ..

  1. You need the value you want to send to MQTT to be in msg.payload. Looks like you may be putting it in msg.arguments?

  2. Remember that the hubitat device node only sends msgs out on value changes, unless it received a msg on its input.

You might want to consider putting an inject node in front of the device node so you can trigger it to send/re-send a value at will. It will speed up your troubleshooting.

If you want to have it refresh/re-populate the MQTT value on reboot/startup, set the inject node to run once on startup after 5 or 10 seconds (to give the hubitat nodes time to initialize).

And even though people say I'm too preachy about this, please make sure you read the online help for the nodes you use. It almost always explicitly defines what valid input, and expected outputs are.

For the "mqtt out" node it specifically says it is expecting msg.payload for the value to write out:
image

3 Likes

@dan-edge

@JasonJoel is exactly right. In this situation, I use a change node that sets the value of msg.payload to the content of msg.payload.value.

3 Likes

Hi Guys,

Thanks for the feedback, I reverted back to my original workflow after I went down a rabbit hole with the set arguments..

I’ve got a timestamp inject and a change node that sets msg.payload to msg.payload.value as suggested

I never see anything on the debug nodes when I inject the timestamp manually or wait for its elapsed time.. the timestamp node is however outputting a timestamp..

:thinking:

What kind of node is that 2nd one, the light green one? I thought originally it was a hubitat device node, and my original advice was based on that, but I just noticed it is a different icon I don't recognize.

So while the advice on msg.payload going into the mqtt out node still applies, I have no idea how whatever that 2nd node is works, or whether an inject going into it would make it send a payload.

Sorry about that.

1 Like

It’s a “hubitat device” node.. could I be using some spurious integration ?

Weird. That is definitely not the default icon for a hubitat device node. Now, icons can be customized, so maybe you did/it was?

Also, what version of node-red, and the hubitat nodes are you using?

Standard hubitat device node looks like this (notice the icon):
image

In any case, if nothing is outputting from the device node when you inject into the input, then something is wrong. Maybe that formatted output field is crashing it/making it error out or something. I've never seen/tried an attribute formatted like that one is.

1 Like

Also, your node details page looks different than any I remember seeing before (unless it is a really old node-red version and I forgot) too... Current/standard installs of node-red don't have collapsible "node properties" and "node settings" headers.

So there is a lot going on here that is different than I would expect.

Should probably start with:

  1. Node-RED version? (menu , then should be listed at bottom of menu)
  2. Hubitat nodes version? (menu -> manage palette, look for the hubitat nodes)
  3. What is node-red installed on? a dedicated vm, rasp pi, inside home assistant (YUCK), other?
1 Like

Instead of using a change node try using a function node.

Screen Shot 2021-05-20 at 5.29.54 PM

And then everything should work.

1 Like

Nothing wrong with that, but that function node does the exact same thing as the change node.

And he said there are no messages coming out of his device node, so I don't think changing to a function node will fix it. He needs to get his device node sending out messages first. :man_shrugging:

2 Likes

Yep, you're right, the device node doesn't look right.

1 Like

Yeah maybe add an inject node before the "device" node that should force things as a test.. but I agree with @JasonJoel something is weird with your HE palette... make sure it is updated.

1 Like

Also make sure you are receiving events in general.. maybe your webhook is misconfigured in the Server Configuration.

1 Like

Thanks Guys - appreciate the help. I’m going to reinstall the Hubitat palette this evening and give things another shot.. the only other thing of note is that I’m reading values from my C7 via hub mesh on a C4 .. which is connected to node red…

You can connect your C-7 to Node-RED as well - one less level of indirection. You can also add multiple maker instances on the same hub too. Lots of possibilities.

Here is my Node-RED HE Server config list.. Note: the "NET Hub" used to be my C-4 but it died and I transferred stuff over to my C-5 temporarily but kept the same config, just changed the settings. This screencap currently shows 2 hubs talking to Node-RED... a C-7 & C-5. C-5 has multiple instances (3) of Maker API and therefore multiple NR configs. Basically a legacy from migration and other stuff.

1 Like

Thanks Guys - I updated node-red and the hubitat palette and everything sprung in to life. Good catch on the icon being different !

3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.