linuxha / node-red-contrib-mytimeout

A dynamic count down timer for node-red
MIT License
10 stars 10 forks source link

L495: newMsg(inMsg): RangeError: Maximum call stack size exceeded #15

Open Unpuertomex opened 6 years ago

Unpuertomex commented 6 years ago

After updating to 3.0.1, I'm getting the following error: "L495: newMsg(inMsg): RangeError: Maximum call stack size exceeded <{"payload":

It doesn't prevent the node from running but the error pops up everytime it runs.

linuxha commented 6 years ago

What are you inputting to the node? I recall seeing that if I sent the node a payload within a payload within a payload. I thought I squashed that one but it looks like there's more to it.

Post the json here and I'll see what I can figure it out. The message may be a warning (hence the reason it doesn't crash).

The reason for the payload within a payload support is so I can send from mqtt. I didn't know about the existing nodes that can handle that for me. I may adjust the documentation to provide an example with that node and at some later date remove that functionality from mytimeout. But not yet.

For now I'll just provide a better set of examples and update the documentation. That should help get pointed in the correct direction.

Unpuertomex commented 6 years ago

Here you go. I don't believe it is a nest payoad situation, there are two items that cause the timer to initiate, however I could be wrong.

[{"id":"e272a0ca.75d75","type":"switch","z":"e6ab8208.bfbbe","name":"The Switch","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":660,"wires":[["992a6c8e.2311f"],["f25edd93.9e683","f0a27f60.55e73"]]},{"id":"992a6c8e.2311f","type":"api-call-service","z":"e6ab8208.bfbbe","name":"On","server":"f0aa0465.fa7ce8","service_domain":"switch","service":"turn_on","data":"{\"entity_id\":\"switch.arellys_bedroom_light_switch\"}","mergecontext":"","x":690,"y":660,"wires":[["f0a27f60.55e73"]]},{"id":"a44e242c.1a93e8","type":"ui_switch","z":"e6ab8208.bfbbe","name":"","label":"Arelly","group":"4bb4b124.c9376","order":17,"width":"2","height":"1","passthru":true,"decouple":"false","topic":"{switch.arellys_bedroom_light_switch}","style":"","onvalue":"on","onvalueType":"str","onicon":"highlight","oncolor":"red","offvalue":"off","offvalueType":"str","officon":"highlight","offcolor":"white","x":270,"y":660,"wires":[["e272a0ca.75d75"]]},{"id":"819620f7.2364a","type":"server-state-changed","z":"e6ab8208.bfbbe","name":"Arellys Bedroom","server":"f0aa0465.fa7ce8","entityidfilter":"switch.arellys_bedroom_light_switch","entityidfiltertype":"substring","haltifstate":"","x":100,"y":660,"wires":[["a44e242c.1a93e8"]]},{"id":"c31751d1.51f23","type":"ui_slider","z":"e6ab8208.bfbbe","name":"Arellys timer recramara","label":"M: {{value}}","group":"4bb4b124.c9376","order":18,"width":"2","height":"1","passthru":true,"topic":"","min":"15","max":"60","step":"5","x":330,"y":600,"wires":[["992a6c8e.2311f","8cfd9301.823b1"]]},{"id":"f0a27f60.55e73","type":"mytimeout","z":"e6ab8208.bfbbe","name":"My Timeout","outtopic":"","outsafe":"on","outwarning":"Warning","outunsafe":"off","warning":"5","timer":"900","debug":"","repeat":false,"again":false,"x":930,"y":600,"wires":[["e0b84a42.bdb778"],[]]},{"id":"25d6ac85.b0a0c4","type":"change","z":"e6ab8208.bfbbe","name":"set timer count","rules":[{"t":"set","p":"timeout","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":600,"wires":[["f0a27f60.55e73"]]},{"id":"e0b84a42.bdb778","type":"switch","z":"e6ab8208.bfbbe","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1090,"y":600,"wires":[["f25edd93.9e683"]]},{"id":"f25edd93.9e683","type":"change","z":"e6ab8208.bfbbe","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"data\":{\"entity_id\":\"switch.arellys_bedroom_light_switch\"}}","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1240,"y":600,"wires":[["603c0ca0.8033a4"]]},{"id":"603c0ca0.8033a4","type":"api-call-service","z":"e6ab8208.bfbbe","name":"Off","server":"f0aa0465.fa7ce8","service_domain":"switch","service":"turn_off","data":"","mergecontext":"","x":1390,"y":600,"wires":[[]]},{"id":"8cfd9301.823b1","type":"function","z":"e6ab8208.bfbbe","name":"Convert to minutes","func":"msg.payload = msg.payload * 60\nreturn msg;","outputs":1,"noerr":0,"x":550,"y":600,"wires":[["25d6ac85.b0a0c4"]]},{"id":"f0aa0465.fa7ce8","type":"server","z":"","name":"Home Assistant","url":"http:\\\\111.168.1.111:8123","pass":"PWS"},{"id":"4bb4b124.c9376","type":"ui_group","z":"","name":"Lights","tab":"c5e67c2b.eb40e","order":1,"disp":false,"width":"6","collapse":false},{"id":"c5e67c2b.eb40e","type":"ui_tab","z":"","name":"Dashboard","icon":"dashboard","order":1}]

Unpuertomex commented 6 years ago

@linuxha, how is it going with this error?

linuxha commented 5 years ago

My appologies, been a very exhausting week. I'll drop your flow into my docker and take a look at it. Can you get a sample of what was sent to the input of the flow?

linuxha commented 5 years ago

First, I'm missing the 3 server-state-changed nodes. So I don't know what they are. Can you tell me what those nodes are?

linuxha commented 5 years ago

Sorry there are 2 api-call-service and 1 server-state-change.

linuxha commented 5 years ago

Okay, good news. The message is a warning, not an error. What it's saying is that the msg sent is pretty much in an unexpected message format (probably from the slider) and I treat it just as an on message.

            // Basically treat the unknown payload as an on (i.e. anything can
            // tickle the timer as long as it's not off, 0, stop or cancel)

The warning is so you'll know to take a look at your inputs., I'd recommend sending the mytimeout inputs to a debug node (with output set to the complete message).

Unpuertomex commented 5 years ago

Sorry been working late. I'll add the debug and report back.

Unpuertomex commented 5 years ago

I added the debug node and the payload is just 2 letters "on" and as you can see by the screenshot below the ticker continues to work. snip_20181025205711

Here are the settings snip_20181025205740

linuxha commented 5 years ago

Ah, I see the issue, in the screen shot of the warning, the payload is a json object (not on, off, ... etc.). That confuses the timer's message handler. The warning is only there so the user knows, just in case it's not supposed to do that. I haven't quick figured out how to word the message to make it clearer.

linuxha commented 5 years ago

An I completely understand about working late. Been a long several months for me (I'm QA, I break things)

frogale commented 5 years ago

It will be better if no warning will popup.. I want only start the timer with any message.. With this behavior I have to add another node before mytimeout to set correct input...

Btw (offtopic): I am missing another feature - disable output "on" message.. It cannot be empty for now.. Again, I have to add another node after mytimeout to filter "on" messages..

Maybe I want only something what standard "delay" node can.. But I love "visible countdown" in your mytimeout node :-)

linuxha commented 4 years ago

I might add, a disable warning option to the config gui. I'll need to figure out how to handle that in the code but I think it should be doable.

I'm working on the 'disable output "on" message'. At the moment I haven't quite got it right.

Most of my time is being spent on writing up new end-to-end test cases to cover the existing and new requirements. I had the requirements all in my head, not a good idea. I have no idea how to write up unit test cases for a node. So far my new tests have found a few bugs.