Node-red restarts of their own accord?

A few weeks ago, when we left on vacation and I'd bought some smart water sensors, I'd rigged some automations to turn on a pair of shop vacs in the basement if the water sensors detected that the basement was flooding. I'd done it at the last minute and didn't have time to fully test everything, so to have some assurance that everything would be correct after a power outage, I'd set up an automated text message using an inject node to trigger at the start of the flow to tell me the state of the shop vac automation (whether it was enabled).

In the intervening weeks, I'd gotten that text unexpectedly a couple times. It includes a time stamp generated by the flow, so I know it's not just a delayed delivery issue. The couple of times I'd seen it, I pretty much ignored it and wondered if I'd forgotten about some automated reboot or some accidental fluke thing had happened (like, I had created a home button to trigger the reboot of the pi - and sometimes Siri does some stupid things, like turn on every device in a room because she didn't hear the complete command).

But I got that shop vac status message twice in the past few hours and I know it wasn't a reboot because one of my auto-service start ups hasn't been working for awhile and I always have to start it up manually after a reboot, but each time, it was still running.

So this must be a full redeploy that's happening? How can I figure out what could be causing this? Is there something I can look for in the logs?

If you used the node red installer script you can enter node-red-log. See what timestamp is against the startup messages.

Can you show us all the ways this message can be triggered? It might be something other than a reboot.

Sure. The message trigger is very simple:

[{"id":"5bd0a5e5.e384ac","type":"homekit-service","z":"77d823ef.f4cfdc","isParent":true,"bridge":"f2691ed1.345838","parentService":"","name":"Shop Vac Automations","serviceName":"Switch","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","x":180,"y":480,"wires":[[],["768d48bf.5bdb9"]]},{"id":"a2ba3cb7.3e042","type":"change","z":"77d823ef.f4cfdc","name":"global.shop_vac_automations=true","rules":[{"t":"set","p":"shop_vac_automations","pt":"global","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":440,"wires":[["aa433e.2dbd24c"]]},{"id":"768d48bf.5bdb9","type":"switch","z":"77d823ef.f4cfdc","name":"On?","property":"payload.On","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":350,"y":480,"wires":[["a2ba3cb7.3e042"],["6d0f7872.a2aa08"]]},{"id":"6d0f7872.a2aa08","type":"change","z":"77d823ef.f4cfdc","name":"global.shop_vac_automations=false","rules":[{"t":"set","p":"shop_vac_automations","pt":"global","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":480,"wires":[["87650525.957c"]]},{"id":"87650525.957c","type":"template","z":"77d823ef.f4cfdc","name":"Shop Vac Automations Off Msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"plain","template":"{ \"msg\": \"Shop Vac Automations Off.\" }","output":"json","x":870,"y":480,"wires":[["61d92885.a9bc3"]]},{"id":"61d92885.a9bc3","type":"link out","z":"77d823ef.f4cfdc","name":"","links":["f0587171.e4e688"],"x":1035,"y":460,"wires":[]},{"id":"aa433e.2dbd24c","type":"template","z":"77d823ef.f4cfdc","name":"Shop Vac Automations On Msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"plain","template":"{ \"msg\": \"Shop Vac Automations On.\" }","output":"json","x":870,"y":440,"wires":[["61d92885.a9bc3"]]},{"id":"6d8d1b32.9f767c","type":"switch","z":"77d823ef.f4cfdc","name":"On?","property":"shop_vac_automations","propertyType":"global","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":350,"y":440,"wires":[["a2ba3cb7.3e042"],["6d0f7872.a2aa08"]]},{"id":"f3e63c28.6c7fb8","type":"inject","z":"77d823ef.f4cfdc","name":"On Startup","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":210,"y":440,"wires":[["6d8d1b32.9f767c"]]},{"id":"f2691ed1.345838","type":"homekit-bridge","z":"","bridgeName":"NodeRED HomeKitD","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":false}]

I don't think I installed using the script, but I know where the logs are. Let me do some poking and I'll paste what I find. I haven't had time to actually investigate in any deoth until now. Last night we were hosting a party.

I'd look to see if you are getting a signal from homekit. Stick a debug node on its output so you can see.

That's a good suggestion. I'll add a source to the message.

Nothing jumped out at me in the error log other than the fact that there seems to be a homebridge lookup error about every half hour. And in the STDOUT log, it seems my "new" wemo motion is in a faulty state - detecting a dozen motion events a minute. I had false triggers where it is on the porch before, so I'd mitigated it by requiring agreement between it and the security camera (which has false motion alerts of its own), and the result is somewhat decent accuracy, but I didn't realize the false wemo motion alerts were so numerous. Probably a bad device.

Anyway, going to keep scrolling until I get to the last redeploy at 5am this morning.

Nothing's jumping out at me in the STDOUT log

29 Oct 05:02:46 - [info] [debug:157664d5.18444b] Porch wemo motion event
unhandled wemo event type 
{ TimeSyncRequest: [ '0' ] }
29 Oct 05:03:03 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:03:07 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:03:11 - [info] [debug:157664d5.18444b] Porch wemo motion event
Callback URL = http://192.168.1.56:1880/wemoNG/notification
29 Oct 05:04:18 - [info] 

Welcome to Node-RED
===================

29 Oct 05:04:18 - [info] Node-RED version: v1.0.2
29 Oct 05:04:18 - [info] Node.js  version: v14.18.1
29 Oct 05:04:18 - [info] Linux 4.19.66-v7+ arm LE
29 Oct 05:04:20 - [info] Loading palette nodes
29 Oct 05:04:30 - [info] Settings file  : /home/pi/.node-red/settings.js
29 Oct 05:04:30 - [info] Context store  : 'default' [module=localfilesystem]
29 Oct 05:04:30 - [info] User directory : /home/pi/.node-red
29 Oct 05:04:30 - [warn] Projects disabled : editorTheme.projects.enabled=false
29 Oct 05:04:30 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
29 Oct 05:04:30 - [info] Server now running at http://127.0.0.1:1880/
29 Oct 05:04:31 - [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.
---------------------------------------------------------------------

29 Oct 05:04:32 - [info] Starting flows
Callback URL = http://192.168.1.56:1880/wemoNG/notification
29 Oct 05:04:35 - [info] Started flows
unhandled wemo event type 
{ TimeSyncRequest: [ '0' ] }
29 Oct 05:04:35 - [error] [hb-status:Back Yard Flood Light] Homebridge not initialized
29 Oct 05:04:35 - [info] [debug:157664d5.18444b] Porch wemo motion event
{"message":"subscribed to webhook stream successfully","level":"info"}

And the error log has the same error that repeats every 15-30 minutes surrounding that reboot time in the log...

2022-10-29T05:02:08.115Z hapNodeJSClient Starting Homebridge instance discovery
2022-10-29T05:02:08.130Z hapNodeJSClient HAP Device discovered Homebridge B5F8 BAC3
2022-10-29T05:02:08.134Z hapNodeJSClient HAP Device discovered NodeRED HomeKitD C49A
2022-10-29T05:02:08.162Z hapNodeJSClient HAP Discover failed NodeRED HomeKitD -> http://192.168.1.56:42935 invalid PIN or homebridge is not running in insecure mode with -I
2022-10-29T05:02:08.546Z hapNodeJSClient HAP Device discovered Wemo Mini 23F
2022-10-29T05:02:08.563Z hapNodeJSClient HAP Discover failed Wemo Mini -> http://192.168.1.233:40841 invalid PIN or homebridge is not running in insecure mode with -I
2022-10-29T05:02:09.901Z hapNodeJSClient Homebridge instance discovered homebridge with 59 accessories
2022-10-29T05:02:28.120Z hapNodeJSClient Ready
2022-10-29T05:17:08.114Z hapNodeJSClient Starting Homebridge instance discovery
2022-10-29T05:17:08.124Z hapNodeJSClient HAP Device discovered NodeRED HomeKitD C49A
2022-10-29T05:17:08.130Z hapNodeJSClient HAP Device discovered Homebridge B5F8 BAC3
2022-10-29T05:17:08.161Z hapNodeJSClient HAP Discover failed NodeRED HomeKitD -> http://192.168.1.56:42935 invalid PIN or homebridge is not running in insecure mode with -I
2022-10-29T05:17:08.181Z hapNodeJSClient HAP Device discovered Wemo Mini 23F
2022-10-29T05:17:08.194Z hapNodeJSClient HAP Discover failed Wemo Mini -> http://192.168.1.233:40841 invalid PIN or homebridge is not running in insecure mode with -I
2022-10-29T05:17:09.866Z hapNodeJSClient Homebridge instance discovered homebridge with 59 accessories
2022-10-29T05:17:28.116Z hapNodeJSClient Ready

OK, I added the trigger source to the status message:

[{"id":"5bd0a5e5.e384ac","type":"homekit-service","z":"77d823ef.f4cfdc","isParent":true,"bridge":"f2691ed1.345838","parentService":"","name":"Shop Vac Automations","serviceName":"Switch","topic":"","filter":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","cameraConfigVideoProcessor":"ffmpeg","cameraConfigSource":"","cameraConfigStillImageSource":"","cameraConfigMaxStreams":2,"cameraConfigMaxWidth":1280,"cameraConfigMaxHeight":720,"cameraConfigMaxFPS":10,"cameraConfigMaxBitrate":300,"cameraConfigVideoCodec":"libx264","cameraConfigAudioCodec":"libfdk_aac","cameraConfigAudio":false,"cameraConfigPacketSize":1316,"cameraConfigVerticalFlip":false,"cameraConfigHorizontalFlip":false,"cameraConfigMapVideo":"0:0","cameraConfigMapAudio":"0:1","cameraConfigVideoFilter":"scale=1280:720","cameraConfigAdditionalCommandLine":"-tune zerolatency","cameraConfigDebug":false,"cameraConfigSnapshotOutput":"disabled","cameraConfigInterfaceName":"","characteristicProperties":"{}","x":140,"y":480,"wires":[[],["9eb34377.f36268"]]},{"id":"a2ba3cb7.3e042","type":"change","z":"77d823ef.f4cfdc","name":"global.shop_vac_automations=true","rules":[{"t":"set","p":"shop_vac_automations","pt":"global","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":440,"wires":[["aa433e.2dbd24c"]]},{"id":"768d48bf.5bdb9","type":"switch","z":"77d823ef.f4cfdc","name":"On?","property":"payload.On","propertyType":"msg","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":490,"y":480,"wires":[["a2ba3cb7.3e042"],["6d0f7872.a2aa08"]]},{"id":"6d0f7872.a2aa08","type":"change","z":"77d823ef.f4cfdc","name":"global.shop_vac_automations=false","rules":[{"t":"set","p":"shop_vac_automations","pt":"global","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":480,"wires":[["87650525.957c"]]},{"id":"6d8d1b32.9f767c","type":"switch","z":"77d823ef.f4cfdc","name":"On?","property":"shop_vac_automations","propertyType":"global","rules":[{"t":"true"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":490,"y":440,"wires":[["a2ba3cb7.3e042"],["6d0f7872.a2aa08"]]},{"id":"f3e63c28.6c7fb8","type":"inject","z":"77d823ef.f4cfdc","name":"On Startup","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":true,"onceDelay":0.1,"x":170,"y":440,"wires":[["6fe05e68.32eeb"]]},{"id":"9eb34377.f36268","type":"change","z":"77d823ef.f4cfdc","name":"src=homekitd","rules":[{"t":"set","p":"source","pt":"msg","to":"homekitd","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":480,"wires":[["768d48bf.5bdb9"]]},{"id":"6fe05e68.32eeb","type":"change","z":"77d823ef.f4cfdc","name":"src=injectnode","rules":[{"t":"set","p":"source","pt":"msg","to":"injectnode","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":440,"wires":[["6d8d1b32.9f767c"]]},{"id":"87650525.957c","type":"template","z":"77d823ef.f4cfdc","name":"Shop Vac Automations Off Msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"plain","template":"{ \"msg\": \"Shop Vac Automations Off (source={{source}}).\" }","output":"json","x":1010,"y":480,"wires":[["61d92885.a9bc3"]]},{"id":"aa433e.2dbd24c","type":"template","z":"77d823ef.f4cfdc","name":"Shop Vac Automations On Msg","field":"payload","fieldType":"msg","format":"handlebars","syntax":"plain","template":"{ \"msg\": \"Shop Vac Automations On (source={{source}}).\" }","output":"json","x":1010,"y":440,"wires":[["61d92885.a9bc3"]]},{"id":"61d92885.a9bc3","type":"link out","z":"77d823ef.f4cfdc","name":"","links":["f0587171.e4e688"],"x":1175,"y":460,"wires":[]},{"id":"f2691ed1.345838","type":"homekit-bridge","z":"","bridgeName":"NodeRED HomeKitD","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true,"allowMessagePassthrough":false}]

Hopefully, the next time it happens, I'll have a better idea where to look.

If it is coming from the home app/homekit... I wonder if there's a way to know which device the command came from... I have multiple devices with the home app (3-4 computers and 4 iOS devices).

Strike that... I know node-red is restarting, so it can't be an issued homekit command!

That is a very old version of node-red. 1.0.3 was released three years ago, and we are on 3.0.2 now.

Yeah, I knew I'd get called out for that when I pasted it.

(I'm going to get shot down for posting this, but.... here goes)

I am not saying it is what I suffered a couple of years back, but it does sound suspiciously like it.

Only if to prove me wrong: Make sure your power supplies are up to spec.
I was using ones that weren't and it caused me all sorts of bother with things happening SIMILAR to what you are saying.

After a year of frustration the only thing left were the power supplies.
(to RasPis and Arduinos)
I replaced most of them. There is one which is going to be replaced anyway.

Since then 98% of problems are fixed.

1 Like

Have a look at /var/log/syslog at the time node-red restarted and see if there is anything to indicate what caused the restart.

Perhaps you should edit the thread title to indicate that node-red is restarting rather then re-deploying.

It might be worth updating node red (and all contrib nodes) in case it is caused by an issue that has been long fixed.

Certainly a poor PSU could cause random pi resets. If the pi has reset then that should be clear from /var/log/syslog.

1 Like

The only things in syslog anywhere near that time is a cron job line that I set up to run once a minute to monitor the CPU temperature. I have a nightly pilight restart I also run on a cron. Otherwise, syslog is very sparse. There is the syn flooding thing that I mentioned on the http-in node thread I have parallel to this thread, but it happens over an hour before the restart...

I do see some things I could address though that are unrelated to this issue. I don't know what's running these "Daily download activities"

$ zcat syslog.2.gz | grep -v measure_temp
Oct 29 03:00:01 raspberrypi CRON[16191]: (pi) CMD (sudo service pilight restart)
Oct 29 03:00:01 raspberrypi systemd[1]: Stopping pilight...
Oct 29 03:00:01 raspberrypi systemd[1]: Stopped pilight.
Oct 29 03:00:01 raspberrypi systemd[1]: Starting pilight...
Oct 29 03:00:01 raspberrypi systemd[1]: Started pilight.
Oct 29 03:00:01 raspberrypi kernel: [210813.288012] TCP: request_sock_TCP: Possible SYN flooding on port 1883. Sending cookies.  Check SNMP counters.
Oct 29 03:17:01 raspberrypi CRON[31260]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct 29 03:17:47 raspberrypi wpa_supplicant[481]: wlan0: WPA: Group rekeying completed with 68:d7:9a:25:67:ad [GTK=CCMP]
Oct 29 04:17:01 raspberrypi CRON[5451]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct 29 04:17:47 raspberrypi wpa_supplicant[481]: wlan0: WPA: Group rekeying completed with 68:d7:9a:25:67:ad [GTK=CCMP]
Oct 29 05:17:01 raspberrypi CRON[13172]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Oct 29 05:17:47 raspberrypi wpa_supplicant[481]: wlan0: WPA: Group rekeying completed with 68:d7:9a:25:67:ad [GTK=CCMP]
Oct 29 05:50:28 raspberrypi systemd[1]: Starting Daily apt download activities...
Oct 29 05:50:44 raspberrypi apt.systemd.daily[7521]: Traceback (most recent call last):
Oct 29 05:50:44 raspberrypi apt.systemd.daily[7521]:   File "/usr/bin/unattended-upgrade", line 58, in <module>
Oct 29 05:50:44 raspberrypi apt.systemd.daily[7521]:     import apt
Oct 29 05:50:44 raspberrypi apt.systemd.daily[7521]: ModuleNotFoundError: No module named 'apt'

Can you post syslog log from just before the restart, including the restart please.

The Dailly Downoad is probably it doing apt update to check for updates.

[Edit] Does the node-red restart not appear in syslog? If not then we need to know how you installed node-red. Was it installed via Docker for example? Where are you seeing the node-red restart log?

It's in ~/.pm2/logs, isn't it? I installed node-red so long ago, I don't remember how I installed it. If I were to guess, based on my notes about node red, I probably did:

sudo npm install -g --unsafe-perm node-red

Let me look at the node red logs...

So I looked at my node-red log that shows the restart. I'd posted that above, so I'm wondering if you're asking to see further back or if there's another system log file that would contain what you're expecting... but further back in the node-red-out.log is more of the same:

29 Oct 04:56:51 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:56:55 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:56:59 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:57:03 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:57:07 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:57:28 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:57:32 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:57:37 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:57:41 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:57:54 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:57:58 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:02 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:06 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:10 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:14 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:27 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:31 - [info] [debug:157664d5.18444b] Porch wemo motion event
unhandled wemo event type 
{ TimeSyncRequest: [ '0' ] }
29 Oct 04:58:35 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:39 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:43 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:47 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:58:51 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:08 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:12 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:16 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:20 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:24 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:44 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:48 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:52 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 04:59:56 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:00 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:13 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:17 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:21 - [info] [debug:157664d5.18444b] Porch wemo motion event
unhandled wemo event type 
{ TimeSyncRequest: [ '0' ] }
29 Oct 05:00:25 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:29 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:47 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:51 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:55 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:00:59 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:01:03 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:01:07 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:01:28 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:01:34 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:01:36 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:01:40 - [info] [debug:157664d5.18444b] Porch wemo motion event
unhandled wemo event type 
{ TimeSyncRequest: [ '0' ] }
29 Oct 05:01:53 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:01:57 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:02:01 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:02:05 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:02:09 - [info] [debug:157664d5.18444b] Porch wemo motion event
unhandled wemo event type 
{ TimeSyncRequest: [ '0' ] }
29 Oct 05:02:13 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:02:30 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:02:34 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:02:38 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:02:42 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:02:46 - [info] [debug:157664d5.18444b] Porch wemo motion event
unhandled wemo event type 
{ TimeSyncRequest: [ '0' ] }
29 Oct 05:03:03 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:03:07 - [info] [debug:157664d5.18444b] Porch wemo motion event
29 Oct 05:03:11 - [info] [debug:157664d5.18444b] Porch wemo motion event
Callback URL = http://192.168.1.56:1880/wemoNG/notification
29 Oct 05:04:18 - [info] 

Welcome to Node-RED
===================

29 Oct 05:04:18 - [info] Node-RED version: v1.0.2
29 Oct 05:04:18 - [info] Node.js  version: v14.18.1
29 Oct 05:04:18 - [info] Linux 4.19.66-v7+ arm LE
29 Oct 05:04:20 - [info] Loading palette nodes
29 Oct 05:04:30 - [info] Settings file  : /home/pi/.node-red/settings.js
29 Oct 05:04:30 - [info] Context store  : 'default' [module=localfilesystem]
29 Oct 05:04:30 - [info] User directory : /home/pi/.node-red
29 Oct 05:04:30 - [warn] Projects disabled : editorTheme.projects.enabled=false
29 Oct 05:04:30 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
29 Oct 05:04:30 - [info] Server now running at http://127.0.0.1:1880/
29 Oct 05:04:31 - [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.
---------------------------------------------------------------------

29 Oct 05:04:32 - [info] Starting flows
Callback URL = http://192.168.1.56:1880/wemoNG/notification
29 Oct 05:04:35 - [info] Started flows
unhandled wemo event type 
{ TimeSyncRequest: [ '0' ] }
29 Oct 05:04:35 - [error] [hb-status:Back Yard Flood Light] Homebridge not initialized
29 Oct 05:04:35 - [info] [debug:157664d5.18444b] Porch wemo motion event
{"message":"subscribed to webhook stream successfully","level":"info"}

I think that the logs managed by pm2 (above) should contain everything relevant to the restart. I can try looking in other stuff in /var/log...

raspberrypi[2022-10-30 10:36:58]:/var/log>ls | grep -v ".gz" | grep -v ".1"
alternatives.log
apt/
auth.log
boot.log
bootstrap.log
btmp
daemon.log
debug
dpkg.log
faillog
fontconfig.log
kern.log
lastlog
lightdm/
messages
openvpn.log
openvpn-status.log
pilight.err
pilight.log
pilight.log.old
samba/
syslog
unattended-upgrades/
user.log
wtmp
Xorg.0.log
Xorg.0.log.old

You know, I think that it's probably not worth debugging this further until I've done an update of node-red and it recurs. As you pointed out, this could be fixed in the latest version.

I'm not saying I'm going to take the time to do that very soon, but I at least feel like I have a reasonable sense that updating is possibly a fix and that there's not any other obvious explanation.

I notice references to pilight - on it's webpage (pilight.org) it shows it is 5 years old:
The latest pilight version is 8.0 which has been released on the 18th of October 2017.
You seem to have a lot of old things running on that Pi....