Start a new topic

NodeRed flows & nodes

I use NodeRed and Aedes for automation and MQTT with OEVSE (and other things).
It's fairly basic but gives flexibility and a simple dashboard for our most common needs.



image


Unfortunately in my ignorance I started out using RAPI via MQTT for some of the control. Now RAPI is going to be removed I thought I'd better start figuring how to move it to HTTP.
That's giving me a certain amount of grief as I try to work out the basic structure needed!

It would be a great help to me and possibly others to have some clear guidance around best practice for setting up OEVSE Flows. eg when to use MQTT, when to use HTTP, when to use Websockets? Some clear templates for setting these things up in NodeRed.
Straight forward examples of the exact settings to put in the different parts of the relevant Nodes.


Right now I could really do with some help how to setup something that takes my Time & kWh limits and sends them to the OEVSE.


Any takers?

1 Comment

I've spent some time migrating my NodeRed Limits settings to http.
It's far from "best practice", but maybe it's helpful to someone.


image



The NodeRed flow JSON is below.
I haven't decided how to GET the current state from the charger in order to update the dashboard with any changes made directly through the charger interface. I could poll it every few seconds, but that seems wasteful for the few times a month that it's needed. So the nodes before the sliders only trigger manually as it sits. You could change the Inject node to fire every X seconds.
It's also a bit clunky the way I've got that section to set the two sliders. Only one override can be in place (Time or Energy) at a time.

 

[
    {
        "id": "ae08c8597ae3d2ed",
        "type": "comment",
        "z": "37b0e2f69197c662",
        "name": "UI Set limits",
        "info": "",
        "x": 90,
        "y": 1200,
        "wires": []
    },
    {
        "id": "d23deae27a111f26",
        "type": "ui_slider",
        "z": "37b0e2f69197c662",
        "name": "EVSE KwH Out",
        "label": "KwH to Charge",
        "tooltip": "",
        "group": "2755f071f0df73ca",
        "order": 5,
        "width": 0,
        "height": 0,
        "passthru": false,
        "outs": "end",
        "topic": "topic",
        "topicType": "msg",
        "min": "0",
        "max": "60",
        "step": "1",
        "className": "",
        "x": 1020,
        "y": 1260,
        "wires": [
            [
                "bb8f74ea2bf3a7d1"
            ]
        ]
    },
    {
        "id": "2dac2fd59ebfd3a3",
        "type": "ui_slider",
        "z": "37b0e2f69197c662",
        "name": "EVSE Time Limit",
        "label": "Timer (Minute)",
        "tooltip": "",
        "group": "2755f071f0df73ca",
        "order": 6,
        "width": 0,
        "height": 0,
        "passthru": false,
        "outs": "end",
        "topic": "topic",
        "topicType": "msg",
        "min": 0,
        "max": "180",
        "step": "15",
        "className": "",
        "x": 1030,
        "y": 1460,
        "wires": [
            [
                "94a0e87b8e198e04"
            ]
        ]
    },
    {
        "id": "0b6d5a4e8942cf1f",
        "type": "http request",
        "z": "37b0e2f69197c662",
        "name": "http limit set",
        "method": "use",
        "ret": "obj",
        "paytoqs": "query",
        "url": "http://192.168.1.8/limit/set",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 390,
        "y": 1680,
        "wires": [
            []
        ]
    },
    {
        "id": "811013c3c3fc0529",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "Build JSON",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\t  \"type\": msg.type,\t  \"value\": msg.payload,\t  \"auto_release\": true\t}",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 210,
        "y": 1680,
        "wires": [
            [
                "0b6d5a4e8942cf1f"
            ]
        ]
    },
    {
        "id": "94a0e87b8e198e04",
        "type": "switch",
        "z": "37b0e2f69197c662",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1230,
        "y": 1460,
        "wires": [
            [
                "c65091cd4a0490dc"
            ],
            [
                "d401918c833d7afb"
            ]
        ]
    },
    {
        "id": "40ccd87774a91670",
        "type": "switch",
        "z": "37b0e2f69197c662",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1330,
        "y": 1260,
        "wires": [
            [
                "262b8765f0cec64b"
            ],
            [
                "32e682925c6f8fa3"
            ]
        ]
    },
    {
        "id": "c509c2ee62463988",
        "type": "link in",
        "z": "37b0e2f69197c662",
        "name": "OEVSE Limits",
        "links": [
            "6795831b22586bfe",
            "aacd43c720249627"
        ],
        "x": 75,
        "y": 1680,
        "wires": [
            [
                "811013c3c3fc0529"
            ]
        ]
    },
    {
        "id": "bb8f74ea2bf3a7d1",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "to Kwh",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number(payload)*1000\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1170,
        "y": 1260,
        "wires": [
            [
                "40ccd87774a91670"
            ]
        ]
    },
    {
        "id": "3bc84e24c31dbd7e",
        "type": "http request",
        "z": "37b0e2f69197c662",
        "name": "",
        "method": "GET",
        "ret": "obj",
        "paytoqs": "ignore",
        "url": "http://192.168.1.8/limit",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "senderr": false,
        "x": 310,
        "y": 1360,
        "wires": [
            [
                "2e54e42b2de8d900",
                "c6bb41d9570b2be7"
            ]
        ]
    },
    {
        "id": "ac87625bfd0bf6df",
        "type": "inject",
        "z": "37b0e2f69197c662",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "2",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 110,
        "y": 1360,
        "wires": [
            [
                "3bc84e24c31dbd7e"
            ]
        ]
    },
    {
        "id": "2e54e42b2de8d900",
        "type": "switch",
        "z": "37b0e2f69197c662",
        "name": "",
        "property": "payload.type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "energy",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "time",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 470,
        "y": 1320,
        "wires": [
            [
                "22f33905e6b288a8",
                "da629e76bfb95645"
            ],
            [
                "34f6a6e0ca376534",
                "3c464c1d513e4d43"
            ]
        ]
    },
    {
        "id": "22f33905e6b288a8",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "Set Kwh",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$number(msg.payload.value)/1000",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "type",
                "pt": "msg",
                "to": "energy",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "timer",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 740,
        "y": 1280,
        "wires": [
            [
                "d23deae27a111f26"
            ]
        ]
    },
    {
        "id": "da629e76bfb95645",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "Set 0",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 730,
        "y": 1320,
        "wires": [
            [
                "2dac2fd59ebfd3a3"
            ]
        ]
    },
    {
        "id": "34f6a6e0ca376534",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "Set 0",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 730,
        "y": 1440,
        "wires": [
            [
                "d23deae27a111f26"
            ]
        ]
    },
    {
        "id": "3c464c1d513e4d43",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "Set to Timer",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "msg.payload.value",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 750,
        "y": 1400,
        "wires": [
            [
                "2dac2fd59ebfd3a3"
            ]
        ]
    },
    {
        "id": "c6bb41d9570b2be7",
        "type": "switch",
        "z": "37b0e2f69197c662",
        "name": "",
        "property": "payload.msg",
        "propertyType": "jsonata",
        "rules": [
            {
                "t": "eq",
                "v": "no limit",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 470,
        "y": 1400,
        "wires": [
            [
                "34f6a6e0ca376534",
                "da629e76bfb95645"
            ]
        ]
    },
    {
        "id": "a59d1eecaa404c5c",
        "type": "comment",
        "z": "37b0e2f69197c662",
        "name": "Limit Setter",
        "info": "",
        "x": 110,
        "y": 1580,
        "wires": []
    },
    {
        "id": "6795831b22586bfe",
        "type": "link out",
        "z": "37b0e2f69197c662",
        "name": "",
        "mode": "link",
        "links": [
            "c509c2ee62463988"
        ],
        "x": 1715,
        "y": 1440,
        "wires": []
    },
    {
        "id": "c65091cd4a0490dc",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "DELETE",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "type",
                "pt": "msg",
                "to": "time",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1560,
        "y": 1420,
        "wires": [
            [
                "6795831b22586bfe"
            ]
        ]
    },
    {
        "id": "d401918c833d7afb",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "POST",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "type",
                "pt": "msg",
                "to": "time",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1560,
        "y": 1480,
        "wires": [
            [
                "6795831b22586bfe"
            ]
        ]
    },
    {
        "id": "262b8765f0cec64b",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "DELETE",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "type",
                "pt": "msg",
                "to": "energy",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1560,
        "y": 1220,
        "wires": [
            [
                "aacd43c720249627"
            ]
        ]
    },
    {
        "id": "32e682925c6f8fa3",
        "type": "change",
        "z": "37b0e2f69197c662",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "POST",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "type",
                "pt": "msg",
                "to": "energy",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1560,
        "y": 1280,
        "wires": [
            [
                "aacd43c720249627"
            ]
        ]
    },
    {
        "id": "aacd43c720249627",
        "type": "link out",
        "z": "37b0e2f69197c662",
        "name": "",
        "mode": "link",
        "links": [
            "c509c2ee62463988"
        ],
        "x": 1715,
        "y": 1260,
        "wires": []
    },
    {
        "id": "2755f071f0df73ca",
        "type": "ui_group",
        "name": "Car Charger",
        "tab": "1deaf5eb.7ef4ca",
        "order": 2,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "1deaf5eb.7ef4ca",
        "type": "ui_tab",
        "name": "Main Dashboard",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]

 

Login or Signup to post a comment