#How do you make configuration/global variables in Node-RED that are configured once?

1 messages · Page 1 of 1 (latest)

broken pebble
#

I have a handful of IKEA buttons where I'm using their ID to identify which button is pressed. But this isn't nice to update if I need to change things. Is there a way to make a global configuration variable where I can configure it and then just reference the variable/configuration in my nodes?

Alternatively, are there other better solutions?

gusty owl
#

Hi. This video explains how to create context variables, including global ones. You may need to setup a restart-driven flow to initialize them. https://youtu.be/IpwihQf6Kqo?si=hkNPs4H0AVkqSZr-

Working with contexts, flow and global variables in Node-RED is a valuable skill when building complex automations.

Using JSON and JavaScript makes it a fairly intuitive experience in Node-RED.

I show you examples using the Change Node and the Function Node; these are both very useful nodes.

Check out my video on the Function Node: https://yo...

▶ Play video