Value through switch permanently

Point #2: After Setting two switches to "ON"
Which looks like it is per the picture below. #1 and #3 on.

Point #3: What do you mean? After the first inject.......

This is going to be getting .... a lot of messages a second from what you are telling me.
So?

Point #3 button picture.
What happened there? The two switches are now off. Are you saying you didn't do that?

Here is my system with multiple pressses of the inject node and the correct data is getting through and the switches are remaining the same.

  1. thats right
  2. thats right

my switches dont stay at theyre position. my flow behavior is different.
i dont know why but it is so :frowning:

Paste the code.....

There is no other way to work out the problem.

Ok here it is:

[{"id":"4499275c.a97338","type":"function","z":"af61c022.bc96e","name":"","func":"msg = {\"topic\":\"ATESTEO/Wolfsburg/W16\",\"payload\":{\"MQTTWert1\":\"25.1\",\"MQTTWert1name\":\"T_BoxenLuft\",\"MQTTWert2\":\"-101\",\"MQTTWert2name\":\"N_EMA_VL\",\"MQTTWert3\":\"932\",\"MQTTWert3name\":\"n_Antrieb\",\"MQTTWert4\":\"269\",\"MQTTWert4name\":\"M_Antrieb\",\"Status\":\"Läuft\"},\"qos\":1,\"retain\":false,\"_topic\":\"ATESTEO/Wolfsburg/W16\",\"_msgid\":\"3f4512b0.dc5bee\",\"kColor\":\"black\",\"vColor\":\"black\",\"template\":\"<html>\\n<head>\\n<style>\\ntable.FixedTable\\n{\\n    table-layout: fixed;\\n    border: 0;\\n}\\n</style>    \\n</head>\\n<body>\\n<table class=\\\"FixedTable\\\">\\n <tbody>\\n  <tr ng-repeat=\\\"(k,v) in msg.payload\\\" ng-if=\\\"k != 'Item'\\\">\\n   <td style=\\\"width: 250; color:{{msg.kColor}}\\\">{{k}}</td>\\n   <td style=\\\"text-align:justify; color:{{msg.vColor}}\\\">{{v}}</td>\\n  </tr>\\n </tbody>\\n</table>\\n</body>\\n</html>\",\"color\":\"lime\"};\nreturn msg;","outputs":1,"noerr":0,"x":3740,"y":1860,"wires":[["cdd158f.53ff5a8","fb660729.4f3078","3bce696a.0ad486","9235f258.0d0fa","80a585c.1926578"]]},{"id":"fed3f617.6dba38","type":"inject","z":"af61c022.bc96e","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":3580,"y":1860,"wires":[["4499275c.a97338"]]},{"id":"cdd158f.53ff5a8","type":"debug","z":"af61c022.bc96e","name":"A","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":3720,"y":1920,"wires":[]},{"id":"fb660729.4f3078","type":"change","z":"af61c022.bc96e","name":"Part 1","rules":[{"t":"set","p":"value","pt":"msg","to":"payload.MQTTWert1","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert1name","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3910,"y":1740,"wires":[["a038ac37.4bf61","ad1d2ea7.89726"]]},{"id":"3bce696a.0ad486","type":"change","z":"af61c022.bc96e","name":"Part 2","rules":[{"t":"set","p":"value","pt":"msg","to":"payload.MQTTWert2","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert2name","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3910,"y":1820,"wires":[["1579598d.e8fe96","d542a959.78c438"]]},{"id":"9235f258.0d0fa","type":"change","z":"af61c022.bc96e","name":"Part 3","rules":[{"t":"set","p":"value","pt":"msg","to":"payload.MQTTWert3","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert3name","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3910,"y":1910,"wires":[["397de4.6c65021c","82057e6e.fa098"]]},{"id":"80a585c.1926578","type":"change","z":"af61c022.bc96e","name":"Part 4","rules":[{"t":"set","p":"value","pt":"msg","to":"payload.MQTTWert4","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert4name","tot":"msg"},{"t":"delete","p":"payload","pt":"msg"},{"t":"move","p":"value","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3910,"y":1980,"wires":[["9055e4cd.054608","d6b3b106.10e2b"]]},{"id":"a038ac37.4bf61","type":"function","z":"af61c022.bc96e","name":"","func":"//  Look for message from `switch`\n//  and set context.\n\nif (msg.payload == \"true\")\n{\n    context.set(\"ONOFF\",\"1\");\n    node.status({fill:\"green\",shape:\"dot\",text:\"PASS\"});\n    return;\n} else\nif (msg.payload == \"false\")\n{\n    context.set(\"ONOFF\",\"0\");\n    node.status({fill:\"red\",shape:\"dot\",text:\"BLOCK\"});\n    return;\n}\nvar pass = context.get(\"ONOFF\") || 0;\nif (pass == \"0\")\n{\n    //msg.payload = 0;\n    return;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":4370,"y":1740,"wires":[["6c991197.d1a23","17d63c2a.a5a5f4"]]},{"id":"ad1d2ea7.89726","type":"ui_switch","z":"af61c022.bc96e","name":"","label":"{{msg.topic}}","tooltip":"","group":"4590e919.a4d868","order":1,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":4040,"y":1710,"wires":[["a038ac37.4bf61","72738f62.28c0a"]]},{"id":"1579598d.e8fe96","type":"ui_switch","z":"af61c022.bc96e","name":"","label":"{{msg.topic}}","tooltip":"","group":"4590e919.a4d868","order":2,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":4040,"y":1780,"wires":[["d542a959.78c438"]]},{"id":"d542a959.78c438","type":"function","z":"af61c022.bc96e","name":"","func":"//  Look for message from `switch`\n//  and set context.\n\nif (msg.payload == \"true\")\n{\n    context.set(\"ONOFF\",\"1\");\n    node.status({fill:\"green\",shape:\"dot\",text:\"PASS\"});\n    return;\n} else\nif (msg.payload == \"false\")\n{\n    context.set(\"ONOFF\",\"0\");\n    node.status({fill:\"red\",shape:\"dot\",text:\"BLOCK\"});\n    return;\n}\nvar pass = context.get(\"ONOFF\") || 0;\nif (pass == \"0\")\n{\n    //msg.payload = 0;\n    return;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":4370,"y":1820,"wires":[["6353f523.ae4e5c","85063ef8.41c77"]]},{"id":"397de4.6c65021c","type":"ui_switch","z":"af61c022.bc96e","name":"","label":"{{msg.topic}}","tooltip":"","group":"4590e919.a4d868","order":3,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":4040,"y":1870,"wires":[["82057e6e.fa098"]]},{"id":"82057e6e.fa098","type":"function","z":"af61c022.bc96e","name":"","func":"//  Look for message from `switch`\n//  and set context.\n\nif (msg.payload == \"true\")\n{\n    context.set(\"ONOFF\",\"1\");\n    node.status({fill:\"green\",shape:\"dot\",text:\"PASS\"});\n    return;\n} else\nif (msg.payload == \"false\")\n{\n    context.set(\"ONOFF\",\"0\");\n    node.status({fill:\"red\",shape:\"dot\",text:\"BLOCK\"});\n    return;\n}\nvar pass = context.get(\"ONOFF\") || 0;\nif (pass == \"0\")\n{\n    //msg.payload = 0;\n    return;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":4370,"y":1910,"wires":[["8f38ba64.dc5d38","8cd5d1b6.95fcf"]]},{"id":"9055e4cd.054608","type":"ui_switch","z":"af61c022.bc96e","name":"","label":"{{msg.topic}}","tooltip":"","group":"4590e919.a4d868","order":4,"width":"3","height":"1","passthru":false,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":4040,"y":1950,"wires":[["d6b3b106.10e2b"]]},{"id":"d6b3b106.10e2b","type":"function","z":"af61c022.bc96e","name":"","func":"//  Look for message from `switch`\n//  and set context.\n\nif (msg.payload == \"true\")\n{\n    context.set(\"ONOFF\",\"1\");\n    node.status({fill:\"green\",shape:\"dot\",text:\"PASS\"});\n    return;\n} else\nif (msg.payload == \"false\")\n{\n    context.set(\"ONOFF\",\"0\");\n    node.status({fill:\"red\",shape:\"dot\",text:\"BLOCK\"});\n    return;\n}\nvar pass = context.get(\"ONOFF\") || 0;\nif (pass == \"0\")\n{\n    //msg.payload = 0;\n    return;\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":4370,"y":1980,"wires":[["475a584d.85b9b8","57d50499.2e0bac"]]},{"id":"6c991197.d1a23","type":"debug","z":"af61c022.bc96e","name":"1","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":4500,"y":1740,"wires":[]},{"id":"17d63c2a.a5a5f4","type":"debug","z":"af61c022.bc96e","name":"a","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":4500,"y":1770,"wires":[]},{"id":"72738f62.28c0a","type":"debug","z":"af61c022.bc96e","name":"From switch","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":4390,"y":1710,"wires":[]},{"id":"6353f523.ae4e5c","type":"debug","z":"af61c022.bc96e","name":"2","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":4500,"y":1820,"wires":[]},{"id":"85063ef8.41c77","type":"debug","z":"af61c022.bc96e","name":"b","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":4500,"y":1850,"wires":[]},{"id":"8f38ba64.dc5d38","type":"debug","z":"af61c022.bc96e","name":"3","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":4500,"y":1910,"wires":[]},{"id":"8cd5d1b6.95fcf","type":"debug","z":"af61c022.bc96e","name":"c","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":4500,"y":1940,"wires":[]},{"id":"475a584d.85b9b8","type":"debug","z":"af61c022.bc96e","name":"4","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":4500,"y":1980,"wires":[]},{"id":"57d50499.2e0bac","type":"debug","z":"af61c022.bc96e","name":"d","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":4500,"y":2010,"wires":[]},{"id":"4590e919.a4d868","type":"ui_group","name":"Group 3","tab":"1ef82eaa.71cac1","order":3,"disp":true,"width":6},{"id":"1ef82eaa.71cac1","type":"ui_tab","z":"","name":"W16-Chart","icon":"dashboard","order":11,"disabled":false,"hidden":false}]

But i have a working solution with my changed flow...

There is something happening which either you aren't telling me, or is systemically doing things you don't know.

I load the code and it works exactly as expected.

I turn on switch 1 and 3 and sit there bashing the inject node and only get a and c outputs. Repeatedly.

How your switches are being turned off is way beyond my skills.

I have another thing to mention but will do it in another post to help keep things separate.

The message which is being injected:

It is a cut down version which will contain 18 messages.

You will be receiving a few messages at a pretty good rate which will require a lot of number crunching.

The sample message you gave me has a lot of overhead which you say is needed.... for.....? Dunno.

Stripping this at the start will greatly help with processing the messages later on.

I am sorry, i cant tell you why this happens.
I agree to cuting the msg down to needed payload at the entry of that part of the flow.
but i think i dont know how. u want to get rid of the remplate as i understand?
For the payload : i thought deleting with a Change node is enough...

It is what it is.

I can't help you any more.

What I posted works to do what you want - as best I can understand - yet it does weird things on your machine, which it doesn't do on mine.

Good luck.

Thanks for your help!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.