dirkjanfaber / node-red-contrib-eskomsepush

Node-RED node for the EskomsePush API
MIT License
7 stars 2 forks source link

"No API calls left, not checking status/schedule" during and after no loadshedding. #9

Closed fouriewp closed 1 year ago

fouriewp commented 1 year ago

When Eskom declare no loadshedding the eskomsepush node seems to consume all my Api calls and later the day when they declare loadshedding again there are no Api calls left.

"No API calls left, not checking status/schedule"

To Reproduce The problem happens every time Eskom declares no load shedding.

Expected behaviour I expect a return that indicates that there are no load shedding and that the Api calls are not used so quickly.

Software (please complete the following information):

Flow

[
    {
        "id": "f5daca9f340cab37",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "9be6f05e27ae1123",
        "type": "debug",
        "z": "f5daca9f340cab37",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 430,
        "y": 240,
        "wires": []
    },
    {
        "id": "622c1a76cfb4d678",
        "type": "change",
        "z": "f5daca9f340cab37",
        "name": "Extract ESP API calls",
        "rules": [
            {
                "t": "move",
                "p": "api.count",
                "pt": "msg",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 480,
        "y": 380,
        "wires": [
            [
                "4c3b712fe465a0b2",
                "2573723df9e911e3"
            ]
        ]
    },
    {
        "id": "2573723df9e911e3",
        "type": "change",
        "z": "f5daca9f340cab37",
        "name": "",
        "rules": [
            {
                "t": "move",
                "p": "payload",
                "pt": "msg",
                "to": "payload.ESP_API_Calls",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 470,
        "y": 320,
        "wires": [
            [
                "a9184512.6d0338"
            ]
        ]
    },
    {
        "id": "4c3b712fe465a0b2",
        "type": "debug",
        "z": "f5daca9f340cab37",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 750,
        "y": 400,
        "wires": []
    },
    {
        "id": "854cb9223eb1d95f",
        "type": "eskomsepush",
        "z": "f5daca9f340cab37",
        "name": "Brakpan-WEST (6)",
        "licensekey": "***********************",
        "area": "eskde-6-brakpanwestmaquassihillsnorthwest",
        "statusselect": "eskom",
        "test": false,
        "verbose": false,
        "x": 160,
        "y": 320,
        "wires": [
            [
                "9be6f05e27ae1123",
                "622c1a76cfb4d678"
            ],
            []
        ]
    },
    {
        "id": "a9184512.6d0338",
        "type": "file",
        "z": "f5daca9f340cab37",
        "name": "WriteFile",
        "filename": "C:\\Users\\fourw\\OneDrive\\Documents\\API.txt",
        "filenameType": "str",
        "appendNewline": true,
        "createDir": true,
        "overwriteFile": "false",
        "encoding": "none",
        "x": 740,
        "y": 320,
        "wires": [
            []
        ]
    },
    {
        "id": "1bdcb122cdf77620",
        "type": "inject",
        "z": "f5daca9f340cab37",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 110,
        "y": 220,
        "wires": [
            [
                "2573723df9e911e3"
            ]
        ]
    }
]

Picture image

nicopret1 commented 1 year ago

I suspect this issue is related to the same problem I experience. In my case I still have API calls left, but the wrong schedule was returned, i.e. stage 8 when there was in fact no load-shedding. After deleting and re-adding the node I now get the error: "TypeError: dates.stages[(EskomSePushInfo.calc.stage - 1)] is not iterable" even though I still have API calls left. The common issue seems to be incorrect data when loadshedding has been suspended. I only saw your issue after I logged my mine.

dirkjanfaber commented 1 year ago

Please upgrade to the today released version 0.0.15. If the problem still persists, please file a new issue.

fouriewp commented 1 year ago

Thanks Guys.

I have upgraded to 0.0.15, I will check what happens "next time when Eskom declares "No loadshedding.