Reboot, vs `node-red-restart`

Today's question:

I have flows which have inject nodes which inject a signal at boot.

Fair enough.

So what's the difference - as I am sure there is - between a reboot (where the machine reboots) and if I go to the terminal and say node-red-restart

It would seem that the inject nodes don't trigger.

Does the 2nd post from dceejay from this topic perhaps explain the behaviour ? or the reply from stefan24 ? (initial firing couple of seconds later)

I scrolled down to the second post and clicked the link.

That is a whole different language to me.

Yikes.

Sorry, but I can't make sense of it.

1 Like

I'll try that.

But I don't understand what I am doing.

To test this, I have to do (rather than node-red-restart) is node-red-stop and node-red-start and watch the log - yes?

Maybe try changing the time to 2 seconds first

Ok, taking what I just wrote as correct, I put an inject node set to inject at boot after 5 seconds.
That seems to have changed. No longer says AFTER BOOT

This is the node.

[{"id":"ca336c07.164e3","type":"inject","z":"8bb4de19.f72c88","name":"This is  a test node","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":"3","topic":"","payload":"TEST MESSAGE","payloadType":"str","x":2110,"y":2140,"wires":[["e41494e7.5e59e"]]}]

I set the payload as TEST MESSAGE and went to the CLI.

node-red-stop

node-red-start

(With a bit of cutting the top part as it didn't show anything anyway)

10 Mar 19:16:18 - [warn] [node-red-node-sqlite/sqlite] Error: Cannot find module '/home/me/.node-red/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node'
Require stack:
- /home/me/.node-red/node_modules/sqlite3/lib/sqlite3.js
- /home/me/.node-red/node_modules/node-red-node-sqlite/sqlite.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/lib/node_modules/node-red/lib/red.js
- /usr/lib/node_modules/node-red/red.js
10 Mar 19:16:18 - [warn] [node-red-contrib-play-soundfile/config-soundfile] Error: /home/me/.node-red/node_modules/node-red-contrib-play-soundfile/config-soundfile.html does not exist
10 Mar 19:16:18 - [warn] ------------------------------------------------------
10 Mar 19:16:18 - [info] Settings file  : /home/me/.node-red/settings.js
10 Mar 19:16:18 - [info] HTTP Static    : /home/me/.node-red/public
10 Mar 19:16:18 - [info] Context store  : 'default' [module=memory]
10 Mar 19:16:18 - [info] User directory : /home/me/.node-red
10 Mar 19:16:18 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
10 Mar 19:16:18 - [info] Flows file     : /home/me/.node-red/flows_me-desktop.json
10 Mar 19:16:18 - [info] Server now running at http://127.0.0.1:1880/
10 Mar 19:16:18 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
10 Mar 19:16:18 - [info] Starting flows
TypeError: Cannot read property 'config' of null
    at addWidget (/home/me/.node-red/node_modules/node-red-dashboard/index.js:73:39)
    at Object.addWidget (/home/me/.node-red/node_modules/node-red-dashboard/index.js:137:48)
    at new LEDNodeConstructor (/home/me/.node-red/node_modules/node-red-contrib-ui-led/dist/nodes/ui_led/ui_led.js:30:29)
    at Object.createNode (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/util.js:493:31)
    at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:194:48)
    at start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:345:33)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
TypeError: Cannot read property 'config' of null
    at addWidget (/home/me/.node-red/node_modules/node-red-dashboard/index.js:73:39)
    at Object.addWidget (/home/me/.node-red/node_modules/node-red-dashboard/index.js:137:48)
    at new LEDNodeConstructor (/home/me/.node-red/node_modules/node-red-contrib-ui-led/dist/nodes/ui_led/ui_led.js:30:29)
    at Object.createNode (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/util.js:493:31)
    at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:194:48)
    at start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:345:33)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
10 Mar 19:16:18 - [error] [change:AUX] Invalid 'to' JSON property
10 Mar 19:16:18 - [info] [cronplus:Day Start / End] createTask - index: 0, static: true, opt: {"name":"Dawn","topic":"schedule1","payloadType":"str","payload":"Dawn","expressionType":"solar","expression":"0 * * * * * *","location":"-33.88050254877312 151.12279272092562","offset":"-60","solarType":"selected","solarEvents":"sunrise"}
10 Mar 19:16:18 - [info] [cronplus:Day Start / End] createTask - index: 1, static: true, opt: {"name":"Dusk","topic":"schedule2","payloadType":"str","payload":"Dusk","expressionType":"solar","expression":"0 * * * * * *","location":"-33.88050254877312 151.12279272092562","offset":"","solarType":"selected","solarEvents":"sunset"}
10 Mar 19:16:18 - [info] [cronplus:Day Start correct LONG value] createTask - index: 0, static: true, opt: {"name":"Dawn","topic":"schedule1","payloadType":"str","payload":"Dawn","expressionType":"solar","expression":"0 * * * * * *","location":"-33.88050254877312 151.12279272092562","offset":"","solarType":"selected","solarEvents":"sunset"}
10 Mar 19:16:18 - [info] [cronplus:Day Start / End] createTask - index: 0, static: true, opt: {"name":"Dawn","topic":"schedule1","payloadType":"str","payload":"Dawn","expressionType":"solar","expression":"0 * * * * * *","location":"33.88094790268725 -208.87731456743495","offset":"0","solarType":"selected","solarEvents":"sunrise"}
10 Mar 19:16:18 - [info] [cronplus:Day Start / End] createTask - index: 1, static: true, opt: {"name":"Dusk","topic":"schedule2","payloadType":"str","payload":"Dusk","expressionType":"solar","expression":"0 * * * * * *","location":"33.88094790268725 -208.87731456743495","offset":"0","solarType":"selected","solarEvents":"sunset"}
10 Mar 19:16:19 - [info] [cronplus:at 06:30] createTask - index: 0, static: true, opt: {"name":"schedule1","topic":"06:30","payloadType":"default","payload":"","expressionType":"cron","expression":"0 30 6 * * ? *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}
10 Mar 19:16:19 - [info] Started flows
10 Mar 19:16:19 - [info] [udp in:d3745e21.23d568] udp listener at 0.0.0.0:6722
10 Mar 19:16:19 - [info] [udp in:b33c21bd.7a57c8] udp listener at 0.0.0.0:6723
10 Mar 19:16:19 - [info] [udp out:ff1b54c.cf5b5a8] udp re-use socket:  -> 192.168.0.21:6723
10 Mar 19:16:19 - [info] [mqtt-broker:TIMEPI MQTT] Connected to broker: mqtt://192.168.0.99:1883
10 Mar 19:16:21 - [warn] [function:Push Button] Setting up

And...... I can't see anything that to me implies it is/was injected.

AND!

Is doing the stop/start the same as restart?
(I don't want to go think about that)

I'm a bit worried about some of the errors though.
(But that'll be a different thread)

node-red-restart
node-red-log
is the same as
node-red-stop
node-red-start

To check whether an inject node has triggered at startup configure it to output to the console then the message will appear in syslog and in node-red-log (except that it might be off the front as node-red-log only shows the most recent messages. Provided the log shows the node red startup then it will show the console message.

Updated NR as well....

Stopped and started.

10 Mar 20:06:08 - [info] Starting flows
TypeError: Cannot read property 'config' of null
    at addWidget (/home/me/.node-red/node_modules/node-red-dashboard/index.js:73:39)
    at Object.addWidget (/home/me/.node-red/node_modules/node-red-dashboard/index.js:137:48)
    at new LEDNodeConstructor (/home/me/.node-red/node_modules/node-red-contrib-ui-led/dist/nodes/ui_led/ui_led.js:30:29)
    at Object.createNode (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/util.js:493:31)
    at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:194:48)
    at start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:345:33)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

Still happening.

I posted the entire inject node's code.

Where is this output to console? I think you mean in the debug node - yes?

After adding a debug node and setting to output to console (or what ever)

I see this:

10 Mar 20:10:28 - [info] [debug:e41494e7.5e59e] TEST MESSAGE

Ok.

You deduce correctly.

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