Help with getting started with conditionals flow example?

Hello,

I want to build a basic conditional in Node Red to hide or show some buttons that should not be possible to flip during certain conditions. I have searched here but probably using the wrong terms as I have come up short.
I have a decent idea on how to switch and rename the payloads from the three nodes + time condition that I need payloads from but have never done conditionals in Node red.
I suspect this has been done many times and if someone can point me to a starting point example flow I would be very grateful.
The condition/state would probably need to be saved as vars that can be updated one by one at different times, so that when these four criteria are all met, the switch payload is sent.

Below is an unformatted sort of manuscript of what I need.
Grateful for any hints or starting points. Many thanks!

if/ 
DCL is 120A  (msg.payload value "120" from a battery monitor node)

and/ 
CCL is at least 24A  (msg.payload value equal or larger than "24" from other battery monitor node)

and/ 
current watts from solar panels is at least 200W (payload from calculation in function node is equal or larger than "200" for more than 5 minutes)

then/"
{"group":{"show":["Controlpanel_a"]}} //(this bit of code is tested and works)

else/
{"group":{"hide":["Controlpanel_a"]}} //(this bit of code is tested and works)

Buttons run in the context of the client browser and not in the context of your flow.

To build a UI to conditionally show buttons, you need to use something like Dashboard or uibuilder or manually via http-in/-out nodes.

OK so as a newbie in Node Red i would suggest you use as many of the standard nodes as you can rather than write code to start with

So if you want to test an IF - you use a switch node

A switch node can have multiple outputs/tests so in your example

in your switch node you would put in a test for msg.payload to be >= 120 - if this was true you would send the flow off to Output 1 - you then add a 2nd test that has othwerwise as the condition as send that off to output 2

When you come out of the switch node - output 1 i.e. DCL is 120A or greater then have another switch node and test if CCL is >= 24A etc

Now if these numbers are all coming at different times from different sources then - you want to have Change nodes that grab them when they come in, and store them to Context Flow variables

Then in your switch nodes instead of comparing msg.payload you instead compare the flow variables values

How is the information getting into Node Red ? MQTT ?

Craig

Thanks @TotallyInformation !
Sorry, I should have stated clearly that I am pretty far in building a dashboard ui.
The buttons I refer to are buttons on the dashboard and the code at the end is a working hide/show of groups with buttons in the dashboard. That part I am ok with.

Thanks @craigcurtin !

Yes, data is partially MQTT and partially local function nodes.
The application is a LiFePo battery that sends its charge and discharge limits to Node Red
and an inverter that requires certain conditions to be met to be able to start from the battery current at all. It will for example not start when it is below freezing as the battery will have very low DCL and no CCL at all. Attempting to start the inverter during such conditions will cause reboots and shutdowns on both the battery and the inverter with ugly warnings and alarms about voltage and DC ripple. I write this only to clarify that this is a very important function for me and needs to be correct and robust. The wanted end result is essentially just a binary on off switch function that will be updated continuously with some simple delays and filters added to make it reasonably robust and safe to avoid the scenarios described above.

So I have now built a pseudo proof of concept flow that works ok, using standard nodes and have three states coming out at the end of the MQTT nodes flow: dcl ok, ccl ok, pv ok.
I then use a join node that waits for a complete set of the three payloads and will send out a key/object every time a message with all three msg are available.
I then use the simple existence of this this to trigger the show hide with dashboard buttons or function nodes.
This seems to work ok as a starting point but can surely be done more cleverly and cleaner so any suggestions are truly welcome.
I also can not figure out the "PV should be +200Watts for more than 5 minutes" part.
Many thanks for any comments on the working flow below.
Or a completely different and better way to get this done.

[
    {
        "id": "5ccc101040d33606",
        "type": "switch",
        "z": "65d394820e3b16ad",
        "name": "dcl sw",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "120",
                "vt": "str"
            },
            {
                "t": "gt",
                "v": "120",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 950,
        "y": 520,
        "wires": [
            [
                "045f3297fad21750"
            ],
            [
                "1540f1dcb633507d"
            ]
        ]
    },
    {
        "id": "dd96eb5e16a11032",
        "type": "switch",
        "z": "65d394820e3b16ad",
        "name": "ccl sw",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "24",
                "vt": "str"
            },
            {
                "t": "gt",
                "v": "24",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 950,
        "y": 620,
        "wires": [
            [
                "7c73c0079c54793e"
            ],
            [
                "1540f1dcb633507d"
            ]
        ]
    },
    {
        "id": "b629748a2aacb871",
        "type": "switch",
        "z": "65d394820e3b16ad",
        "name": "PV sw",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "50",
                "vt": "str"
            },
            {
                "t": "lt",
                "v": "50",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 950,
        "y": 420,
        "wires": [
            [
                "79b2ac6b0482dce4"
            ],
            [
                "1540f1dcb633507d"
            ]
        ]
    },
    {
        "id": "7c73c0079c54793e",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "CCL ok",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1160,
        "y": 500,
        "wires": [
            [
                "a843891f1108c031"
            ]
        ]
    },
    {
        "id": "045f3297fad21750",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "DCL ok",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1160,
        "y": 460,
        "wires": [
            [
                "a843891f1108c031"
            ]
        ]
    },
    {
        "id": "79b2ac6b0482dce4",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "PV ok",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1160,
        "y": 420,
        "wires": [
            [
                "a843891f1108c031"
            ]
        ]
    },
    {
        "id": "6e59cae67d166a0c",
        "type": "delay",
        "z": "65d394820e3b16ad",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1500,
        "y": 560,
        "wires": [
            [
                "968b874e72fe70cd"
            ]
        ]
    },
    {
        "id": "1540f1dcb633507d",
        "type": "ui_button",
        "z": "65d394820e3b16ad",
        "name": "Hide 220",
        "group": "7fadc6724af7ef60",
        "order": 31,
        "width": 0,
        "height": 0,
        "passthru": true,
        "label": "Hide 220",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"Controlpanel_a\"]}}",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 1500,
        "y": 620,
        "wires": [
            [
                "115623b6e58c5f88"
            ]
        ]
    },
    {
        "id": "968b874e72fe70cd",
        "type": "ui_button",
        "z": "65d394820e3b16ad",
        "name": "Show 220",
        "group": "7fadc6724af7ef60",
        "order": 31,
        "width": 0,
        "height": 0,
        "passthru": true,
        "label": "Show 220",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"show\":[\"Controlpanel_a\"]}}",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 1500,
        "y": 500,
        "wires": [
            [
                "115623b6e58c5f88",
                "a41dd28e2df3ef12"
            ]
        ]
    },
    {
        "id": "115623b6e58c5f88",
        "type": "ui_ui_control",
        "z": "65d394820e3b16ad",
        "name": "Show/Hide Inverter",
        "events": "change",
        "x": 1810,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "a41dd28e2df3ef12",
        "type": "debug",
        "z": "65d394820e3b16ad",
        "name": "Show dummy msg",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1790,
        "y": 500,
        "wires": []
    },
    {
        "id": "a989c8599be34dbd",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1 string OK",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1520,
        "y": 460,
        "wires": [
            [
                "6e59cae67d166a0c"
            ]
        ]
    },
    {
        "id": "ed4e4d482c546946",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "DCL dummy inject 0",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "str",
        "x": 750,
        "y": 500,
        "wires": [
            [
                "5ccc101040d33606"
            ]
        ]
    },
    {
        "id": "2555cee8f4b506db",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "DCL dummy inject 120",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "120",
        "payloadType": "str",
        "x": 760,
        "y": 540,
        "wires": [
            [
                "5ccc101040d33606"
            ]
        ]
    },
    {
        "id": "fcd085ec5fb79872",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "CCL dummy inject 0",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "str",
        "x": 750,
        "y": 600,
        "wires": [
            [
                "dd96eb5e16a11032"
            ]
        ]
    },
    {
        "id": "fa645896b89d317c",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "CCL dummy inject 120",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "120",
        "payloadType": "str",
        "x": 760,
        "y": 640,
        "wires": [
            [
                "dd96eb5e16a11032"
            ]
        ]
    },
    {
        "id": "61b9cd72411ce90a",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "PV dummy inject 0",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "str",
        "x": 750,
        "y": 440,
        "wires": [
            [
                "b629748a2aacb871"
            ]
        ]
    },
    {
        "id": "fceb82466c6719df",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "PV dummy inject 350",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "350",
        "payloadType": "str",
        "x": 760,
        "y": 400,
        "wires": [
            [
                "b629748a2aacb871"
            ]
        ]
    },
    {
        "id": "a843891f1108c031",
        "type": "join",
        "z": "65d394820e3b16ad",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "3",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 1350,
        "y": 460,
        "wires": [
            [
                "a989c8599be34dbd"
            ]
        ]
    },
    {
        "id": "7fadc6724af7ef60",
        "type": "ui_group",
        "name": "Dev1",
        "tab": "b90d70f.039aa9",
        "order": 8,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "b90d70f.039aa9",
        "type": "ui_tab",
        "name": "Status",
        "icon": "dashboard",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

OK that looks pretty good - you need to decide though if you are using the join node - what happens if a message does not arrive from one of the incoming streams ?? I went away from using Join nodes and instead went to Flow context variables for this reason in my battery/solar setup

In terms of tracking your PV above a certain threshold you have a couple of choices and things to think about

What period are you going to average each reading over ? i.e. is it if PV is ALWAYS above X for (say) 5 minutes - and if so how often are you measuring that ?

Or is it if Average PV is above X for (say) 5 minutes ?

In my case when switching loads etc i use a rolling 5 minute average and sample every 10 seconds - you can use the smooth node for this

Craig

Hello and thanks @craigcurtin
In this case, the fact that a message is not sent unless it has all parts is actually what I want, as I am using the presence of each complete joined key object as the trigger for the switch. I am however curious about your use of Flow context. Any chance of an example?
What you use for switching loads seems like something similar to what I need but I think I need PV (not average) is never under 200W (stable charge) for m minutes rolling, sample every 10 secs is probably good. Any chance of an example for that also?
Many thanks!

Just an updated version that appears more robust, using a properly configured msg.parts property. fwiw. Appears to work quite well, although only tested for few hours so far.

[
    {
        "id": "5ccc101040d33606",
        "type": "switch",
        "z": "65d394820e3b16ad",
        "name": "dcl sw",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "120",
                "vt": "str"
            },
            {
                "t": "gt",
                "v": "120",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 950,
        "y": 520,
        "wires": [
            [
                "e71733ae6b36b022"
            ],
            [
                "1540f1dcb633507d"
            ]
        ]
    },
    {
        "id": "dd96eb5e16a11032",
        "type": "switch",
        "z": "65d394820e3b16ad",
        "name": "ccl sw",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "lte",
                "v": "24",
                "vt": "str"
            },
            {
                "t": "gt",
                "v": "24",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 950,
        "y": 620,
        "wires": [
            [
                "ee28b22f78c32bec"
            ],
            [
                "1540f1dcb633507d"
            ]
        ]
    },
    {
        "id": "b629748a2aacb871",
        "type": "switch",
        "z": "65d394820e3b16ad",
        "name": "PV sw",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "50",
                "vt": "str"
            },
            {
                "t": "lt",
                "v": "50",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 950,
        "y": 420,
        "wires": [
            [
                "5949ed3af4e28553"
            ],
            [
                "1540f1dcb633507d"
            ]
        ]
    },
    {
        "id": "6e59cae67d166a0c",
        "type": "delay",
        "z": "65d394820e3b16ad",
        "name": "",
        "pauseType": "delay",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "allowrate": false,
        "outputs": 1,
        "x": 1500,
        "y": 560,
        "wires": [
            [
                "968b874e72fe70cd"
            ]
        ]
    },
    {
        "id": "1540f1dcb633507d",
        "type": "ui_button",
        "z": "65d394820e3b16ad",
        "name": "Hide 220",
        "group": "7fadc6724af7ef60",
        "order": 31,
        "width": 0,
        "height": 0,
        "passthru": true,
        "label": "Hide 220",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"hide\":[\"Controlpanel_a\"]}}",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 1500,
        "y": 620,
        "wires": [
            [
                "115623b6e58c5f88"
            ]
        ]
    },
    {
        "id": "968b874e72fe70cd",
        "type": "ui_button",
        "z": "65d394820e3b16ad",
        "name": "Show 220",
        "group": "7fadc6724af7ef60",
        "order": 31,
        "width": 0,
        "height": 0,
        "passthru": true,
        "label": "Show 220",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "{\"group\":{\"show\":[\"Controlpanel_a\"]}}",
        "payloadType": "json",
        "topic": "topic",
        "topicType": "msg",
        "x": 1500,
        "y": 500,
        "wires": [
            [
                "115623b6e58c5f88",
                "a41dd28e2df3ef12"
            ]
        ]
    },
    {
        "id": "115623b6e58c5f88",
        "type": "ui_ui_control",
        "z": "65d394820e3b16ad",
        "name": "Show/Hide Inverter",
        "events": "change",
        "x": 1810,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "a41dd28e2df3ef12",
        "type": "debug",
        "z": "65d394820e3b16ad",
        "name": "Show dummy msg",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1790,
        "y": 500,
        "wires": []
    },
    {
        "id": "a989c8599be34dbd",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1 string OK",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1520,
        "y": 460,
        "wires": [
            [
                "6e59cae67d166a0c"
            ]
        ]
    },
    {
        "id": "ed4e4d482c546946",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "DCL dummy inject 0",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "str",
        "x": 750,
        "y": 500,
        "wires": [
            [
                "5ccc101040d33606"
            ]
        ]
    },
    {
        "id": "2555cee8f4b506db",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "DCL dummy inject 120",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "120",
        "payloadType": "str",
        "x": 760,
        "y": 540,
        "wires": [
            [
                "5ccc101040d33606"
            ]
        ]
    },
    {
        "id": "fcd085ec5fb79872",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "CCL dummy inject 0",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "str",
        "x": 750,
        "y": 600,
        "wires": [
            [
                "dd96eb5e16a11032"
            ]
        ]
    },
    {
        "id": "fa645896b89d317c",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "CCL dummy inject 120",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "120",
        "payloadType": "str",
        "x": 760,
        "y": 640,
        "wires": [
            [
                "dd96eb5e16a11032"
            ]
        ]
    },
    {
        "id": "61b9cd72411ce90a",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "PV dummy inject 0",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "str",
        "x": 750,
        "y": 440,
        "wires": [
            [
                "b629748a2aacb871"
            ]
        ]
    },
    {
        "id": "fceb82466c6719df",
        "type": "inject",
        "z": "65d394820e3b16ad",
        "name": "PV dummy inject 350",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "350",
        "payloadType": "str",
        "x": 760,
        "y": 400,
        "wires": [
            [
                "b629748a2aacb871"
            ]
        ]
    },
    {
        "id": "a843891f1108c031",
        "type": "join",
        "z": "65d394820e3b16ad",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "3",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 1350,
        "y": 460,
        "wires": [
            [
                "a989c8599be34dbd"
            ]
        ]
    },
    {
        "id": "e71733ae6b36b022",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "parts.index = 1",
        "rules": [
            {
                "t": "set",
                "p": "parts.index",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1140,
        "y": 380,
        "wires": [
            [
                "cb8e5b0e9f742e5e"
            ]
        ]
    },
    {
        "id": "5949ed3af4e28553",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "parts.index = 0",
        "rules": [
            {
                "t": "set",
                "p": "parts.index",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1140,
        "y": 340,
        "wires": [
            [
                "cb8e5b0e9f742e5e"
            ]
        ]
    },
    {
        "id": "ee28b22f78c32bec",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "parts.index = 2",
        "rules": [
            {
                "t": "set",
                "p": "parts.index",
                "pt": "msg",
                "to": "2",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1140,
        "y": 420,
        "wires": [
            [
                "cb8e5b0e9f742e5e"
            ]
        ]
    },
    {
        "id": "cb8e5b0e9f742e5e",
        "type": "change",
        "z": "65d394820e3b16ad",
        "name": "group id and count",
        "rules": [
            {
                "t": "set",
                "p": "parts.id",
                "pt": "msg",
                "to": "mygroup",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "parts.count",
                "pt": "msg",
                "to": "3",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1330,
        "y": 380,
        "wires": [
            [
                "a843891f1108c031"
            ]
        ]
    },
    {
        "id": "7fadc6724af7ef60",
        "type": "ui_group",
        "name": "Dev1",
        "tab": "4f2061e9.b781c8",
        "order": 8,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "4f2061e9.b781c8",
        "type": "ui_tab",
        "name": "dev2",
        "icon": "dashboard",
        "order": 4,
        "disabled": false,
        "hidden": true
    }
]

This works as long as the battery is charging from solar and has a SOC that is not 100%,
but after some more tests I realise I am missing the capability to see what PV is available when the battery is at 100% SOC. Not sure how to proceed and what data to use for that...
I guess I will have to look at the sky :wink: But the bad part is that I can not safely start the battery remote, which is something I need to do. Doing some more thinking..

Hello @craigcurtin
Just wanted to say thanks for pointing me in the direction of context flows.
I now get your point for many reasons and especially for things like having one variable decide the output of another flow. Very useful. Many thanks!

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.