Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum call stack size exceeded / blind-control #498

Open
florianmulatz opened this issue Nov 9, 2022 · 0 comments
Open

Maximum call stack size exceeded / blind-control #498

florianmulatz opened this issue Nov 9, 2022 · 0 comments

Comments

@florianmulatz
Copy link

florianmulatz commented Nov 9, 2022

Describe the bug
Since today I detect the above error. I can not directly reproduce it in normal flow but in this test flow (attached code below) I get this error whenever I try to inject summer-/winter-mode

Anyhow - the control messages get's published normally so the controlling of my blinds is not affected yet.

Screenshots
image

System information (please complete the following information):

  • Node Version: 3.0.0-alpha1
  • Node-RED: 13.5.2

Additional context

[{"id":"3875c7075036088c","type":"change","z":"19448acc2d95ec58","name":"ha.workday","rules":[{"t":"set","p":"ha.workday","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1510,"y":380,"wires":[[]]},{"id":"895026569728b621","type":"inject","z":"19448acc2d95ec58","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":1350,"y":360,"wires":[["3875c7075036088c"]]},{"id":"2357143b37491f9a","type":"inject","z":"19448acc2d95ec58","name":"","repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":1350,"y":400,"wires":[["3875c7075036088c"]]},{"id":"6b64ee5a52599136","type":"function","z":"19448acc2d95ec58","name":"30min 0.5sec","func":"\nconst minutesEachLoop = msg.minutes; // minutes to add\nconst loopCycle = msg.delay; // seconds delay\nlet timeObj = context.get(\"timeObj\");\n\nconst days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n\nif (timeObj && msg.topic.includes('stop')) {\n    clearInterval(timeObj);\n    context.set(\"timeObj\", null);\n    context.set(\"orgtopic\", null);\n    let d = new Date(context.get(\"date\"));\n    node.log(\"STOP    \" + d.toLocaleTimeString() + ' ####################################### payload=' + msg.payload + ' topic=' + msg.topic);\n    node.log('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ' + d.toISOString());\n    node.status({ fill: \"red\", shape: \"ring\", text: \"stopped - \" + d.toLocaleTimeString() + ' (' + d.getDay() + ' ' + days[d.getDay()] + ')' });\n    return null;\n} else if (!timeObj && msg.topic.includes('start')) {\n    context.set(\"message\", msg);\n    context.set(\"orgtopic\", msg.topic);\n    context.set(\"dateroll\", -1);\n    let d = new Date();\n    if (typeof msg.payload === 'string' && msg.payload.length > 0) {\n        for (let i = 0; i < 7; i++) {\n            if (msg.payload.includes(days[i])) {\n                msg.payload = msg.payload.replace(days[i], '').trim();\n                d.setDate(d.getDate() + (i + (7 - d.getDay())) % 7);\n                break;\n            }\n        }\n        if (msg.payload.includes('days')) {\n            d.setDate(d.getDate() + (1 + (7 - d.getDay())) % 7);\n            msg.payload = msg.payload.replace('days', '').trim();\n            context.set(\"dateroll\", 1);\n        }\n    }\n    let num = Number(msg.payload);\n    if (!isNaN(num) && num < 24) {\n        d.setHours(num);\n        d.setMinutes(0);\n    } else {\n        let dt = new Date(msg.payload);\n        if (dt instanceof Date && !isNaN(dt)) {\n            d = dt;\n        } else {\n            d.setHours(0);\n            d.setMinutes(0);\n        }\n    }\n    context.set(\"date\", d.getTime());\n    msg.tsISO = d.toISOString();\n    msg.ts = d.getTime();\n    msg.topic += ' ' + d.toLocaleTimeString();\n    node.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');\n    node.log(\"START   \" + d.toLocaleTimeString() + ' ####################################### payload=' + msg.payload + ' topic=' + msg.topic);\n    node.send(msg);\n\n    let timeObj = setInterval(function () {\n        let msg = context.get(\"message\");\n        let topic = context.get(\"orgtopic\");\n        let dr = context.get(\"dateroll\");\n        let d = new Date(context.get(\"date\"));\n        let dt = d.getDate();\n        if (dr > 0) {\n            dr++;\n            if (dr > 8) { dr = 1; }\n            d.setDate(d.getDate() + (dr + (7 - d.getDay())) % 7);\n            context.set(\"dateroll\", dr);\n        } else {\n            d.setMinutes(d.getMinutes() + minutesEachLoop)\n            d.setDate(dt);\n        }\n        context.set(\"date\", d.getTime());\n        msg.tsISO = d.toISOString();\n        msg.ts = d.getTime();\n        msg.topic = topic + ' ' + d.toLocaleTimeString('de-AT');\n        node.status({ fill: \"green\", shape: \"dot\", text: \"run - \" + d.toLocaleTimeString('de-AT') + ' (' + d.getDay() + ' ' + days[d.getDay()] + ')' });\n        node.log(\"sending \" + d.toLocaleTimeString('de-AT') + ' ####################################### payload=' + msg.payload + ' topic=' + msg.topic);\n        node.send(msg);\n    }, (1000 * loopCycle));\n    context.set(\"timeObj\", timeObj);\n    node.status({ fill: \"green\", shape: \"ring\", text: \"start - \" + d.toLocaleTimeString('de-AT') + ' (' + d.getDay() + ' ' + days[d.getDay()] + ')' });\n    return null;\n}\n\nlet d = new Date(context.get(\"date\"));\nif (!(d instanceof Date) || isNaN(d)) {\n    d = new Date();\n}\nd.setMinutes(d.getMinutes() + 1)\nmsg.tsISO = d.toISOString();\nmsg.ts = d.getTime();\nmsg.topic += ' ' + d.toLocaleTimeString('de-AT');\nnode.status({ fill: \"yellow\", shape: \"dot\", text: \"interposed - \" + d.toLocaleTimeString('de-AT') + ' (' + d.getDay() + ' ' + days[d.getDay()] + ') - ' + msg.payload });\nnode.log(\"sending interposed msg \" + d.toLocaleTimeString('de-AT') + ' ####################################### payload=' + msg.payload + ' topic=' + msg.topic);\nnode.send(msg);\nreturn null;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1330,"y":480,"wires":[["f045ccb8c4fe515f"]]},{"id":"34176bf843170449","type":"inject","z":"19448acc2d95ec58","name":"reset","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"resetOverwrite","payload":"true","payloadType":"bool","x":1130,"y":480,"wires":[["6b64ee5a52599136"]]},{"id":"b47e00f319b013aa","type":"debug","z":"19448acc2d95ec58","name":"Blind position","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1790,"y":540,"wires":[]},{"id":"f045ccb8c4fe515f","type":"blind-control","z":"19448acc2d95ec58","name":"","topic":"#default","addIdType":"none","addId":"","positionConfig":"d2c759ea.3edbc8","autoTrigger":true,"autoTriggerTime":3600000,"startDelayTime":"2000","contextStore":"","results":[{"p":"","pt":"msgTopic","v":"","vt":"topic"},{"p":"","pt":"msgPayload","v":"","vt":"level"},{"p":"slat","pt":"msg","v":"","vt":"slat"},{"p":"blindCtrl","pt":"msg","v":"","vt":"ctrlObj"}],"blindIncrement":"1","blindOpenPos":"100","blindClosedPos":0,"blindPosReverse":false,"blindPosDefault":"open (max)","blindPosDefaultType":"levelFixed","slatPosDefault":"0","slatPosDefaultType":"num","overwriteExpire":"","rules":[{"index":0,"name":"sunrise-end (workday=true)","exec":"0","version":4,"enabled":true,"isValid":true,"validationError":"","conditions":[{"valueType":"flow","value":"ha.workday","operator":"true","thresholdType":"num","threshold":"0"}],"level":{"type":"levelFixed","value":"closed (min)","operator":0},"slat":{"type":"num","value":"100"},"topic":"until 06:00","resetOverwrite":false,"importance":0,"time":{"end":{"type":"entered","value":"06:00","offsetType":"none","offset":"1","multiplier":60000},"days":"*","months":"*"},"description":"<div><i class=\"fa fa-code-fork\" aria-hidden=\"true\"></i> <var>flow.ha.workday</var> is true</div><div><i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i> ↥ until <var>06:00</var></div><div></div><div><div class=\"indent-level-text\"> <i class=\"fa fa-angle-down\" aria-hidden=\"true\"></i><span>blind position: </span> ↕ absolute <var>closed (min)</var></div><div class=\"indent-slatPos-text\"> <i class=\"fa fa-slack\" aria-hidden=\"true\"></i><span>Slat: </span> <var>100</var><div class=\"indent-topic-text\"> <i class=\"fa fa-tasks\" aria-hidden=\"true\"></i><span>Topic: </span> <var>until 06:00</var></div></div>"},{"index":1,"name":"sunrise-end (workday=false)","exec":"0","version":4,"enabled":true,"isValid":true,"validationError":"","conditions":[{"valueType":"flow","value":"ha.workday","operator":"false","thresholdType":"num","threshold":"0"}],"level":{"type":"levelFixed","value":"closed (min)","operator":0},"slat":{"type":"num","value":"100"},"topic":"until sunrise-start","resetOverwrite":false,"importance":0,"time":{"end":{"type":"pdsTime","value":"sunriseStart","offsetType":"none","offset":"1","multiplier":60000,"min":{"type":"entered","value":"07:00","offsetType":"none","offset":"1","multiplier":60000}},"days":"*","months":"*"},"description":"<div><i class=\"fa fa-code-fork\" aria-hidden=\"true\"></i> <var>flow.ha.workday</var> is false</div><div><i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i> ↥ until <var>sunrise start</var><div class=\"indent-time-text\"><i class=\"fa fa-step-backward\" aria-hidden=\"true\"></i> <span>until at the earliest (min)</span> <var>07:00</var></div></div><div></div><div><div class=\"indent-level-text\"> <i class=\"fa fa-angle-down\" aria-hidden=\"true\"></i><span>blind position: </span> ↕ absolute <var>closed (min)</var></div><div class=\"indent-slatPos-text\"> <i class=\"fa fa-slack\" aria-hidden=\"true\"></i><span>Slat: </span> <var>100</var><div class=\"indent-topic-text\"> <i class=\"fa fa-tasks\" aria-hidden=\"true\"></i><span>Topic: </span> <var>until sunrise-start</var></div></div>"},{"index":2,"name":"sunset-end","exec":"0","version":4,"enabled":true,"isValid":true,"validationError":"","conditions":[],"level":{"type":"levelFixed","value":"closed (min)","operator":0},"slat":{"type":"num","value":"100"},"topic":"from sunset-end","resetOverwrite":false,"importance":0,"time":{"start":{"type":"pdsTime","value":"sunsetEnd","offsetType":"none","offset":"1","multiplier":60000},"days":"*","months":"*"},"description":"<div><i class=\"fa fa-clock-o\" aria-hidden=\"true\"></i> ↧ from <var>sunset end</var></div><div></div><div><div class=\"indent-level-text\"> <i class=\"fa fa-angle-down\" aria-hidden=\"true\"></i><span>blind position: </span> undefined <var>closed (min)</var></div><div class=\"indent-slatPos-text\"> <i class=\"fa fa-slack\" aria-hidden=\"true\"></i><span>Slat: </span> <var>100</var><div class=\"indent-topic-text\"> <i class=\"fa fa-tasks\" aria-hidden=\"true\"></i><span>Topic: </span> <var>from sunset-end</var></div></div>"}],"sunControlMode":"16","sunFloorLengthType":"num","sunFloorLength":"0","sunMinDelta":"5","blindPosMin":"closed (min)","blindPosMinType":"levelFixed","blindPosMax":"open (max)","blindPosMaxType":"levelFixed","blindOpenPosOffset":0,"blindClosedPosOffset":0,"sunSlat":"75","sunSlatType":"num","smoothTime":"","sunTopic":"#sun-control","windowTopType":"num","windowTop":"2","windowBottomType":"num","windowBottom":"0","windowSetMode":"startEnd","windowAzimuthStartType":"numAzimuth","windowAzimuthStart":"167","windowAzimuthEndType":"numAzimuth","windowAzimuthEnd":"270","windowOrientationType":"numAzimuth","windowOrientation":"","windowOffsetN":"","windowOffsetP":"","oversteers":[{"mode":0,"valueType":"global","value":"cinema-mode","operator":"true","operatorText":"is true","thresholdType":"num","threshold":"0","onlySunInWindow":true,"blindPos":{"type":"levelFixed","value":"closed (min)"},"slatPos":{"type":"num","value":"100"}},{"mode":0,"valueType":"global","value":"ha.away-mode","operator":"true","operatorText":"is true","thresholdType":"num","threshold":"0","onlySunInWindow":true,"blindPos":{"type":"levelFixed","value":"open (max)"},"slatPos":{"type":"num","value":"0"}}],"oversteerTopic":"#oversteered","x":1580,"y":540,"wires":[["b47e00f319b013aa"],[]]},{"id":"a834457e94c59bdf","type":"inject","z":"19448acc2d95ec58","name":"5 / 0.1 (start/stop)","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"minutes","v":"5","vt":"num"},{"p":"delay","v":"0.1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"start/stop","payload":"0","payloadType":"num","x":1100,"y":360,"wires":[["6b64ee5a52599136"]]},{"id":"59754e0e47dbfd89","type":"inject","z":"19448acc2d95ec58","name":"60 / 0.5 (start/stop)","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"minutes","v":"60","vt":"num"},{"p":"delay","v":"0.5","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"start/stop","payload":"0","payloadType":"num","x":1090,"y":400,"wires":[["6b64ee5a52599136"]]},{"id":"1e5630442b0e828f","type":"inject","z":"19448acc2d95ec58","name":"60 / 1 (start/stop)","props":[{"p":"payload"},{"p":"topic","vt":"str"},{"p":"minutes","v":"60","vt":"num"},{"p":"delay","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"start/stop","payload":"0","payloadType":"num","x":1100,"y":440,"wires":[["6b64ee5a52599136"]]},{"id":"9abbd4d0749a7064","type":"inject","z":"19448acc2d95ec58","name":"mode=0 (no-sun-control)","props":[{"p":"mode","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1290,"y":520,"wires":[["f045ccb8c4fe515f"]]},{"id":"c0dcdc50938fcbe3","type":"inject","z":"19448acc2d95ec58","name":"mode=2 (summer)","props":[{"p":"mode","v":"2","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1310,"y":560,"wires":[["f045ccb8c4fe515f"]]},{"id":"465f56bf195d2883","type":"inject","z":"19448acc2d95ec58","name":"mode=1 (winter)","props":[{"p":"mode","v":"1","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":1320,"y":600,"wires":[["f045ccb8c4fe515f"]]},{"id":"d2c759ea.3edbc8","type":"position-config","name":"obfuscated-address","isValide":"true","angleType":"deg","timeZoneOffset":99,"timeZoneDST":0,"stateTimeFormat":"3","stateDateFormat":"12","contextStore":"","sunPositions":[],"predefAngles":[]}]
@florianmulatz florianmulatz changed the title Maximum call stack size exceeded Maximum call stack size exceeded / blind-control Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant