Just created node (not saved) and RED.nodes.getNode


  1. own created node.
  2. drop my node to flow
  3. set configuration in the field
  4. trying lookup some information based on configuration field
    server: { value: "", type: "hc2-server-config", required: true },
    (ip/login/pwd) via Fibaro Home Center
  5. code
    var node = RED.nodes.getNode(req.params.id);
    if (node !== null && typeof node !== "undefined") {

so, if flow with this node is NOT saves - node is NULL
otherwise OK.

my question is, why I can't start design node at runtime when a node is not saved yet.

thank you!

Sorry, I don't fully follow your question.

Can you provide some more details?

Where are you trying to lookup the information? How are you doing that?

Where is that code?

module.exports = function (RED) {
RED.nodes.registerType("hc2-device", Node);

function Node(n) {
    RED.nodes.createNode(this, n);
    var node = this;

    RED.httpAdmin.get("/fibaroSearch/:id/*", function (req, res) {

        RED.log.debug("GET /fibaroSearch");
        var node = RED.nodes.getNode(req.params.id);
        if (node !== null && typeof node !== "undefined") {

        } else {
                 // if node not saved I'm here.

module.exports = function (RED) {
    "use strict";
    function HelloWorldNode(config) {

        RED.nodes.createNode(this, config);
        var node = this;
        this.on('input', function (msg) {
            msg.payload = "Hello";

       	RED.httpAdmin.get("/test/:id/*", function (req, res) {
            var node = RED.nodes.getNode(req.params.id);
            if (node !== null && typeof node !== "undefined") {
		var lookup = [];
                lookup.push({"label": "One", "value": 1});
		lookup.push({"label": "Two", "value": 2});
		lookup.push({"label": "Three", "value": 3});
                res.json(lookup || []);
            } else {

    RED.nodes.registerType("hello", HelloWorldNode);

<script type="text/javascript">
        category: 'function',
        color: '#e2d96e',
        defaults: {
            name: {value:"", required: true}
        icon: "white-globe.png",
        label: function() {
            return this.name||"hello";
        oneditprepare: function () {
            var node = this;

            try {
            } catch (err) { }

            $("#node-lookup-name").click(function () {
                $.getJSON('test/' + node.id + "/", { search: $("#node-input-name").val() }, function (data) {
                    //$.getJSON('fibaroSearch/' + node.id + "/" + $("#node-input-name").val(), function (data) {
                    var search = [];
                    $.each(data, function (i, item) {
                        source: search,
                        minLength: 0,
                        select: function (event, ui) {
                            return false;
                        change: function (event, ui) {
                        close: function (event, ui) {
                    }).autocomplete("search", $("#node-input-name").val());



<script type="text/x-red" data-template-name="hello">
    <div class="form-row">
        <label for="node-input-name"><i class="icon-bookmark"></i> Name</label>
        <input type="text" id="node-input-name" style="width:60%;" placeholder="garage light sensor"/>
        <a id="node-lookup-name" class="btn"><i id="node-lookup-name-icon" class="fa fa-search"></i></a>


<script type="text/x-red" data-help-name="hello">
    <p>A simple node that changes the message payloads to Hello</p>

sample project

Hi - I was asking for more explanation, not more code. So I've now had to study you code to figure out what you are asking.

A node does not exist in the runtime until it has been deployed.

If you need the runtime to do something for a node you are still configuring and have not deployed, you'll need to pass all the required information as a part of the HTTP request you make to the runtime.

but thank you so much for reply!