Updating i2c LCD with On or off on Node Red

Hi there,

I am using the node LCD20x4-I2C, to create a status of what relay is on, from Node Red.

Essentially how it goes is: Sensor > Logic > Relay 1 > Relay 2 > Switch Node > Send Status > ? > LCD Updated with Status "on or off"

I need help with the question mark, because I dont know how to make it update lcd.

I can make a json and have it print whatever text that I have thats static, but I cannot figure out how to make it change to "On" or "off, when a relay switches on or off, and then update the text on the display.

Below is the static text that I have on that's displayed on the switch.

Any help would be appreciated

Thanks

{
    "msgs": [
        {
            "msg": " Switch "
        },
        {
            "msg": " Relay Status"
        },
        {
            "msg": " On, Off"
        }
    ]
}

Hi,

I am also currently working with a 4x20 I2C LCD display.
I'm not a professional, I would like to introduce my findings.
The thing works for the variable display in one line.
The display of static text in the other lines is also possible.
The problem still exists in the variable display in all lines.
Currently, the first line displays the contents of the msg.payload (must always be a string).
Well, I'm not getting any further.

How can I address a specific string from the payload?
I do not know the syntax for that, e.g. msg.payload: string [10]
Unfortunately this is not possible.

Or another variant. Combine the "switches" over the "join node". It arrives at a total string with all information at the function node. Now the desired value must be filtered.
The command must be entered in the function node in the appropriate line (e.g., line 2 = sString02)
As the syntax for it I know but not synonymous.

Maybe someone else has a good idea.
Try my flow, then maybe you know what I mean.

P.S. The function node only accepts one input. Have tried several payloads at the input to turn on, that's not possible.

Many thanks
Thoralf

[{"id":"572809d4.7333a","type":"inject","z":"70d56966.82e198","name":"","topic":"","payload":"Relay 2 ON","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":257,"y":201,"wires":[["b6843e78.c481c","66b361b9.8ffb28"]]},{"id":"b6843e78.c481c","type":"function","z":"70d56966.82e198","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.payload;\nvar sString02 = \"Exemple\";\nvar sString03 = \"Hallo\";\nvar sString04 = \"Good Morning\";\nvar iPos01 = 1;\nvar iPos02 = 2;\nvar iPos03 = 3;\nvar iPos04 = 4;\nvar bCenter01 = true;\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,"x":500,"y":164,"wires":[["2d61168.d89c1ea"]]},{"id":"2d61168.d89c1ea","type":"LCD20x4-I2C","z":"70d56966.82e198","name":"","speed":"3","size":"20x4","address":"0x27","x":795,"y":165,"wires":[]},{"id":"75d009fd.e80ee","type":"inject","z":"70d56966.82e198","name":"","topic":"","payload":"Relay 1 OFF","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":253,"y":126,"wires":[["b6843e78.c481c","66b361b9.8ffb28"]]},{"id":"66b361b9.8ffb28","type":"debug","z":"70d56966.82e198","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":521,"y":61,"wires":[]}]