Alarm log is not possible

Hello
I use a translator

It was created to keep a record when an error occurs.
I'm testing with Time Staff.
There is no record below
A new text file needs to be created, but an error message appears saying the file cannot be opened. Is there a way to resolve this?

스크린샷 2023-11-14 175228


[
    {
        "id": "55b57c06.4f9794",
        "type": "ui_text",
        "z": "65911bfeea7ee507",
        "group": "5722a713ad5e228d",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Last Motion Detected",
        "format": "{{msg.payload}}",
        "layout": "col-center",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": "",
        "color": "#000000",
        "x": 3060,
        "y": 760,
        "wires": []
    },
    {
        "id": "77c75d2.c8d70a4",
        "type": "file",
        "z": "65911bfeea7ee507",
        "name": "",
        "filename": "motion_sensor_log",
        "filenameType": "str",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 3050,
        "y": 880,
        "wires": [
            []
        ]
    },
    {
        "id": "e3b2d7d4.4a0a78",
        "type": "file in",
        "z": "65911bfeea7ee507",
        "name": "",
        "filename": "motion_sensor_log",
        "filenameType": "str",
        "format": "utf8",
        "chunk": false,
        "sendError": false,
        "allProps": false,
        "x": 2710,
        "y": 720,
        "wires": [
            [
                "1152035e.bdeb3d"
            ]
        ]
    },
    {
        "id": "4aad8e9f.69733",
        "type": "ui_button",
        "z": "65911bfeea7ee507",
        "name": "",
        "group": "5722a713ad5e228d",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "CLEAR LOG",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "icon": "",
        "payload": "false",
        "payloadType": "str",
        "topic": "",
        "x": 2410,
        "y": 700,
        "wires": [
            [
                "e0e81f74.50252",
                "60572e5d.5fa4"
            ]
        ]
    },
    {
        "id": "e0e81f74.50252",
        "type": "file",
        "z": "65911bfeea7ee507",
        "name": "",
        "filename": "motion_sensor_log",
        "filenameType": "str",
        "appendNewline": true,
        "createDir": false,
        "overwriteFile": "true",
        "encoding": "none",
        "x": 2690,
        "y": 600,
        "wires": [
            []
        ]
    },
    {
        "id": "60572e5d.5fa4",
        "type": "function",
        "z": "65911bfeea7ee507",
        "name": "Delete message",
        "func": "msg.payload = \"\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2680,
        "y": 660,
        "wires": [
            [
                "55b57c06.4f9794",
                "1152035e.bdeb3d"
            ]
        ]
    },
    {
        "id": "1152035e.bdeb3d",
        "type": "ui_template",
        "z": "65911bfeea7ee507",
        "group": "5722a713ad5e228d",
        "name": "Motion Detection Log",
        "order": 5,
        "width": 0,
        "height": 0,
        "format": "<br><strong>Motion Detection Log</strong><br>\n<div ng-bind-html=\"msg.payload\" style=\"height:140px !important;\"></div>",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 3000,
        "y": 680,
        "wires": [
            []
        ]
    },
    {
        "id": "e190e920b3988f65",
        "type": "link in",
        "z": "65911bfeea7ee507",
        "name": "온도,진동,배터리 이상 메세지",
        "links": [
            "5bb2f87b75b01559",
            "f4561e6b44115257",
            "953392565e425fcc",
            "343538cb84d8aea4"
        ],
        "x": 2455,
        "y": 840,
        "wires": [
            [
                "f68e9f824aa62cf0"
            ]
        ]
    },
    {
        "id": "c3a6e9464ff3363e",
        "type": "complete",
        "z": "65911bfeea7ee507",
        "name": "",
        "scope": [
            "906e17e459a7432f",
            "a17947d8a9e82545",
            "92283d3292c8528c",
            "bd913b70fcf90677",
            "d4a79a2c6bd25420",
            "cb8319b6bf9b44e8",
            "ed113b7be20c5af1",
            "d896ec9c9cf67685",
            "3fc52fb5a2185f1d",
            "1c14a938fde9eeaa",
            "6512d5d501b59b8d",
            "19500be4bc0c306f",
            "a674b0928f58f201",
            "53245767a16bbc5e",
            "8202611148ce8970",
            "5a8b5473ddf4bcf0",
            "e18abdaf7c10d8f8",
            "574d750346b89f99",
            "bdb8a4658f91f98b",
            "65cf945952d4e572",
            "0c8b1d63d80d5074",
            "f90ba004f1a53832",
            "7ae231bba79f7119",
            "085452783bcc41f8",
            "a0392bdd49beb7f2",
            "6ef81d91db4d8523",
            "e42e0d14b117893b",
            "bf6b6188fb16e325",
            "b9bf3f6ff39079e3",
            "534efba4edd97d79",
            "40797ed1f76cf042",
            "06a664a08ebac27f",
            "1942b36c36f630b6",
            "fca50b13521dd85a",
            "55d8bee6fa4a42e3",
            "58dc41619d423382",
            "45268cfdcc52c31e",
            "6f0b346ef2516fec",
            "6bf250d37421cdf5",
            "201c62354fa61a6b",
            "5a68aa26e0cc4148",
            "1d0dcbbea707003b",
            "cd7bfa9e71eb382f",
            "3ede4c7963e11f90",
            "baf229ca9fd362d4",
            "7abc9c8cb2b6fa15",
            "0f68a841a15b1eeb",
            "dec9d61800d9a9e0",
            "fed97a1aff15d8ff",
            "ee149090335d9b20",
            "1e7eeee0edc2209e",
            "127322bcaf918112",
            "b63b88698d933abc",
            "ee1e53a677189a0a",
            "1795d6f5e4efe990",
            "989f1ca2a9197a86",
            "b7e6d921c4800457",
            "d893ba8aaab71476",
            "6764f3ac354b1ba8",
            "b218b14897822c46",
            "80046a84b1db4e77",
            "413c618432ed51f5",
            "0b99966ac733abfc",
            "168b24da952f8349",
            "745a1fe3a20909c5",
            "400c7b62b085e716",
            "f36125e04ad5c5d7",
            "d07a1b72e59f79f2",
            "f4b57c4b1e6ee386",
            "4c1dee9858169b82",
            "804acff1938d5759",
            "5096995db3cb6473",
            "cf556548aa24ed47",
            "c6e5a8b00eb7d772",
            "1b15e10e74e06e86",
            "60f8c0830a073cb5",
            "2c673edec1578eb8",
            "fac1cc554179e35b",
            "44be49b09996aa6a",
            "3c611ac1f74fbcc2",
            "92c7525f7de5dc47",
            "d3e67320fe0226f2",
            "60939e99948696bb",
            "fa55d53fc47cb3af",
            "6874642ec0b251e6",
            "eb9e5d5b7d86ed89",
            "bef624b54d356e7d",
            "5b1f84abe3e06da7",
            "83675b59a81e8f17",
            "48898fb22e5fc66c",
            "d27496238e124c62",
            "c46f4aed153f62a7",
            "8829d6a5d28131bc",
            "07b14fb00cb84294",
            "e3c0578c39f40704",
            "575f24b23d045e83",
            "e37244708a47a1fd",
            "346ae99570bf8f37",
            "d91bca88082d29d5",
            "ec3355907d0f9c0a"
        ],
        "uncaught": false,
        "x": 2400,
        "y": 800,
        "wires": [
            [
                "f68e9f824aa62cf0"
            ]
        ]
    },
    {
        "id": "f68e9f824aa62cf0",
        "type": "function",
        "z": "65911bfeea7ee507",
        "name": "Get date and time",
        "func": "var date = new Date();\n\nvar hour = date.getHours();\nvar minute = date.getMinutes();\nvar second = date.getSeconds();\nvar day = date.getDate();\nvar month = date.getMonth() + 1;\nvar year = date.getFullYear();\n\nvar fullDate =  \"-Date :\" + day + \"/\" + month  + \"/\" +  year +\n                \"Time :\"  + hour + \":\" + minute + \":\" + second + \"<br>\";\n\nmsg.payload = msg.payload + fullDate;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2660,
        "y": 840,
        "wires": [
            [
                "77c75d2.c8d70a4",
                "55b57c06.4f9794",
                "e3b2d7d4.4a0a78"
            ]
        ]
    },
    {
        "id": "78fd2599f719d3a0",
        "type": "inject",
        "z": "65911bfeea7ee507",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "텐타5호기 메인모터  M-201 센서오류",
        "payloadType": "str",
        "x": 2480,
        "y": 940,
        "wires": [
            [
                "f68e9f824aa62cf0",
                "77c75d2.c8d70a4"
            ]
        ]
    },
    {
        "id": "5722a713ad5e228d",
        "type": "ui_group",
        "name": "ON/OFF 스위치",
        "tab": "d52b6db03da6cd75",
        "order": 2,
        "disp": true,
        "width": 20,
        "collapse": false,
        "className": ""
    },
    {
        "id": "d52b6db03da6cd75",
        "type": "ui_tab",
        "name": "알람스위치",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

There should never be a log or other transient file in \windows\system32 since that is locked down and updateable by admin and system accounts only.

But you are creating/updating the log in your flow so this is under your control. You need to put it somewhere that the account running Node-RED has access to.

It is probably a good idea to specify the full path to the file you want to write.

1 Like

Can I change the file location in node?

It is your flow, you set it to what you need as Colin says. Use a full path.

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