Node-RED nodes for hubitat

use a change node and set msg.payload to msg.payload.value.

[{"id":"79390d00.8ceee4","type":"change","z":"35eba7b9.dced28","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.value","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":140,"wires":[["cfd5305e.25c15"]]}]

Oops, that won't fix the whole message you can change your code to read
msg.payload = "Temperature: " + String(msg.payload.value);

1 Like

I would use a Change node in place of the Function node. In the Change node, you can set msg.topic as a simple string. Then for msg.payload, you can use the "J: expression" type, and set it to:

"Temperature: " & msg.payload.value

One other note: When your inject node triggers a Device node, that doesn't actually trigger the device in question to update/refresh. It is simply asking NR for the latest value stored in its cache. If you want to trigger an actual update of the temperature probe, you'd need to trigger a Command node, assuming that your device supports a command such as "Refresh" or "Update."

1 Like

You could also use 2 Template Nodes; one to set the msg.topic and one to set msg.payload. I do that for some notifications. I know it's 2 nodes but I try to avoid Function Nodes when ever I can. :grinning:

1 Like

Excellent, Thanks for the help, I have it tied into Alexa as well, my wife is so excited that I've done this...

2 Likes

You can disable status for all nodes in NR settings, but not for only one.

A workaround is to set the Attribute: all on device node and:

  • if you use input to trigger result: add a change node before to set the attribute
  • if you use event to trigger result: add a switch node to filter events
3 Likes

Side note, off topic. Ultimate Boolean persistence now works as expected on docker installs w/version 1.0.22. :+1:

1.2.22 :slightly_smiling_face:

1 Like

Oooh - my bad. I thought you were saying the update to UBL now worked with 1.2.22 .....

It also works with Node-RED 1.2.2. :slight_smile:

Now that persistence works, I may start actually using Ultimate Boolean now. I should have reported that issue to the author a long time ago...

2 Likes

Thanks. I figured as such
Thats what i ended up doing.. using a switch node after!

Anything particularly important with 1.2.22 that I should upgrade ASAP? Still on 1.1.2!

Upgraded!

Guys, I recently had a couple of crashes of my Pi set up. So damned annoying. Thankfully I had my flows backed up. But after I reinstalled them, I found that the nodes I'd previously installed also had to be reinstalled. No big deal, it didn't take long. But is there a quick way to backup the nodes I've installed too? Sorry if the answer is already above. Too lazy to read through everything again for this specific subject.

Cheers.

On Ubuntu, I have backed up and restored everything under $HOME/.node-red, and it restores the palette and flows.

2 Likes

You can use the projects feature and add the used nodes as dependencies for the project on the backup. Now when restoring I am unsure if it auto downloads as I have never needed to restore but I would guess it does.

1 Like

Ah, cool. Never knew about that. Will take a look.

I use the project feature for this, too. Starting w/node-reed 1.2 you can have it auto update github too after every change (before github update was a manual process).

I'm trying to add a Hue light to my dashboard to have the switch show the state of the input.
I have done this with other lights by adding a change node before the switch changing from msg.payload to msg.payload.value,
However i'm stuck on how to do this with Hue. As 'on' is either true or false.
Ive tried a whole bunch of values but cant get it right. It just wont update the switch
This is the output from hue light node into debug
image

any clues as to what my change node should be??

Are you using the HE node or the Huemagic node? Looks like Huemagic.

Sorry, huemagic nodes