Lost Connection to Server Reconnecting

I am not sure if anyone can help or not I am running Node Red Version 2.2.2 and running a simple big timer to turn lights on and off. Recently I find that the garden lights turn off after 37 minutes and the back on then 37 minutes later they turn off and then back on again. I have tried deleting the browsing data and the history files in Google Chrome because I had read that it maybe a Google problem.
I have tried redoing the Node Red flow and a number of other things but nothing seems to work it is very annoying that every 37 minutes the garden goes dark and then maybe 45 seconds later the lights come on.. [

Hi, firstly, the browser has no bearing on the operation of node-red. It is very likely something in your flow is crashing node-red.

Please provide more details...

  1. Is browser running on the device where node-red is installed?
  2. What device is node-red running on (PI? PC? Mac?, Operating System? etc)?
  3. How do you start node-red?
  4. How are these lights controlled?
  5. Share your flow (CTRL+E to export)

The Browser is running on the device where Node Red is installed they are Running on a Raspberry Pi 4 4gb.. Node Red starts automatically. The lights are controlled from Node Red to a relay that turns the lights on through the GPIO output. The same program has been running now for over 14 months and not seen this problem before.

[
    {
        "id": "2a6a5560.46c11a",
        "type": "function",
        "z": "d21926ca.2cd568",
        "name": "",
        "func": "msg.payload=msg.state;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 780,
        "y": 600,
        "wires": [
            [
                "cfb695d7.9b77d8",
                "276c4ee3.c6f622",
                "123dad0.43dbd53"
            ]
        ]
    },
    {
        "id": "cb94b057.ff4f7",
        "type": "bigtimer",
        "z": "d21926ca.2cd568",
        "outtopic": "",
        "outpayload1": "",
        "outpayload2": "",
        "name": "Flood Lights Timer",
        "comment": "Auto Light Timer",
        "lat": "41.3872",
        "lon": "9.1593",
        "starttime": "5004",
        "endtime": "1410",
        "starttime2": 0,
        "endtime2": 0,
        "startoff": 0,
        "endoff": 0,
        "startoff2": 0,
        "endoff2": 0,
        "offs": 0,
        "outtext1": "Turn On",
        "outtext2": "Turn Off",
        "timeout": 1440,
        "sun": true,
        "mon": true,
        "tue": true,
        "wed": true,
        "thu": true,
        "fri": true,
        "sat": true,
        "jan": true,
        "feb": true,
        "mar": true,
        "apr": true,
        "may": true,
        "jun": true,
        "jul": true,
        "aug": true,
        "sep": true,
        "oct": true,
        "nov": true,
        "dec": true,
        "day1": 0,
        "month1": 0,
        "day2": 0,
        "month2": 0,
        "day3": 0,
        "month3": 0,
        "day4": 0,
        "month4": 0,
        "day5": 0,
        "month5": 0,
        "day6": 0,
        "month6": 0,
        "day7": 0,
        "month7": 0,
        "day8": 0,
        "month8": 0,
        "day9": 0,
        "month9": 0,
        "day10": 0,
        "month10": 0,
        "day11": 0,
        "month11": 0,
        "day12": 0,
        "month12": 0,
        "d1": 0,
        "w1": 0,
        "d2": 0,
        "w2": 0,
        "d3": 0,
        "w3": 0,
        "d4": 0,
        "w4": 0,
        "d5": 0,
        "w5": 0,
        "d6": 0,
        "w6": 0,
        "xday1": 0,
        "xmonth1": 0,
        "xday2": 0,
        "xmonth2": 0,
        "xday3": 0,
        "xmonth3": 0,
        "xday4": 0,
        "xmonth4": 0,
        "xday5": 0,
        "xmonth5": 0,
        "xday6": 0,
        "xmonth6": 0,
        "xday7": "",
        "xmonth7": "",
        "xday8": "",
        "xmonth8": "",
        "xday9": "",
        "xmonth9": "",
        "xday10": "",
        "xmonth10": "",
        "xday11": "",
        "xmonth11": "",
        "xday12": "",
        "xmonth12": "",
        "xd1": 0,
        "xw1": 0,
        "xd2": 0,
        "xw2": 0,
        "xd3": 0,
        "xw3": 0,
        "xd4": 0,
        "xw4": 0,
        "xd5": 0,
        "xw5": 0,
        "xd6": 0,
        "xw6": 0,
        "suspend": false,
        "random": false,
        "randon1": false,
        "randoff1": false,
        "randon2": false,
        "randoff2": false,
        "repeat": false,
        "atstart": true,
        "odd": false,
        "even": false,
        "x": 570,
        "y": 600,
        "wires": [
            [],
            [
                "77ebdd3d.429d64",
                "2a6a5560.46c11a"
            ],
            []
        ]
    },
    {
        "id": "70ad9523.35542c",
        "type": "ui_button",
        "z": "d21926ca.2cd568",
        "name": "Garage Flood Lights Off",
        "group": "24783352.bf84fc",
        "order": 7,
        "width": "0",
        "height": "0",
        "passthru": false,
        "label": "Garage Flood  Lights Off",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "Off",
        "payloadType": "str",
        "topic": "",
        "x": 230,
        "y": 600,
        "wires": [
            [
                "cb94b057.ff4f7"
            ]
        ]
    },
    {
        "id": "54ae85df.db4bcc",
        "type": "ui_button",
        "z": "d21926ca.2cd568",
        "name": "Garage Flood Lights Auto",
        "group": "24783352.bf84fc",
        "order": 8,
        "width": "0",
        "height": "0",
        "passthru": false,
        "label": "Garage Flood Lights Auto",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "Auto",
        "payloadType": "str",
        "topic": "",
        "x": 230,
        "y": 640,
        "wires": [
            [
                "cb94b057.ff4f7"
            ]
        ]
    },
    {
        "id": "cfb695d7.9b77d8",
        "type": "ui_text",
        "z": "d21926ca.2cd568",
        "group": "24783352.bf84fc",
        "order": 9,
        "width": "5",
        "height": "1",
        "name": "Garage Flood Lights",
        "label": "Garage Flood lights",
        "format": "{{msg.payload}}",
        "layout": "row-left",
        "x": 1020,
        "y": 600,
        "wires": []
    },
    {
        "id": "e71648f8.351448",
        "type": "ui_button",
        "z": "d21926ca.2cd568",
        "name": "Garage Flood Lights On",
        "group": "24783352.bf84fc",
        "order": 6,
        "width": "0",
        "height": "0",
        "passthru": false,
        "label": "Garage Flood Lights  On",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "On",
        "payloadType": "str",
        "topic": "",
        "x": 230,
        "y": 560,
        "wires": [
            [
                "cb94b057.ff4f7"
            ]
        ]
    },
    {
        "id": "e665539d.a4d06",
        "type": "rpi-gpio out",
        "z": "d21926ca.2cd568",
        "name": "Garage Flood Lights",
        "pin": "12",
        "set": false,
        "level": "0",
        "freq": "",
        "out": "out",
        "bcm": true,
        "x": 1260,
        "y": 480,
        "wires": []
    },
    {
        "id": "276c4ee3.c6f622",
        "type": "change",
        "z": "d21926ca.2cd568",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "OFF Override",
                "fromt": "str",
                "to": "1",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "ON Override",
                "fromt": "str",
                "to": "0",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "ON Auto",
                "fromt": "str",
                "to": "0",
                "tot": "num"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "OFF Auto",
                "fromt": "str",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1000,
        "y": 540,
        "wires": [
            [
                "e665539d.a4d06",
                "ad41a38.a582d6"
            ]
        ]
    },
    {
        "id": "123dad0.43dbd53",
        "type": "ui_led",
        "z": "d21926ca.2cd568",
        "order": 10,
        "group": "24783352.bf84fc",
        "width": "1",
        "height": "1",
        "label": "",
        "labelPlacement": "right",
        "labelAlignment": "right",
        "colorForValue": [
            {
                "color": "red",
                "value": "OFF Override",
                "valueType": "str"
            },
            {
                "color": "green",
                "value": "ON Override",
                "valueType": "str"
            },
            {
                "color": "blue",
                "value": "ON Auto",
                "valueType": "str"
            }
        ],
        "allowColorForValueInMessage": false,
        "name": "",
        "x": 970,
        "y": 640,
        "wires": []
    },
    {
        "id": "7863b91f.083008",
        "type": "comment",
        "z": "d21926ca.2cd568",
        "name": "Flood Lights above Garage ",
        "info": "These are two 50 watt cool white flood lights I Installed them just to see what they were like ",
        "x": 380,
        "y": 460,
        "wires": []
    },
    {
        "id": "ad41a38.a582d6",
        "type": "debug",
        "z": "d21926ca.2cd568",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1230,
        "y": 540,
        "wires": []
    },
    {
        "id": "77ebdd3d.429d64",
        "type": "debug",
        "z": "d21926ca.2cd568",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 500,
        "wires": []
    },
    {
        "id": "24783352.bf84fc",
        "type": "ui_group",
        "name": "Pool Lights ",
        "tab": "4a825b65.f252d4",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false
    },
    {
        "id": "4a825b65.f252d4",
        "type": "ui_tab",
        "name": "Swimming Pool",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Can you run node-red-log and capture the moment it happens please (in ~37 mins i assume :smiley: )


EDIT...

FWIW, I dont see any thing in the provided flow that would cause a NR crash (no loops, nothing crazy going on :+1: )

This is the only message in the Node Red Log file I cannot make head nor tail of this that is why I am asking if there is anyone out there that has problems like me ?

#!/bin/bash
LINES=25
while getopts ":n:" opt; do
case $opt in
n) LINES="$OPTARG"
;;
?) echo "Unrecognized option -$OPTARG. Usage: node-red-log [-n lines]. For example: node-red-log -n 50" >&2 && exit 1
;;
esac
done
echo -e '\033]2;'$USER@hostname: Node-RED log'\007'
echo " "
sudo journalctl -f -n $LINES -u nodered -o cat

That is the content of the node-red-log command (if i am not mistaken)

You need to actually execute node-red-log command to display the logs

alternatively, just run sudo journalctl -f -n 1000 -u nodered -o cat

!/bin/bash
LINES=25
while getopts ":n:" opt; do
case $opt in
n) LINES="$OPTARG"
;;
?) echo "Unrecognized option -$OPTARG. Usage: node-red-log [-n lines]. For example: node-red-log -n 50" >&2 && exit 1
;;
esac
done
echo -e '\033]2;'$USER@hostname: Node-RED log'\007'
echo " "
sudo journalctl -f -n $LINES -u nodered -o cat

8 Mar 12:08:29 - [info] Node.js  version: v14.19.0
8 Mar 12:08:29 - [info] Linux 5.10.92-v7l+ arm LE
8 Mar 12:08:30 - [info] Loading palette nodes
8 Mar 12:08:34 - [info] Worldmap version 2.27.1
8 Mar 12:08:34 - [info] Dashboard version 3.1.6 started at /ui
8 Mar 12:08:35 - [info] Settings file  : /home/pi/.node-red/settings.js
8 Mar 12:08:35 - [info] Context store  : 'default' [module=memory]
8 Mar 12:08:35 - [info] User directory : /home/pi/.node-red
8 Mar 12:08:35 - [warn] Projects disabled : editorTheme.projects.enabled=false
8 Mar 12:08:35 - [info] Flows file     : /home/pi/.node-red/flows.json
8 Mar 12:08:35 - [info] Server now running at http://127.0.0.1:1880/
8 Mar 12:08:35 - [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.
---------------------------------------------------------------------
8 Mar 12:08:36 - [info] Starting flows
8 Mar 12:08:36 - [info] Started flows
8 Mar 12:08:36 - [info] [serialconfig:cce51e64.ed74e] serial port /dev/ttyAMA0 opened at 9600 baud 8N1
8 Mar 12:08:36 - [error] [arduino-board:8273cb9a41b7658a] port not found : /dev/ttyAMA0 9600-8N1

You need to look into the arduino board error.

Are you certain that is all there the end of the log? Based on your earlier post, it sounded as though node-red was crashing / restarting.

I expected to see a stack trace or node-red restarting at minimum.

And yes, I see there is an error for the arduino-board node however errors can (and do) occur without crashing node-red.

@ALPF5555 in case you did not realise, you were supposed to leave that running until it crashed. Do not close the window where you have run the node-red-log command.

Sorry Colin I closed the window will leave it open now and wait till it stops. I have looked at the Arduino and it seems like it is on USB0 not AMA0 so changed over and will leave that other running

Hello Everyone I changed the Arduino to USB0 the port it is now on instead of the AMA0 I am still getting the error message but last nights the lights never turned off once until time for them to turn off..
I am sorry I have no clue as to what happened but it was very wonderful not to have the lights turn on and off all night.
The only error message I have is the one below
8 Mar 15:29:39 - [error] [arduino-board:8273cb9a41b7658a] port not found : /dev/ttyAMA0 9600-8N1
I do not know how to get rid of that but putting the Arduino on USB0 seems to have done something amazing.

Thank you for all your help stay safe and well

Have a look in the Menu > Configuration nodes. Click Unused at the top and see if that node appears there. If so then select it and hit delete. If it doesn't appear there then it is in use somewhere. Examine all your config nodes and find out which one it is.

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