Node-red-contrib-lcd20x4-i2c Example Prob

Hi,
I currently use a LCD Dispaly 4x20 I2C.
I loaded the driver and a sample flow. The thing actually works.
Now I want to display several data from a BME280 (temperature, humidity, etc.) (per line). The problem arises when I control the funtions flow with 3 different payloads. One alone works without problems.
Does anyone have a hint for me?

Many thanks

Thoralf

// Line Number  Msg String      Start Position  Centered
// 1            Date/Time       Ignored         true
// 2            "Test line 2."  2               false
// 3            "Test line 3."  3               false
// 4            "Test line 4."  4               false

//var sString01 = "Test line 1.";
var sString01 = msg.payload.Zeile1;
var sString02 = msg.payload.Zeile2;
var sString03 = msg.payload.Zeile3;
var sString04 = "Test line 4.";
var iPos01 = 1;
var iPos02 = 2;
var iPos03 = 3;
var iPos04 = 4;
var bCenter01 = true;
var bCenter02 = false;
var bCenter03 = false;
var bCenter04 = false;

msg.payload = {
	msgs:[
		{
			msg:sString01,
			pos:iPos01,
			center:bCenter01
		},
		{
			msg:sString02,
			pos:iPos02,
			center:bCenter02
		},
		{
			msg:sString03,
			pos:iPos03,
			center:bCenter03
		},
		{
			msg:sString04,
			pos:iPos04,
			center:bCenter04
		}
	]
};

return msg;

I wondered the same thing and worked it out as below. May not be the most elegant but it works. This is what I am using with OpenWeathermap.org as a small weather forecast screen. The "moment" node expects milliseconds where as OWM outputs "seconds" hence the conversion node for sunset. Hope the helps someone, took me a while to figure out :slight_smile:

[{"id":"85f380c9.e053d8","type":"LCD20x4-I2C","z":"f7ec13e8.052da","name":"LCD2004","speed":"3","size":"20x4","address":"0x27","x":775,"y":103,"wires":[]},{"id":"a98430c6.88ced","type":"function","z":"f7ec13e8.052da","name":"Message","func":"// Line Number  Msg String      Start Position  Centered\n// 1            Date/Time       Ignored         true\n// 2            \"Test line 2.\"  2               false\n// 3            \"Test line 3.\"  3               false\n// 4            \"Test line 4.\"  4               false\n\n//var sString01 = \"Test line 1.\";\nvar sString01 = msg.payload1;\nvar sString02 = msg.payload2;\nvar sString03 = msg.payload3;\nvar sString04 = msg.payload4;\nvar iPos01 = 1;\nvar iPos02 = 1;\nvar iPos03 = 1;\nvar iPos04 = 1;\nvar bCenter01 = false;\nvar bCenter02 = false;\nvar bCenter03 = false;\nvar bCenter04 = false;\n\nmsg.payload = {\n\tmsgs:[\n\t\t{\n\t\t\tmsg:sString01,\n\t\t\tpos:iPos01,\n\t\t\tcenter:bCenter01\n\t\t},\n\t\t{\n\t\t\tmsg:sString02,\n\t\t\tpos:iPos02,\n\t\t\tcenter:bCenter02\n\t\t},\n\t\t{\n\t\t\tmsg:sString03,\n\t\t\tpos:iPos03,\n\t\t\tcenter:bCenter03\n\t\t},\n\t\t{\n\t\t\tmsg:sString04,\n\t\t\tpos:iPos04,\n\t\t\tcenter:bCenter04\n\t\t}\n\t]\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":615,"y":103,"wires":[["85f380c9.e053d8"]]},{"id":"8787a85d.339ae","type":"inject","z":"f7ec13e8.052da","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":115,"y":103,"wires":[["7bf13a26.c9e3dc"]]},{"id":"7bf13a26.c9e3dc","type":"moment","z":"f7ec13e8.052da","name":"Clock","topic":"","input":"payload","inputType":"msg","inTz":"Australia/Melbourne","adjAmount":0,"adjType":"days","adjDir":"add","format":"ddd DD-MM HH:mm:ss","locale":"en_US","output":"payload","outputType":"msg","outTz":"Australia/Melbourne","x":270,"y":100,"wires":[["ce4981d9.5db538"]]},{"id":"ce4981d9.5db538","type":"change","z":"f7ec13e8.052da","name":"","rules":[{"t":"set","p":"payload1","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"payload2","pt":"msg","to":"payloadtempminc","tot":"flow"},{"t":"set","p":"payload3","pt":"msg","to":"payloadtempc","tot":"flow"},{"t":"set","p":"payload4","pt":"msg","to":"payloaddetail","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":455,"y":103,"wires":[["a98430c6.88ced"]]},{"id":"5f430fb8.9228b","type":"openweathermap in","z":"f7ec13e8.052da","name":"my city","wtype":"current","lon":"","lat":"","city":"mycity","country":"Australia","language":"en","x":55,"y":183,"wires":[["e3979798.7065a","1c44c37d.6e1415","5ef3b14f.d61b3","8e51c6b3.55a28"]]},{"id":"5ef3b14f.d61b3","type":"change","z":"f7ec13e8.052da","name":"Line 4","rules":[{"t":"set","p":"payload.ss","pt":"msg","to":"sunset","tot":"flow"},{"t":"set","p":"payload","pt":"msg","to":"msg.payload.detail & \" SS:\" & msg.payload.ss","tot":"jsonata"},{"t":"move","p":"payload","pt":"msg","to":"payloaddetail","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":215,"y":243,"wires":[[]]},{"id":"e3979798.7065a","type":"change","z":"f7ec13e8.052da","name":"Line 3","rules":[{"t":"set","p":"payload.tempc","pt":"msg","to":"$string(\"Now:\" & msg.payload.tempc & \" Wind:\" & msg.payload.windspeed)","tot":"jsonata"},{"t":"set","p":"payloadtempc","pt":"flow","to":"payload.tempc","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":215,"y":203,"wires":[[]]},{"id":"1c44c37d.6e1415","type":"change","z":"f7ec13e8.052da","name":"Line 2","rules":[{"t":"set","p":"payload.temp_minc","pt":"msg","to":"$string(\"Min:\" & msg.payload.temp_minc & \" Max:\" & msg.payload.temp_maxc)","tot":"jsonata"},{"t":"set","p":"payloadtempminc","pt":"flow","to":"payload.temp_minc","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":215,"y":163,"wires":[[]]},{"id":"68317a58.eee4fc","type":"moment","z":"f7ec13e8.052da","name":"AU Time","topic":"","input":"payload","inputType":"msg","inTz":"ETC/utc","adjAmount":0,"adjType":"days","adjDir":"add","format":"hh:mm","locale":"en_US","output":"sunset","outputType":"flow","outTz":"Australia/Melbourne","x":300,"y":300,"wires":[[]]},{"id":"8e51c6b3.55a28","type":"change","z":"f7ec13e8.052da","name":"secs 2 mill","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.sunset","tot":"msg"},{"t":"set","p":"payload","pt":"msg","to":"(msg.payload)*1000","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":135,"y":283,"wires":[["68317a58.eee4fc"]]}]