Value through switch permanently

Yeah, ok. But sorry I am still missing something.

The topic is set in the first change node. No need to delete the msg.payload.

Is this how it will be in the (even) bigger picture?
The node copied (though slightly modified to different names) as indicated.

But there is still a big problem I can see.

At the first function node..... What is going into there?

I am struggling to see how the input works.

You have 18 readings coming in and need to display them on a chart.
Each one with a different colour and name.

There seems to be something missing at the start which I think you are also missing which can make this a whole lot easier.

Can you show an example of what is sent into this part of the flow?

first : the payload deleting in the Change node is out :slight_smile:

second: may be this can help to understand :slight_smile: :slight_smile:

and in the Funktion node i send the value,labelname to the Chart if the switch is used. if not i send "0"
i make some other Things there too, not related to the Chart but Need to be worked on that Position.

i want to Show the Chart labels dynamicly too, only for shown data, but that is for later.

a sample of the payload going into that is my first posted picture

Ok.

But now I see a new link from the function node to the second switch. Wasn't there before.

Ok, so if I now get what you are doing it is something like:

Start of flow... input (function node) Message is from any one of eighteen sources.

The incoming message is split (as in is sent to two places) and goes directly to the join node where it is held waiting for a second message to arrive, and the other to a switch (indirectly) to be used to create a message part to indicate if you want this to be passed to the chart or not.

I am still stuck on why the other switch nodes don't have anything on their input/s.

So, the second part of the original message then arrives at the join node and a message is made - and then sent - to the function node.

That takes the message apart and looks if this data should be then on sent to the chart.
If it is marked as pass it is sent. If it marked as block it is not.

Is that about what is happening?
Still: why don't the other switch nodes have inputs to set their names?

I just saw you edited your post:
This one
Sorry. It is now out of context. I can't see what you edited.
No problem, but I can't use it now with what I said.

Can you put a debug node at the start of the flow and show me what you are sending from a couple of the different sources?

  1. the new Connection to the second switch was for testing Purpose :slight_smile:

  2. i have one source (here the empty function node left) with 18 values and valuenames like in the first Picture (i cut it to 4 sets for testing)

  3. normally you dont Need Inputs for the switches. if a switch is used in the Dashboard the switch node send a string "true" -> Change node for the join preparation -> join node for Building the message ->Funktion node where i check on that "true" to pass data to the Chart and textnodes.
    i would like to find a way to "block" a msg from Function node dynamicly, atm i send "0" as value.

  4. the Change node before the first switch is for changing the switch label on the dashoard with a Name i get from the payload.

  5. i have around 20 such payloads that i want to Display that way. i will try to use only one flow for all with switching between the inputsets later but thats not the case in this example..

i hope i covered all Questions … that editing isnt easy to follow

Ok.

So could you please indulge me by posting a couple of messages that are for different chart colours?

Please paste them as I explained above.
Over to the right of the output you move the mouse and there is a copy value pops up.
Paste it here after clicking the </> button above.

Thanks.

{"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"}

i hope thats Right ?

Yes, hang on while I decode it.

Ok, this isn't easy for me, but here goes:

This is the payload part of the message.

{"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"},

This is what I can make of the payload part:

{"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"},

Which parts of these change for the different sources?

I'm guessing one of the lines with the name part of the line.
But only one of them should change to indicate the next source.

Or is it done in another part of the message?
(Gotta ask)
Or is it the topic that changes?

i dont understand the Question About different Sources.

this set of payload (originally 18 x value and 18 x Name) Comes from 1 source.

for later there will be around 20 Sources (divided by Topic) with the same set of 18+18 but not in this state.

i use the Name für changing the switch label and the value for the value.

Oh, ok. Got you now. So the message is constructed before it gets here.

That is just 4 rather than 18 of them.

Ok.

I am sorry for not getting that sooner.

So, now I am with you on that.

With that, you seem to only ever use #1's message to set the name of the switch.
Again: So the change node would be replicated all the way down to the other switch nodes but they extract different parts of the message.

Where the change node you have shown in the example sets the topic to:
payload.MQTTWert1name
The second version would set the topic to:
payload.MQTTWert2name

and so on all the way to 18.

So let's build on that. Alas it is probably going to be modified once we establish it works.

I can post the flow as I think it will be to get the desired result if you want.
But before that, I want to be sure I understand how it all works.

I haven't been following the thread, but if all you need to do is to stop the message you send to the switch being sent on then clear the Pass Through Message checkbox in the switch config.
If that is not the problem you are seeing then please ignore this post.

Thanks @Colin but I am trying to take baby steps (no offence @Chorum)
I want to get one part working, then expand that to all.

Then, show a better way to do it - or another way.

It has taken me a long time to get my head around the message structure and it has only now fallen into place how it works.

Oops.

@Chorum:

This is a bit of a rebuild of what you posted.

I put the example message in the function node and use the inject node to inject the message.

It works and the switches get the right names.

[{"id":"8d08193c.f7a5d8","type":"ui_switch","z":"b9924a74.4d98f8","name":"","label":"{{msg.topic}}","tooltip":"","group":"ec41bf90.caf2a","order":1,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":1170,"y":4070,"wires":[["a5f9774b.5510d8"]]},{"id":"4c68517d.8f0068","type":"ui_switch","z":"b9924a74.4d98f8","name":"","label":"{{msg.topic}}","tooltip":"","group":"ec41bf90.caf2a","order":2,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":1170,"y":4100,"wires":[["7e837175.314d9"]]},{"id":"196b1998.e7208e","type":"ui_switch","z":"b9924a74.4d98f8","name":"","label":"{{msg.topic}}","tooltip":"","group":"ec41bf90.caf2a","order":3,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":1170,"y":4130,"wires":[["623733d1.dbcdec"]]},{"id":"8dd6be10.f35b08","type":"ui_switch","z":"b9924a74.4d98f8","name":"","label":"{{msg.topic}}","tooltip":"","group":"ec41bf90.caf2a","order":4,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":1170,"y":4160,"wires":[["2ae85942.130a56"]]},{"id":"6c00509e.93aca","type":"change","z":"b9924a74.4d98f8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert1name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":4070,"wires":[["8d08193c.f7a5d8"]]},{"id":"c32ad7b3.fd898","type":"change","z":"b9924a74.4d98f8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert2name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":4100,"wires":[["4c68517d.8f0068"]]},{"id":"a7c9c4f7.82dc38","type":"change","z":"b9924a74.4d98f8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert3name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":4130,"wires":[["196b1998.e7208e"]]},{"id":"2a01eaa3.970afe","type":"change","z":"b9924a74.4d98f8","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert4name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1020,"y":4160,"wires":[["8dd6be10.f35b08"]]},{"id":"f319b7aa.05703","type":"function","z":"b9924a74.4d98f8","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":990,"y":4370,"wires":[["6c00509e.93aca","87b86163.c09e5","c32ad7b3.fd898","a7c9c4f7.82dc38","6525dbf6.870b14","2a01eaa3.970afe"]]},{"id":"f87fa938.93f1b","type":"inject","z":"b9924a74.4d98f8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":830,"y":4370,"wires":[["f319b7aa.05703"]]},{"id":"ec41bf90.caf2a","type":"ui_group","z":"","name":"Messwerte auswählen","tab":"260a696.4ccbf96","order":1,"disp":true,"width":"29","collapse":false},{"id":"260a696.4ccbf96","type":"ui_tab","z":"","name":"W16-Chart","icon":"dashboard","order":11,"disabled":false,"hidden":false}]

See how the switch nodes have slightly been changed.
This isn't too important as you said the original way worked.

But I would like to stress it may be better if you do it the way I show in this code because we are going to build on that part later.

Can you confirm you are getting this part working?

Hey Colin,
thats Right and i tried that.
but didnt help :frowning:

Hello,

at first, thank you for your Patience Trying_to_learn !

i have got that flow working, and it works fine. As far i understand the payload isnt routed through the switch because the Topic changed ?

what i didnt find was the slightly change in the switches ?

And there is one Thing with that flow: if i inject a second time the switches are resetted to "off"
I would like to have a stable switch Position only for Manual changes of the switchposition.

( later i want to put a timer behind that, so the switches go off after 30 minutes, thats necessary because i have to send a message to the Client at that time. but thats for later)

The Problem seems to be the Change node before the switch. if it is connected the switch sends true and cannot hold switch Position. without it it works normally.

atm i work on that

I have tried something different.
The switch node only becomes 1 value in the payload: the name for the switch.
after the switch i use a change node to get the switch value in a global variable.
In the function node i ask on that variable and without the first change node for namegiving everything works again fine.

I dont understand that. i check on a global variable to pass values through the function node and the switch does not get any value, only the Name that i want him to have.
From where Comes the value ?

[{"id":"fef7d669.96ce98","type":"change","z":"af61c022.bc96e","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"Wertcheck1","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":3940,"y":2370,"wires":[[]]},{"id":"e9b9dd78.e10f1","type":"ui_switch","z":"af61c022.bc96e","name":"","label":"{{msg.topic}}","tooltip":"","group":"22029319.b38d4c","order":1,"width":"3","height":"1","passthru":true,"decouple":"false","topic":"ATESTEO/Wolfsburg/W16","style":"","onvalue":"true","onvalueType":"str","onicon":"","oncolor":"","offvalue":"false","offvalueType":"str","officon":"","offcolor":"","x":3650,"y":2370,"wires":[["fef7d669.96ce98"]]},{"id":"ff5e497e.748c38","type":"change","z":"af61c022.bc96e","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"payload.MQTTWert1name","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":3500,"y":2370,"wires":[["e9b9dd78.e10f1"]]},{"id":"22029319.b38d4c","type":"ui_group","z":"","name":"Messwerte auswählen","tab":"ec7a53af.4ac29","order":1,"disp":true,"width":"29","collapse":false},{"id":"ec7a53af.4ac29","type":"ui_tab","z":"","name":"W16-Chart","icon":"dashboard","order":11,"disabled":false,"hidden":false}]

i really dont understand that….

New try:
Injecting the switchname once, while switch is on off.
Works fine again.
If i put the switch on "on" the value flows. but if i put the switch on "off" again, the value flow continous.
i cant figure out how...

It is good to see you are trying things.

Alas there is no magic answer. Alas you have to put in the work.

Sorry, I haven't really checked your latest flow, but I would like to discuss what you are wanting to do and how.

We all see things differently, and that is a good thing, otherwise it would be a very boring world.

So, from what I have seen, and only recently realised is you are combining all the messages from the 18 inputs to one big message, as an object (I think is the term).

Your function node needs to see the messages come in, and parse them and check if the allow part is set.
If it is, it passes the message and its value.
If it is not set (or blocked - if you will), it doesn't allow the message to get through, or replaces the value with a 0.

But how you are doing it is ........ complicating things a bit.

So I want to present you an alternative solution/method:

You get the message/s coming in.
For now I will use the 4 you supplied.
(From before)

{"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"},

You are needing to filter the messages on their MQTTWertxname part.

So, you have .... 4 inputs. (We can expand it to 18 once we get the mechanics working better.)

How are you making this message?

I think we may need to start there.

I am guessing you are using a join node?