Is there a dynamic way to set a nodes configuration node?

I am using the excellent "node-red-contrib-hubitat" nodes for communicating with my home automation hubs. Each hub connection requires a config node which is to be expected. I would like to be able to dynamically change a certain node instance's config to different one before sending a message to it - is this possible?

Currently my workaround is having a bunch of subflows with big switch statements - while not ideal because things are hard-coded it works. My other thought would be forking the existing nodes to build in that capability but wanted to check with the community to see if there were an easier way. Do not really want to bear the burden of maintaining a whole separate bunch nodes when the existing ones work great.

Hope I am making sense here!

I may not be understanding fully what you mean, but here goes:

These hubitat nodes want a configuration node to set them up.

Why not get/use a change node that reads flow.context variables to set the desired values?

Something like this:

[{"id":"eb15546eb5e6683f","type":"inject","z":"65c9b63cb09879a0","name":"Signal to update/change variables in hubitat node","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":1410,"y":2430,"wires":[["2bb68fee1ebe7217"]]},{"id":"2bb68fee1ebe7217","type":"change","z":"65c9b63cb09879a0","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"something","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":1490,"y":2500,"wires":[["0d96704ecddcde1f"]]},{"id":"0d96704ecddcde1f","type":"debug","z":"65c9b63cb09879a0","name":"To hubitat node","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1690,"y":2500,"wires":[]}]

The inject node would be replaced with a signal indicating you want to update things.
And the debug node is there only to look nice. :wink: But it goes to the hubitat node and sets what is to be changed.

1 Like

Thanks for your response! Yeah I might not have been clear about this.. The Hubitat "command" node for example requires me to set a certain config at deployment which points to a specific "hub" instance. This is locked in as far as I know. I can either select a device after selecting a config at deployment or pass a "msg.deviceId" to get a device that is tied to that hub/config. I cannot send a "msg.hubconfig" to select a hub which is a problem if you have multiple hubs like I do. I was looking for a run-time way of changing the particular node instance's config property..

edit: I may have to see about tweaking the nodes and submitting a pull request but am a little leery about jumping off the deep end of the pool in that regard.

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