Closed trantoriana closed 6 years ago
To override the values of timeout and warning (both in seconds and not quoted) I send JSON to the node. I did find another bug which is tied to the previous warning bug. Not sure how I fix can this yet. But I think this example should work (using your work-around).
Give this a try:
[{"id":"ea784bf5.afce98","type":"inject","z":"80c9acc8.9bf46","name":"","topic":"","payload":"{\"payload\":\"on\",\"timeout\":30,\"warning\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":332.1999702453613,"y":439.19997215270996,"wires":[["9e32010a.60c13"]]},{"id":"9e32010a.60c13","type":"mytimeout","z":"80c9acc8.9bf46","name":"","outtopic":"","outsafe":"ON","outwarning":"OFF","outunsafe":"OFF","warning":"1","timer":"","limit":"","repeat":false,"again":false,"x":531.2000122070312,"y":439.99998474121094,"wires":[["f88de465.20d038"]]},{"id":"f88de465.20d038","type":"debug","z":"80c9acc8.9bf46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":731.2000122070312,"y":439.99998474121094,"wires":[]}]
While I could not import your above flow, I did add a JSON trigger containing following JSON code, as pef your example:
{"payload":"on","timeout":30,"warning":1}
Funny thing is, mytimeout node starts at 0 and counts down in the minus.
Perhaps your should update a new release first, so we can both test on the latest version.
The right JSON code is btw:
{"payload":"on","timer":30,"warning":1}
Fixed this with a formula transforming the input (timer in seconds) to a mytimeout structure using following:
x = msg.payload; msg.payload = {"payload":"on","timer":x,"warning":1}; return msg;
Tran
Hi Neil,
In order to optimize and simplify my workflow drastically, I would like to put in the timeout value as part of the payload. I have tried multiple combinations, but I always get a NaN when I start the timer.
I fear the mytimer is unable to accept its timeoute/timeout/timer value from the incoming payload.
Given following example workflow, can you change the switch so the timer can be set to either input value ?
Thanks, Tran
[{"id":"183764d3.7dc30b","type":"mytimeout","z":"fd7a7f8d.a9edc","name":"","outtopic":"","outsafe":"ON","outwarning":"OFF","outunsafe":"OFF","warning":"1","timer":"","limit":"","repeat":false,"again":false,"x":530,"y":200,"wires":[["a8a646f4.6becc8"]]},{"id":"f0ec29f6.98bf78","type":"inject","z":"fd7a7f8d.a9edc","name":"","topic":"","payload":"30","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":180,"wires":[["cbdc8a80.4524d8"]]},{"id":"8c7644a0.242c38","type":"inject","z":"fd7a7f8d.a9edc","name":"","topic":"","payload":"60","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":220,"wires":[["cbdc8a80.4524d8"]]},{"id":"cbdc8a80.4524d8","type":"change","z":"fd7a7f8d.a9edc","name":"","rules":[{"t":"set","p":"timeoute","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":200,"wires":[["183764d3.7dc30b","a532595b.a40a88"]]},{"id":"a8a646f4.6becc8","type":"debug","z":"fd7a7f8d.a9edc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":730,"y":200,"wires":[]},{"id":"a532595b.a40a88","type":"debug","z":"fd7a7f8d.a9edc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":530,"y":260,"wires":[]}]