Output two attributes in the template

Hi,
how can I output msg.xx and msg.yy simultaneously in a template?

> <div design="row" >
>  <p><b><font size="7" color="red"><marquee scrollamount="15" scrolldelay="10" direction="left" style="background-color: yellow !important;">{{msg.door}}&{{msg.help}}</marquee></font></b></p>
> 
> </div>

This code displays either msg.door or msg.help in my marquee, but never both at the same time.

Are you sure they are both present in one message you are sending to the node?
Check with a debug node to make sure that both exist in a message.

No, they are not both present in one message, how do i get both in a message?

Well that depends where they are coming from. You could try looking at the join node.
or look at how to store data
https://nodered.org/docs/writing-functions#storing-data

Where one flow writes the value for say help and then the flow where door is set picks up the last "help" value from the stored data.

I can not stand it, with the join node I can pack both payloads in one, but for my display in the marquee this does not help me, because if msg.door is high and msg.help is not, msg.door will be displayed. If msg.door is high and msg.help becomes active 10 seconds later, only msg.help will be displayed. both are only displayed if they are activated at the same time

Which is why I also suggested you look at how to store data.

It sounds as if you want both values to be stored. So that when new message comes in
for door it picks up the latest value of help
and if a new help message comes in it picks up the latest version of door.

See

[{"id":"bc95c600.8a7ff","type":"inject","z":"44c6969d.6be6c","name":"","topic":"","payload":"Door1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":125.5,"y":121,"wires":[["e74f067f.68d2e8"]]},{"id":"40776dfa.949a94","type":"inject","z":"44c6969d.6be6c","name":"","topic":"","payload":"Help1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":136,"y":260,"wires":[["527b8184.c9bcc8"]]},{"id":"c04f22bc.ece308","type":"inject","z":"44c6969d.6be6c","name":"","topic":"","payload":"Door2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":126,"y":160,"wires":[["e74f067f.68d2e8"]]},{"id":"2a297a3f.5793fe","type":"inject","z":"44c6969d.6be6c","name":"","topic":"","payload":"Help2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":135,"y":301,"wires":[["527b8184.c9bcc8"]]},{"id":"e74f067f.68d2e8","type":"change","z":"44c6969d.6be6c","name":"","rules":[{"t":"set","p":"door","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":272.5,"y":141,"wires":[["6eed31e.adb2c5"]]},{"id":"527b8184.c9bcc8","type":"change","z":"44c6969d.6be6c","name":"","rules":[{"t":"set","p":"help","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":279,"y":278,"wires":[["20dcad07.a5a60a"]]},{"id":"6eed31e.adb2c5","type":"change","z":"44c6969d.6be6c","name":"","rules":[{"t":"set","p":"door","pt":"global","to":"door","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":499.5,"y":140,"wires":[["3d0d745f.6cadcc"]]},{"id":"20dcad07.a5a60a","type":"change","z":"44c6969d.6be6c","name":"","rules":[{"t":"set","p":"help","pt":"global","to":"help","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":495,"y":277,"wires":[["7f16357b.4d0cdc"]]},{"id":"3d0d745f.6cadcc","type":"change","z":"44c6969d.6be6c","name":"","rules":[{"t":"set","p":"help","pt":"msg","to":"help","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":734,"y":138,"wires":[["4747696d.be2c88"]]},{"id":"7f16357b.4d0cdc","type":"change","z":"44c6969d.6be6c","name":"","rules":[{"t":"set","p":"door","pt":"msg","to":"door","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":724,"y":276,"wires":[["4747696d.be2c88"]]},{"id":"4747696d.be2c88","type":"template","z":"44c6969d.6be6c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"These are the two values in one message: {{door}}&{{help}}","output":"str","x":881.5,"y":206,"wires":[["7d2010bf.72b2e8"]]},{"id":"7d2010bf.72b2e8","type":"debug","z":"44c6969d.6be6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":926.5,"y":350,"wires":[]}]

This only works after you have a value for each, but there are ways around that as well.

Thanks that works great :smiley:

how do I get it now so that there is some distance between the two texts?
with "hspace" it does not work just as well if I insert spaces in between

I have it, with &nbsp; a blank is output

Is there a way to dynamically change the background color of the marquee, for example with the "colour picker"?

I have not gotten it yet.

When I type

`

<marquee scrollamount = "15" scrolldelay = "10" direction = "left" style = "background-color: {{msg.colour}}! Important;">

`
nothing works anymore

Are you trying to use that {{msg.colour}} mustache substitution inside the core template node, or in ui_template? The former supports mustache syntax, but the latter does not...

If you want that substitution to happen inside ui_template, you will have to use an Angular ng-style directive instead, so whenever the msg object changes, its new values are updated in the DOM (somthing like this, untested):

<marquee scrollamount="15" scrolldelay="10" direction="left" ng-style="background-color: {{msg.colour}} !important;">

BTW, your html should not have the extra spaces around the = in your attributes...

That do not work, but thanks for your help :grinning: