gablau / node-red-contrib-blynk-ws

Old/Legacy Blynk library implementation for Node-RED using WebSockets
MIT License
31 stars 10 forks source link

LCD widget not working. #8

Closed mayankraichura closed 6 years ago

mayankraichura commented 6 years ago

I have an LCD widget that I'm setting via V10. In NodeRed, I'm sending values via function node as follows

return {
    text1: msg.payload.svalue1,
    text:"Motor",
    clear: true
}

and here is the debug output

{
    "text1": "Not Empty",
    "text": "Motor",
    "clear": true,
    "_msgid": "9d522536.c9d2e8"
}

However, LCD is not updated. Can you please confirm this?

gablau commented 6 years ago

Not right!! You must send a msg object

msg.clear = true
msg.text = "Hello"
msg.y=0 //optional
msg.x=5 //optional

msg.text1 = "World"
msg.y1=1 //optional
msg.x1=6 //optional
return msg;

some example flow:

[
    {
        "id": "3ba01d58.b6863a",
        "type": "blynk-ws-out-lcd",
        "z": "ce0cd7ca.88c938",
        "name": "",
        "pin": "101",
        "client": "fed2782c.e896d8",
        "x": 1236,
        "y": 158,
        "wires": []
    },
    {
        "id": "bffe611.8f6f92",
        "type": "function",
        "z": "ce0cd7ca.88c938",
        "name": "clear and print ",
        "func": "msg.clear = true\nmsg.text = \"Hello\"\nmsg.y=0\nmsg.x=5\n\nmsg.text1 = \"World\"\nmsg.y1=1\nmsg.x1=6\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 1016,
        "y": 200,
        "wires": [
            [
                "3ba01d58.b6863a",
                "cd6b1be9.1a4d78"
            ]
        ]
    },
    {
        "id": "3c568ad4.0511fe",
        "type": "inject",
        "z": "ce0cd7ca.88c938",
        "name": "inject",
        "topic": "",
        "payload": "255",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 861,
        "y": 200,
        "wires": [
            [
                "bffe611.8f6f92"
            ]
        ]
    },
    {
        "id": "3893939f.b921a4",
        "type": "function",
        "z": "ce0cd7ca.88c938",
        "name": "clear",
        "func": "msg.clear = true\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 987,
        "y": 157,
        "wires": [
            [
                "3ba01d58.b6863a",
                "cd6b1be9.1a4d78"
            ]
        ]
    },
    {
        "id": "e41abe4c.4f8ca",
        "type": "inject",
        "z": "ce0cd7ca.88c938",
        "name": "inject",
        "topic": "",
        "payload": "255",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 862,
        "y": 157,
        "wires": [
            [
                "3893939f.b921a4"
            ]
        ]
    },
    {
        "id": "da5240e1.aad718",
        "type": "function",
        "z": "ce0cd7ca.88c938",
        "name": "print simple",
        "func": "msg.text = \"Test print\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 1009,
        "y": 112,
        "wires": [
            [
                "3ba01d58.b6863a",
                "cd6b1be9.1a4d78"
            ]
        ]
    },
    {
        "id": "dba28a4b.18a6a8",
        "type": "inject",
        "z": "ce0cd7ca.88c938",
        "name": "inject",
        "topic": "",
        "payload": "255",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 864,
        "y": 112,
        "wires": [
            [
                "da5240e1.aad718"
            ]
        ]
    },
    {
        "id": "cd6b1be9.1a4d78",
        "type": "debug",
        "z": "ce0cd7ca.88c938",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "true",
        "x": 1237,
        "y": 211,
        "wires": []
    },
    {
        "id": "fed2782c.e896d8",
        "type": "blynk-ws-client",
        "z": "",
        "name": "Blynk Cloud",
        "path": "wss://blynk-cloud.com/websockets",
        "key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "dbg_all": false,
        "dbg_read": false,
        "dbg_write": false,
        "dbg_notify": false,
        "dbg_mail": false,
        "dbg_prop": false,
        "dbg_sync": false,
        "dbg_bridge": false,
        "dbg_low": false,
        "dbg_pins": "",
        "multi_cmd": true,
        "proxy_type": "no",
        "proxy_url": ""
    }
]
mayankraichura commented 6 years ago

Thanks. That worked!!! I thought returning a new object would create a new msg object (from the _msgid being automatically assigned to that object). However, I am wrong here, I guess. Thanks anyway.