Cronplus insert special dates

So I am now using the cronplus and it works very well. I have one value inserted at day, one value at evenings, one at night and a fourth value weekends. This is in four different cronplus nodes. However at some specific dates I want to insert the value for weekends, and suspend the values for day/evening/night. Is this possible to do in an easy way? If not the easy way, what will be the possible way?

Have a look at the within-time node from

I use it pretty extensively within a lot of my flows and find it is pretty good

Basically setup an injecft node to run every minute into it

If the time falls within the set parameters (months, days, weekends etc all supported) then it outputs on the first output - if not then it outputs on the 2nd output - where you can then cascade for within-time nodes for more complex conditions

Here is a screenshot of one of my flows that calculates the different electricity tarrifs for time of year, season, weekends and hours

Craig

You could add these statically and send a topic of pause and the payload set the name of the schedule - then unpause it by sending a start topic

Send a message to the node with a topic of pause and the payload set as the name of the schedule (send start to unpause)


PS, this is all detailed in the nodes extensive built in help AND there are dynamic control examples in the built in examples CTRL-I --> examples --> node-red-contrib-cron-plus -->

1 Like

Have to look into this, I have already made the electrical tarifs for season and hours+weekends but need this because the national holidays tarif equals weekend tarifs.

cron plus is 100% programmable through messages (from a dashboard for example)

will look further in to cronplus tomorrow.

Ended up doing it like this, I think this will work.

[
    {
        "id": "a8dab02982372403",
        "type": "tab",
        "label": "Flow 3",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "88aa7fbb36c7d1a4",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Jul",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0  25-26 12 *  *  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 170,
        "y": 20,
        "wires": [
            [
                "b1c7f1efa8c4c691",
                "aedc21da2a0432f5"
            ]
        ]
    },
    {
        "id": "b1c7f1efa8c4c691",
        "type": "change",
        "z": "a8dab02982372403",
        "name": "Pause hverdager",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "pause",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "schedule1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 850,
        "y": 40,
        "wires": [
            [
                "b7c3ee399c264be3",
                "f0f8d8b539a82c39",
                "b187c2f77f10e4d1",
                "538425e415287271"
            ]
        ]
    },
    {
        "id": "0347d82ec1f61752",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "1 Jan",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0  1 1 *  *  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 170,
        "y": 80,
        "wires": [
            [
                "b1c7f1efa8c4c691",
                "aedc21da2a0432f5"
            ]
        ]
    },
    {
        "id": "aedc21da2a0432f5",
        "type": "change",
        "z": "a8dab02982372403",
        "name": "Start holidays",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "start",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "schedule1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 680,
        "y": 140,
        "wires": [
            [
                "e2402be6111e82bd"
            ]
        ]
    },
    {
        "id": "ddc1a115577c7b4f",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "1 og 17 Mai",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0  1,17 5 *  *  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 190,
        "y": 140,
        "wires": [
            [
                "b1c7f1efa8c4c691",
                "aedc21da2a0432f5"
            ]
        ]
    },
    {
        "id": "b34e821574e2ac75",
        "type": "debug",
        "z": "a8dab02982372403",
        "name": "control of feed",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 880,
        "y": 700,
        "wires": []
    },
    {
        "id": "e9500886211cf41d",
        "type": "tibber-data",
        "z": "a8dab02982372403",
        "name": "",
        "active": true,
        "apiEndpointRef": "8a80f84f.0cbd98",
        "queryName": "getCurrentEnergyPrice",
        "homeId": "",
        "energyResolution": "HOURLY",
        "lastCount": 10,
        "x": 630,
        "y": 780,
        "wires": [
            [
                "c871ba772745c115",
                "b34e821574e2ac75"
            ]
        ]
    },
    {
        "id": "c871ba772745c115",
        "type": "change",
        "z": "a8dab02982372403",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.total",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 860,
        "y": 780,
        "wires": [
            [
                "c0158e10ee4738d6"
            ]
        ]
    },
    {
        "id": "4bfe05ceb956974c",
        "type": "debug",
        "z": "a8dab02982372403",
        "name": "Timepris ",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 960,
        "y": 960,
        "wires": []
    },
    {
        "id": "c0158e10ee4738d6",
        "type": "calculator",
        "z": "a8dab02982372403",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "mult",
        "constant": "100",
        "round": false,
        "decimals": 0,
        "x": 1080,
        "y": 780,
        "wires": [
            [
                "33a281bc0c06609f"
            ]
        ]
    },
    {
        "id": "33a281bc0c06609f",
        "type": "join",
        "z": "a8dab02982372403",
        "name": "",
        "mode": "custom",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "3",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 450,
        "y": 960,
        "wires": [
            [
                "f7e8e95dcc93e76e"
            ]
        ]
    },
    {
        "id": "f7e8e95dcc93e76e",
        "type": "calculator",
        "z": "a8dab02982372403",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "sum",
        "constant": "",
        "round": false,
        "decimals": 0,
        "x": 570,
        "y": 960,
        "wires": [
            [
                "805ab1b3722672c1"
            ]
        ]
    },
    {
        "id": "805ab1b3722672c1",
        "type": "calculator",
        "z": "a8dab02982372403",
        "name": "",
        "inputMsgField": "payload",
        "outputMsgField": "payload",
        "operation": "ceil",
        "constant": "",
        "round": true,
        "decimals": 0,
        "x": 760,
        "y": 960,
        "wires": [
            [
                "4bfe05ceb956974c"
            ]
        ]
    },
    {
        "id": "48a62318bece3d3d",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Effektledd/fastpris jan-mars/april-des",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output2",
        "outputs": 2,
        "options": [
            {
                "name": "Januar til mars",
                "topic": "schedule1",
                "payloadType": "num",
                "payload": "21.11",
                "expressionType": "cron",
                "expression": "0 1/1 0-23 * 1-3 * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            },
            {
                "name": "April til desember",
                "topic": "schedule2",
                "payloadType": "num",
                "payload": "27.61",
                "expressionType": "cron",
                "expression": "0 1/1 0-23 * 4-12 *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 330,
        "y": 1140,
        "wires": [
            [
                "33a281bc0c06609f"
            ],
            []
        ]
    },
    {
        "id": "d880c784b4a2f08f",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Timepris",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "schedule1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 * * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 420,
        "y": 780,
        "wires": [
            [
                "e9500886211cf41d"
            ]
        ]
    },
    {
        "id": "b7c3ee399c264be3",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Nettleie hverdag 6-22",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "schedule1",
                "payloadType": "num",
                "payload": "20",
                "expressionType": "cron",
                "expression": "0 0/1 6-21 *  * 1-5  * ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 380,
        "y": 840,
        "wires": [
            [
                "33a281bc0c06609f"
            ]
        ]
    },
    {
        "id": "f0f8d8b539a82c39",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Nettleie kveld",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "schedule1",
                "payloadType": "num",
                "payload": "11.2",
                "expressionType": "cron",
                "expression": "0  * 22-23   *  * 1-5 *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 280,
        "y": 900,
        "wires": [
            [
                "33a281bc0c06609f"
            ]
        ]
    },
    {
        "id": "b187c2f77f10e4d1",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Nettleie natt",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "schedule1",
                "payloadType": "num",
                "payload": "11.2",
                "expressionType": "cron",
                "expression": "0  * 0-05   *  * 1-5 *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 270,
        "y": 960,
        "wires": [
            [
                "33a281bc0c06609f"
            ]
        ]
    },
    {
        "id": "538425e415287271",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Nettleie helg",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "schedule1",
                "payloadType": "num",
                "payload": "11.2",
                "expressionType": "cron",
                "expression": "0  * 0-23   *  * 6-7 *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 270,
        "y": 1020,
        "wires": [
            [
                "33a281bc0c06609f"
            ]
        ]
    },
    {
        "id": "e2402be6111e82bd",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Nettleie Holidays",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "num",
                "payload": "11.2",
                "expressionType": "cron",
                "expression": "0 * * * * * *",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 290,
        "y": 1080,
        "wires": [
            [
                "33a281bc0c06609f"
            ]
        ]
    },
    {
        "id": "9e5dc0a3b86d464b",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Jul ferdig",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0  27 12 *  *  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 100,
        "y": 380,
        "wires": [
            [
                "840e31ea7380b0bb",
                "9764c45dd2b77031"
            ]
        ]
    },
    {
        "id": "22d959e16bcc692d",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "1 Jan ferdig",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0  2 1 *  *  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 110,
        "y": 440,
        "wires": [
            [
                "840e31ea7380b0bb",
                "9764c45dd2b77031"
            ]
        ]
    },
    {
        "id": "6022926592683ddf",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "17 Mai/Himmelfart 2023 ferdig",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0  19 5 *  *  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 170,
        "y": 560,
        "wires": [
            [
                "840e31ea7380b0bb",
                "9764c45dd2b77031"
            ]
        ]
    },
    {
        "id": "840e31ea7380b0bb",
        "type": "change",
        "z": "a8dab02982372403",
        "name": "Pause holidays",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "pause",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "schedule1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 380,
        "wires": [
            [
                "e2402be6111e82bd"
            ]
        ]
    },
    {
        "id": "9764c45dd2b77031",
        "type": "change",
        "z": "a8dab02982372403",
        "name": "Start hverdager",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "start",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "schedule1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 600,
        "y": 460,
        "wires": [
            [
                "b7c3ee399c264be3",
                "f0f8d8b539a82c39",
                "b187c2f77f10e4d1",
                "538425e415287271"
            ]
        ]
    },
    {
        "id": "da464aa113b5ffed",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Kristi Himmelfart",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0 18  5 * 2023  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 200,
        "y": 200,
        "wires": [
            [
                "b1c7f1efa8c4c691",
                "aedc21da2a0432f5"
            ]
        ]
    },
    {
        "id": "493c00352d1ef447",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Kristi Himmelfart ferdig 2024",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0 10  5 * 2024 ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 160,
        "y": 620,
        "wires": [
            [
                "840e31ea7380b0bb",
                "9764c45dd2b77031"
            ]
        ]
    },
    {
        "id": "c0b55d3ae7b8b89b",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Påske 2023",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0 6,7,10  4 * 2023  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 190,
        "y": 260,
        "wires": [
            [
                "b1c7f1efa8c4c691",
                "aedc21da2a0432f5"
            ]
        ]
    },
    {
        "id": "ce86134efb6b691d",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Pinse 2023",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0 29  5 * 2023  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 190,
        "y": 320,
        "wires": [
            [
                "aedc21da2a0432f5",
                "b1c7f1efa8c4c691"
            ]
        ]
    },
    {
        "id": "675bf3dc115133de",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Påske 2023 ferdig",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0 8,11 5 * 2023  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 130,
        "y": 680,
        "wires": [
            [
                "840e31ea7380b0bb",
                "9764c45dd2b77031"
            ]
        ]
    },
    {
        "id": "db372dd74b56acb0",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "Pinse 2023 ferdig",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0 30  5 * 2023  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 130,
        "y": 740,
        "wires": [
            [
                "840e31ea7380b0bb",
                "9764c45dd2b77031"
            ]
        ]
    },
    {
        "id": "6148ccd4213b8ce1",
        "type": "cronplus",
        "z": "a8dab02982372403",
        "name": "1 Mai ferdig",
        "outputField": "payload",
        "timeZone": "",
        "persistDynamic": false,
        "commandResponseMsgOutput": "output1",
        "outputs": 1,
        "options": [
            {
                "name": "schedule1",
                "topic": "topic1",
                "payloadType": "default",
                "payload": "",
                "expressionType": "cron",
                "expression": "0 0 0  2 5 *  *  ",
                "location": "",
                "offset": "0",
                "solarType": "all",
                "solarEvents": "sunrise,sunset"
            }
        ],
        "x": 110,
        "y": 500,
        "wires": [
            [
                "840e31ea7380b0bb",
                "9764c45dd2b77031"
            ]
        ]
    },
    {
        "id": "c66ee1913d970f9d",
        "type": "inject",
        "z": "a8dab02982372403",
        "name": "Holiday start manual",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 490,
        "y": 60,
        "wires": [
            [
                "b1c7f1efa8c4c691",
                "aedc21da2a0432f5"
            ]
        ]
    },
    {
        "id": "6df534fd2c833684",
        "type": "inject",
        "z": "a8dab02982372403",
        "name": "Holiday stop manual",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 470,
        "y": 320,
        "wires": [
            [
                "840e31ea7380b0bb",
                "9764c45dd2b77031"
            ]
        ]
    },
    {
        "id": "8a80f84f.0cbd98",
        "type": "tibber-api-endpoint",
        "feedUrl": "wss://api.tibber.com/v1-beta/gql/subscriptions",
        "queryUrl": "https://api.tibber.com/v1-beta/gql",
        "name": "Demo"
    }
]
1 Like

@Steve-Mcl I am sending the pause command to a cronplus node, see my code above. But somehow it starts frequently when its not supposed to and that gives me some trouble.

@Steve-Mcl I may have managed to replicate this ..

I used a Cron plus node from the above Flow (Nettleie Holidays) with its associated Inject and Change node and sent a msg to stop the schedule. (status: All stopped)

But .. when my Windows VM machine syncs its time with NTP

19 Jul 22:26:10 - [info] [cronplus:Nettleie Holidays] System Time Change Detected!
19 Jul 22:26:10 - [info] [cronplus:Nettleie Holidays] Refreshing running schedules

.. the Node re-enables its paused schedule !

Test Flow

[{"id":"e2402be6111e82bd","type":"cronplus","z":"a8dab02982372403","name":"Nettleie Holidays","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":"topic1","payloadType":"num","payload":"11.2","expressionType":"cron","expression":"0 * * * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":750,"y":320,"wires":[["c24400fd3fe557eb"]]},{"id":"840e31ea7380b0bb","type":"change","z":"a8dab02982372403","name":"Pause holidays","rules":[{"t":"set","p":"topic","pt":"msg","to":"pause","tot":"str"},{"t":"set","p":"payload","pt":"msg","to":"schedule1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":320,"wires":[["e2402be6111e82bd"]]},{"id":"6df534fd2c833684","type":"inject","z":"a8dab02982372403","name":"Holiday stop manual","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":290,"y":320,"wires":[["840e31ea7380b0bb"]]},{"id":"c24400fd3fe557eb","type":"debug","z":"a8dab02982372403","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":960,"y":320,"wires":[]}]

@FSHelgeland can you check in the node red logs, if these cronplus messages are present ?

Oh, that's odd.

I will take a look into that as soon as I can.

19 Jul 16:06:28 - [info] [cronplus:Faste avgifter i dag] Refreshing running schedules
19 Jul 16:06:28 - [info] [cronplus:Forbruksavgift jan-mars/april-des] System Time Change Detected!

Yes I do find several of them.

How frequent?
The code that generates this only occurs when there is a discrepancy. Usually due to heavy process in node-red preventing the event loop updating its internal time.

I do not think my node red is under a lot of stress, but I have noticed the fault daily since I got aware of it on saturday.

Right sorry missed this one

What i would do is set a Flow variable - Holiday = Yes/No
Do this through a trigger node that runs at 12:01 each evening and looks up a table of holidays that you input at the start of the year - if it matches set the Flow Variable.

Then before your first Within-time node i would have a test (switch node) if it is a holiday then branch out and set the rates to be weekend

If it is not a holdiay then continue on to the within-time nodes

Craig

1 Like

Been fine all day, but then it happend again:

21 Jul 00:18:47 - [info] [cronplus:Jul ferdig] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:1 Jan ferdig] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:1 Jan ferdig] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:17 Mai/Himmelfart 2023 ferdig] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:17 Mai/Himmelfart 2023 ferdig] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Kristi Himmelfart] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Kristi Himmelfart] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Kristi Himmelfart ferdig 2024] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Kristi Himmelfart ferdig 2024] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Påske 2023] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Påske 2023] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Pinse 2023] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Pinse 2023] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Påske 2023 ferdig] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Påske 2023 ferdig] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Pinse 2023 ferdig] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Pinse 2023 ferdig] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:1 Mai ferdig] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:1 Mai ferdig] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Faste avgifter i dag] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Faste avgifter i dag] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Forbruksavgift jan-mars/april-des] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Forbruksavgift jan-mars/april-des] Refreshing running schedules
21 Jul 00:18:47 - [info] [cronplus:Effektledd/fastpris jan-mars/april-des] System Time Change Detected!
21 Jul 00:18:47 - [info] [cronplus:Effektledd/fastpris jan-mars/april-des] Refreshing running schedules

EDIT: And then again 22 Jul 11:09

As these are random times (not typically regular NTP sync times) I suggest something in your flows is hogging/blocking for a duration greater than 5 seconds.

FYI: The CRON plus node checks the system time that NODEJS is reporting every 1 second. If the difference is > 5 seconds it considers that a time change & reloads the schedules to ensure accurate scheduling.

In reality, a bad flow or bad node which blocks for 5 seconds can cause this - so seeing this event regularly is a possible sign you need to address some issue in your flows.

There is still a fix for me to do (to NOT restart dynamically stopped schedules - which I will fix soon) BUT I suggest you look at your flows.

Perhaps litter them with some "flow-timers" :- flow-timer. A simple subflow to measure time taken in parts of your flows. (flow) - Node-RED

Thank you, I will for sure see if I can find something in my flows.

So I got this flow where a Join-node is making an array after it has recieved 2 messages. There can be up to 10-12 seconds between message one and two, but apart from that flow the longest time I can measure is 38ms.

thats fine - that is 100% non-blocking (asynchronous)

No bother, just thought it was worth a mention.

Thats fine, I am learning a lot and as a teacher at a vocational school teaching them mainly to become electricians but also have the responsibility to teach them programming this is very useful to me, not only in my own project. So more I learn and more I understand is a positive plus for me. So this time I learned something new, and I also found a way to measure the timings on my flows.