[
    {
        "id": "172866a9820f49e3",
        "type": "tab",
        "label": "controller_calibration_charge",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "58aeeaac02a3a4c7",
        "type": "tab",
        "label": "Innovenergy Controller",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "449f3115316b1767",
        "type": "tab",
        "label": "parse_warnings_and_alarms",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "9744d7fd57e81fe3",
        "type": "tab",
        "label": "Node Red Dashboard",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "victron-client-id",
        "type": "victron-client",
        "showValues": true,
        "contextStore": true
    },
    {
        "id": "e177392401620838",
        "type": "ui_group",
        "name": "Controller and Battery Info",
        "tab": "157862d37ae585b5",
        "order": 2,
        "disp": true,
        "width": "13",
        "collapse": false,
        "className": ""
    },
    {
        "id": "157862d37ae585b5",
        "type": "ui_tab",
        "name": "Home",
        "icon": "check",
        "disabled": false,
        "hidden": false
    },
    {
        "id": "e0e675d533a148b7",
        "type": "ui_base",
        "theme": {
            "name": "theme-light",
            "lightTheme": {
                "default": "#0094CE",
                "baseColor": "#0094CE",
                "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
                "edited": true,
                "reset": false
            },
            "darkTheme": {
                "default": "#097479",
                "baseColor": "#097479",
                "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
                "edited": false
            },
            "customTheme": {
                "name": "Untitled Theme 1",
                "default": "#4B7930",
                "baseColor": "#4B7930",
                "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
                "reset": false
            },
            "themeState": {
                "base-color": {
                    "default": "#0094CE",
                    "value": "#0094CE",
                    "edited": false
                },
                "page-titlebar-backgroundColor": {
                    "value": "#0094CE",
                    "edited": false
                },
                "page-backgroundColor": {
                    "value": "#fafafa",
                    "edited": false
                },
                "page-sidebar-backgroundColor": {
                    "value": "#ffffff",
                    "edited": false
                },
                "group-textColor": {
                    "value": "#1bbfff",
                    "edited": false
                },
                "group-borderColor": {
                    "value": "#ffffff",
                    "edited": false
                },
                "group-backgroundColor": {
                    "value": "#ffffff",
                    "edited": false
                },
                "widget-textColor": {
                    "value": "#111111",
                    "edited": false
                },
                "widget-backgroundColor": {
                    "value": "#0094ce",
                    "edited": false
                },
                "widget-borderColor": {
                    "value": "#ffffff",
                    "edited": false
                },
                "base-font": {
                    "value": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"
                }
            },
            "angularTheme": {
                "primary": "indigo",
                "accents": "blue",
                "warn": "red",
                "background": "grey",
                "palette": "light"
            }
        },
        "site": {
            "name": "Node-RED Dashboard",
            "hideToolbar": "false",
            "allowSwipe": "false",
            "lockMenu": "false",
            "allowTempTheme": "true",
            "dateFormat": "DD/MM/YYYY",
            "sizes": {
                "sx": 48,
                "sy": 48,
                "gx": 6,
                "gy": 6,
                "cx": 6,
                "cy": 6,
                "px": 0,
                "py": 0
            }
        }
    },
    {
        "id": "3290bd5996bd3175",
        "type": "ui_group",
        "name": "Easy Input",
        "tab": "157862d37ae585b5",
        "order": 3,
        "disp": true,
        "width": 13,
        "collapse": false,
        "className": ""
    },
    {
        "id": "d610b26df84f336e",
        "type": "ui_group",
        "name": "Calibration Charge",
        "tab": "157862d37ae585b5",
        "order": 1,
        "disp": true,
        "width": "13",
        "collapse": false,
        "className": ""
    },
    {
        "id": "0a24f718e758d2a9",
        "type": "ui_switch",
        "z": "172866a9820f49e3",
        "name": "Start Calibration Charge Now",
        "label": "Start Calibration Charge Now",
        "tooltip": "",
        "group": "d610b26df84f336e",
        "order": 5,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "#:(file)::start_calibration_charge_now_button",
        "topicType": "global",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 2440,
        "y": 100,
        "wires": [
            [
                "51c9f1ddaeb25f25",
                "e41f78fc126646c2"
            ]
        ]
    },
    {
        "id": "51c9f1ddaeb25f25",
        "type": "switch",
        "z": "172866a9820f49e3",
        "name": "Button is on",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 2670,
        "y": 100,
        "wires": [
            [
                "e78b1ea309a603a6"
            ]
        ]
    },
    {
        "id": "f020fbc3bd8d0451",
        "type": "switch",
        "z": "172866a9820f49e3",
        "name": "Need to do calibration charge or not",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 1620,
        "y": 240,
        "wires": [
            [
                "68751648fdf25a8c",
                "4b29ed333812c24a",
                "92c2d1b3e084decd",
                "1c9f62ea01d98941"
            ],
            [
                "9f12c0b1b50b4ce1",
                "652a29107ef4c403"
            ],
            [
                "26b43f1b059c7c77",
                "281c467e3b39527d"
            ]
        ]
    },
    {
        "id": "f43f9fdbb0ed174c",
        "type": "ui_text",
        "z": "172866a9820f49e3",
        "group": "d610b26df84f336e",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "Time To Calibration Charge",
        "label": "Time To Calibration Charge",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 3360,
        "y": 420,
        "wires": []
    },
    {
        "id": "fa6c2442f6246ea7",
        "type": "ui_text_input",
        "z": "172866a9820f49e3",
        "name": "Calibration Charge Start Time (hh:mm)",
        "label": "Calibration Charge Start Time (hh:mm:ss.sss)",
        "tooltip": "",
        "group": "d610b26df84f336e",
        "order": 4,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "time",
        "delay": "0",
        "topic": "#:(file)::calibration_charge_start_time",
        "sendOnBlur": false,
        "className": "",
        "topicType": "global",
        "x": 510,
        "y": 80,
        "wires": [
            [
                "3240485c8287ba94"
            ]
        ]
    },
    {
        "id": "e41f78fc126646c2",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::start_calibration_charge_now_button",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2780,
        "y": 40,
        "wires": [
            [
                "dc2cc7ea2fa34e60"
            ]
        ]
    },
    {
        "id": "dc2cc7ea2fa34e60",
        "type": "debug",
        "z": "172866a9820f49e3",
        "name": "Debug for calibration button",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 3180,
        "y": 40,
        "wires": []
    },
    {
        "id": "3240485c8287ba94",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::calibration_charge_start_time",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 900,
        "y": 80,
        "wires": [
            [
                "9777d2795825c36e"
            ]
        ]
    },
    {
        "id": "e78b1ea309a603a6",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "Set \"Calibration charge now\" to Time To CalibrationCharge",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Calibration charge now",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 3010,
        "y": 100,
        "wires": [
            [
                "f43f9fdbb0ed174c"
            ]
        ]
    },
    {
        "id": "f2947dcdf2aaa2d7",
        "type": "victron-input-custom",
        "z": "172866a9820f49e3",
        "service": "com.victronenergy.settings",
        "path": "/Settings/Controller/LastEOC",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/Controller/LastEOC",
            "name": "/Settings/Controller/LastEOC",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 550,
        "y": 280,
        "wires": [
            [
                "ce55ad5eec4e4fcd",
                "520ed5df0f889c12"
            ]
        ]
    },
    {
        "id": "92c2d1b3e084decd",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "Get current timestamp to update LastEoc",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "date"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2140,
        "y": 200,
        "wires": [
            [
                "e316195db1497dd6"
            ]
        ]
    },
    {
        "id": "a7cf225ccec6aceb",
        "type": "victron-output-custom",
        "z": "172866a9820f49e3",
        "service": "com.victronenergy.settings",
        "path": "/Settings/Controller/LastEOC",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/Controller/LastEOC",
            "name": "/Settings/Controller/LastEOC",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 2790,
        "y": 200,
        "wires": []
    },
    {
        "id": "e316195db1497dd6",
        "type": "function",
        "z": "172866a9820f49e3",
        "name": "Millisecond_to_second",
        "func": "current_timestamp_in_second=Math.floor(msg.payload/1000);\nmsg.payload = current_timestamp_in_second;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2440,
        "y": 200,
        "wires": [
            [
                "a7cf225ccec6aceb"
            ]
        ]
    },
    {
        "id": "2e11958f0143dec0",
        "type": "comment",
        "z": "172866a9820f49e3",
        "name": "EOC reached ",
        "info": "",
        "x": 1890,
        "y": 220,
        "wires": []
    },
    {
        "id": "877947e6fd87acc6",
        "type": "comment",
        "z": "172866a9820f49e3",
        "name": "Do calibration charge now",
        "info": "",
        "x": 2270,
        "y": 400,
        "wires": []
    },
    {
        "id": "a5e4b756a68c1b09",
        "type": "comment",
        "z": "172866a9820f49e3",
        "name": "Still some time left to do calibration charge",
        "info": "",
        "x": 2280,
        "y": 600,
        "wires": []
    },
    {
        "id": "2f1db37da138e532",
        "type": "debug",
        "z": "172866a9820f49e3",
        "name": "Debug for calibration charge function",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload.count",
        "statusType": "auto",
        "x": 1630,
        "y": 140,
        "wires": []
    },
    {
        "id": "4b29ed333812c24a",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "EOC reached",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "EOC reached",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2060,
        "y": 240,
        "wires": [
            [
                "f43f9fdbb0ed174c"
            ]
        ]
    },
    {
        "id": "9f12c0b1b50b4ce1",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "Calibration charge now",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Calibration charge now",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2520,
        "y": 420,
        "wires": [
            [
                "f43f9fdbb0ed174c"
            ]
        ]
    },
    {
        "id": "329547301dcbd8fd",
        "type": "ui_dropdown",
        "z": "172866a9820f49e3",
        "name": "Calibration Charge Day",
        "label": "Calibration Charge Day",
        "tooltip": "",
        "place": "",
        "group": "d610b26df84f336e",
        "order": 3,
        "width": 0,
        "height": 0,
        "passthru": true,
        "multiple": false,
        "options": [
            {
                "label": "Sunday",
                "value": 0,
                "type": "num"
            },
            {
                "label": "Monday",
                "value": 1,
                "type": "num"
            },
            {
                "label": "Tuesday",
                "value": 2,
                "type": "num"
            },
            {
                "label": "Wednesday",
                "value": 3,
                "type": "num"
            },
            {
                "label": "Thursday",
                "value": 4,
                "type": "num"
            },
            {
                "label": "Friday",
                "value": 5,
                "type": "num"
            },
            {
                "label": "Saturday",
                "value": 6,
                "type": "num"
            }
        ],
        "payload": "",
        "topic": "#:(file)::calibration_charge_weekday",
        "topicType": "global",
        "className": "",
        "x": 510,
        "y": 180,
        "wires": [
            [
                "1c86e1cdef14e122"
            ]
        ]
    },
    {
        "id": "1c86e1cdef14e122",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::calibration_charge_start_weekday",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 890,
        "y": 180,
        "wires": [
            [
                "9777d2795825c36e"
            ]
        ]
    },
    {
        "id": "ce55ad5eec4e4fcd",
        "type": "debug",
        "z": "172866a9820f49e3",
        "name": "Debug for LastEOC",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 970,
        "y": 320,
        "wires": []
    },
    {
        "id": "b72b6b4568f60ba4",
        "type": "inject",
        "z": "172866a9820f49e3",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "#:(file)::calibration_charge_start_time",
        "payloadType": "global",
        "x": 150,
        "y": 80,
        "wires": [
            [
                "fa6c2442f6246ea7"
            ]
        ]
    },
    {
        "id": "3b641a3d5b50366c",
        "type": "inject",
        "z": "172866a9820f49e3",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "#:(file)::calibration_charge_start_weekday",
        "payloadType": "global",
        "x": 160,
        "y": 180,
        "wires": [
            [
                "329547301dcbd8fd"
            ]
        ]
    },
    {
        "id": "841f883bd864e9eb",
        "type": "inject",
        "z": "172866a9820f49e3",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": "0",
        "topic": "",
        "payload": "#:(file)::start_calibration_charge_now_button",
        "payloadType": "global",
        "x": 2030,
        "y": 80,
        "wires": [
            [
                "0a24f718e758d2a9"
            ]
        ]
    },
    {
        "id": "9777d2795825c36e",
        "type": "function",
        "z": "172866a9820f49e3",
        "name": "Cal time left to do calibration charge",
        "func": "// Get minutes per day\nvar minutes_per_day = 1440;\n\n// Cal maximum minutes without calibration charge\nvar max_days_wihthout_EOC = 7;\nmax_minutes_without_EOC = max_days_wihthout_EOC*minutes_per_day;\n\n// Get LastEOC for the last EOC reached battery\nLastEOC =global.get('LastEOC','file');\n\n// Get EOC reached status for all batteries\nEOCReached_list = global.get('EOCReached','file');\n\nif (EOCReached_list.every(item => item === true)){// all batteries reach EOC\n    msg.payload=0; // stop calibration charge\n    return msg;\n}\n\n// Get calibration charge time (hh:mm) from user setting via Node Red Dashboard\nif(global.get('calibration_charge_start_time','file')!= null){\n    minutes_from_midnight_calibration_charge = Math.floor(global.get('calibration_charge_start_time','file'));\n}else{\n    minutes_from_midnight_calibration_charge = 32400000;//default value from 09:00\n}\n\n// Get calibration charge weekday from user setting via Node Red Dashboard\nif(global.get('calibration_charge_start_weekday','file')!=null){\n    weekday_calibration_charge = global.get('calibration_charge_start_weekday','file');\n}else{\n    weekday_calibration_charge = 0;//default value from Sunday\n}\n\n// Cal next calibration time\nfunction nextScheduleDay(adate, w) {\n    var daysToAdd = (w - adate.getDay() + 7) % 7;\n    var nextDate = new Date(adate);\n    nextDate.setDate(adate.getDate() + daysToAdd);\n    nextDate.setHours(0);\n    nextDate.setMinutes(0);\n    nextDate.setSeconds(0);\n    return nextDate;\n}\n\n// Main function\nfunction chargeWindows(currentTime, weekday, starttime, LastEOC) {\n    var d1 = nextScheduleDay(currentTime, weekday);\n\n    // Convert starttime to a Date object\n    var startTime = new Date(starttime);\n\n    // Calculate the next ScheduleDay considering if the sum of timeToTOC and timeLeftMinutes is less than 7 days\n    var timeLeftMinutes = Math.floor(((d1.getTime() + starttime)/1000-LastEOC)/60);\n\n    if ( timeLeftMinutes < 6* minutes_per_day) {\n        // If the sum is less than 7 days and larger than 1 day, push next ScheduleDay to next week\n        d1.setDate(d1.getDate() + 7);\n    }\n\n    var startDateTimeD1 = new Date(d1);\n    startDateTimeD1.setHours(startTime.getUTCHours(), startTime.getUTCMinutes(), 0, 0);\n\n    // Check if current time is within the charge window\n    if (currentTime < startDateTimeD1) {\n        // Calculate time left until the end of the window\n        var timeLeftMillis = startDateTimeD1 - currentTime;\n        var daysLeft = Math.floor(timeLeftMillis / (1000 * 60 * 60 * 24));\n        var hoursLeft = Math.floor((timeLeftMillis % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));\n        var minutesLeft = Math.ceil((timeLeftMillis % (1000 * 60 * 60)) / (1000 * 60));\n        \n        days_str = (daysLeft > 0) ? (daysLeft + \"d\") : \"\";\n        hours_str = (hoursLeft > 0) ? (hoursLeft + \"h\") : \"\";\n        minutes_str = (minutesLeft > 0) ? (minutesLeft + \"m\") : \"\";\n    \n        time_to_calibration_str = days_str+hours_str+minutes_str;\n\n        return time_to_calibration_str; // still some time left to do calibration charge\n    } else {\n        return 1; // it's time to do calibration charge\n    }\n}\n\nvar today = new Date(); // Assuming today's date\nvar timeLeft = chargeWindows(today, weekday_calibration_charge, minutes_from_midnight_calibration_charge, LastEOC);\n\nmsg.payload = timeLeft;\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1280,
        "y": 200,
        "wires": [
            [
                "2f1db37da138e532",
                "f020fbc3bd8d0451"
            ]
        ]
    },
    {
        "id": "68751648fdf25a8c",
        "type": "function",
        "z": "172866a9820f49e3",
        "name": "Turn off calibration charge now button when EOC",
        "func": "if(global.get('start_calibration_charge_now_button','file')==true)\n{\n    msg.payload = false;\n}else{\n    msg.payload = false;\n}\n\nreturn msg;\n\n",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2090,
        "y": 140,
        "wires": [
            [
                "0a24f718e758d2a9"
            ]
        ]
    },
    {
        "id": "26b43f1b059c7c77",
        "type": "function",
        "z": "172866a9820f49e3",
        "name": "Check whether the calibration charge now button is on",
        "func": "if(global.get('start_calibration_charge_now_button','file')==true)\n{\n    text= \"Calibration charge now\";\n}else{\n    text = msg.payload;\n}\nmsg.payload = text;\n\nreturn msg;\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2620,
        "y": 660,
        "wires": [
            [
                "f43f9fdbb0ed174c"
            ]
        ]
    },
    {
        "id": "520ed5df0f889c12",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::LastEOC",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 970,
        "y": 260,
        "wires": [
            [
                "9777d2795825c36e"
            ]
        ]
    },
    {
        "id": "652a29107ef4c403",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::start_calibration_charge_now",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2580,
        "y": 460,
        "wires": [
            [
                "f5bba4f7a2152d29"
            ]
        ]
    },
    {
        "id": "1f497b3cf623d247",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::start_calibration_charge_now",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2980,
        "y": 720,
        "wires": [
            [
                "edf42d9f5ebd6332"
            ]
        ]
    },
    {
        "id": "281c467e3b39527d",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "set global.start_calibration_charge_now to 0",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2590,
        "y": 720,
        "wires": [
            [
                "1f497b3cf623d247"
            ]
        ]
    },
    {
        "id": "1c9f62ea01d98941",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::start_calibration_charge_now",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2420,
        "y": 240,
        "wires": [
            [
                "8a1706f0a4eed2ac"
            ]
        ]
    },
    {
        "id": "8a1706f0a4eed2ac",
        "type": "debug",
        "z": "172866a9820f49e3",
        "name": "Debug for calibration",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 2720,
        "y": 240,
        "wires": []
    },
    {
        "id": "f5bba4f7a2152d29",
        "type": "debug",
        "z": "172866a9820f49e3",
        "name": "Debug for calibration",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 2860,
        "y": 460,
        "wires": []
    },
    {
        "id": "edf42d9f5ebd6332",
        "type": "debug",
        "z": "172866a9820f49e3",
        "name": "Debug for calibration",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 3300,
        "y": 720,
        "wires": []
    },
    {
        "id": "8a45f7d38dde66b3",
        "type": "victron-input-custom",
        "z": "172866a9820f49e3",
        "service": "com.victronenergy.battery/1",
        "path": "/EOCReached",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/EOCReached",
            "name": "/EOCReached",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 420,
        "y": 400,
        "wires": [
            [
                "45c35e2b5c560d3e"
            ]
        ]
    },
    {
        "id": "45c35e2b5c560d3e",
        "type": "function",
        "z": "172866a9820f49e3",
        "name": "Parse EOCReached list",
        "func": "EOCReched_list = [];\n\nEOCReached = msg.payload;\n\n//equals to the number of battery\nn=EOCReached.length;\n\nfor (i = 0; i < n; i++) {\n    EOCReched_list.push(EOCReached[i][1][0]);\n}\n\nmsg.payload = EOCReched_list;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 710,
        "y": 400,
        "wires": [
            [
                "ee9ba7412a0f3ebf"
            ]
        ]
    },
    {
        "id": "ee9ba7412a0f3ebf",
        "type": "change",
        "z": "172866a9820f49e3",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "#:(file)::EOCReached",
                "pt": "global",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 950,
        "y": 400,
        "wires": [
            [
                "9777d2795825c36e"
            ]
        ]
    },
    {
        "id": "2e3be5eb090fdd73",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
            "name": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 200,
        "wires": [
            [
                "4f65d582fda98737"
            ]
        ]
    },
    {
        "id": "4f65d582fda98737",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "min_soc",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "min_soc",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 680,
        "y": 200,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "ef77ee764778ffbe",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.battery/1",
        "path": "/Dc/0/Power",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "com.victronenergy.battery (1)"
        },
        "pathObj": {
            "path": "/Dc/0/Power",
            "name": "/Dc/0/Power",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 200,
        "y": 260,
        "wires": [
            [
                "11f86fe39b580847"
            ]
        ]
    },
    {
        "id": "11f86fe39b580847",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "battery_power",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "battery_power",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 260,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "464455af5139ee7f",
        "type": "join",
        "z": "58aeeaac02a3a4c7",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "18",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 980,
        "y": 420,
        "wires": [
            [
                "4f18dc53efd7160c"
            ]
        ]
    },
    {
        "id": "709a15b9236b4bb4",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "L1_AcPowerSetpoint",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "L1_AcPowerSetpoint",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 760,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "50510b712eae0e61",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "L2_AcPowerSetpoint",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "L2_AcPowerSetpoint",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 840,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "3cef16a03dd3e544",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "L3_AcPowerSetpoint",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "L3_AcPowerSetpoint",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 920,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "d0ef21f7ad8bb7e8",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.battery/1",
        "path": "/Info/MaxChargePower",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "com.victronenergy.battery (1)"
        },
        "pathObj": {
            "path": "/Info/MaxChargePower",
            "name": "/Info/MaxChargePower",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 240,
        "y": 320,
        "wires": [
            [
                "3d579fc76adc2ef1"
            ]
        ]
    },
    {
        "id": "59bc7383091afa19",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/MaxChargePower",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/MaxChargePower",
            "name": "/Settings/CGwacs/MaxChargePower",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 270,
        "y": 380,
        "wires": [
            [
                "85210ce266308ef5"
            ]
        ]
    },
    {
        "id": "3d579fc76adc2ef1",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "max_battery_charge_power",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "max_battery_charge_power",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 620,
        "y": 320,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "85210ce266308ef5",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "max_configured_charge_power",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "max_configured_charge_power",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 650,
        "y": 380,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "b02c86727cdd38f1",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.battery/1",
        "path": "/LowestSoc",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/LowestSoc",
            "name": "/LowestSoc",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 170,
        "y": 140,
        "wires": [
            [
                "0f2babd5674b678d"
            ]
        ]
    },
    {
        "id": "0f2babd5674b678d",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "lowest_soc",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "lowest_soc",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 140,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "077dbfcbe7cdd57c",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.battery/1",
        "path": "/NumOfBatteries",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/NumOfBatteries",
            "name": "/NumOfBatteries",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 190,
        "y": 80,
        "wires": [
            [
                "350ade5849cfef37"
            ]
        ]
    },
    {
        "id": "350ade5849cfef37",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "num_batteries",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "num_batteries",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 460,
        "y": 80,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "2066c1a0f48b4e2c",
        "type": "function",
        "z": "58aeeaac02a3a4c7",
        "name": "Get corrected inverter power setpoint",
        "func": "msg.payload = msg.payload.inverter_setpower;\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2690,
        "y": 380,
        "wires": [
            [
                "cff4cb998f39466b",
                "4ad6bb1ca25ee32a",
                "44d34af9d1e68b87",
                "d4ab83f8c5fbbd6d"
            ]
        ]
    },
    {
        "id": "49537ad0e4d9df8a",
        "type": "victron-output-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/Hub4Mode",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/Hub4Mode",
            "name": "/Settings/CGwacs/Hub4Mode",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 3110,
        "y": 600,
        "wires": []
    },
    {
        "id": "b4b77872b62e2859",
        "type": "function",
        "z": "58aeeaac02a3a4c7",
        "name": "Get ESS mode",
        "func": "msg.payload = msg.payload.ess_mode;\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2620,
        "y": 600,
        "wires": [
            [
                "49537ad0e4d9df8a",
                "97a1f6a992a29081"
            ]
        ]
    },
    {
        "id": "97a1f6a992a29081",
        "type": "debug",
        "z": "58aeeaac02a3a4c7",
        "name": "Debug for ESS mode",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 3000,
        "y": 680,
        "wires": []
    },
    {
        "id": "ab6599f35fcbdbe6",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "PVs_Power",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "PVs_Power",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1320,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "addbeff162b8a3af",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.system/0",
        "path": "/Dc/Pv/Power",
        "serviceObj": {
            "service": "com.victronenergy.system/0",
            "name": "com.victronenergy.system (0)"
        },
        "pathObj": {
            "path": "/Dc/Pv/Power",
            "name": "/Dc/Pv/Power",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 210,
        "y": 1320,
        "wires": [
            [
                "ab6599f35fcbdbe6"
            ]
        ]
    },
    {
        "id": "f3cd46b93ff1e4f8",
        "type": "victron-output-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/BatteryLife/State",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/BatteryLife/State",
            "name": "/Settings/CGwacs/BatteryLife/State",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 3130,
        "y": 740,
        "wires": []
    },
    {
        "id": "4557b1dedb6f1222",
        "type": "comment",
        "z": "58aeeaac02a3a4c7",
        "name": "Battery Related Info",
        "info": "",
        "x": 130,
        "y": 20,
        "wires": []
    },
    {
        "id": "7f963f0a2d2c6e74",
        "type": "comment",
        "z": "58aeeaac02a3a4c7",
        "name": "Ac Power Setpoint",
        "info": "",
        "x": 130,
        "y": 720,
        "wires": []
    },
    {
        "id": "bff640c85ce35e30",
        "type": "comment",
        "z": "58aeeaac02a3a4c7",
        "name": "Ac Out",
        "info": "",
        "x": 90,
        "y": 1000,
        "wires": []
    },
    {
        "id": "7538736cb44e6df3",
        "type": "comment",
        "z": "58aeeaac02a3a4c7",
        "name": "PV Power",
        "info": "",
        "x": 100,
        "y": 1260,
        "wires": []
    },
    {
        "id": "2d500c6d04672fb7",
        "type": "victron-output-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/MaxDischargePower",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/MaxDischargePower",
            "name": "/Settings/CGwacs/MaxDischargePower",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 3140,
        "y": 200,
        "wires": []
    },
    {
        "id": "376d4eea80df1146",
        "type": "debug",
        "z": "58aeeaac02a3a4c7",
        "name": "Debug for max inverter discharge power",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 3060,
        "y": 260,
        "wires": []
    },
    {
        "id": "e121ac014fa242c5",
        "type": "function",
        "z": "58aeeaac02a3a4c7",
        "name": "Get max inverter discharge power",
        "func": "msg.payload = msg.payload.max_inverter_discharge_power;\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2680,
        "y": 260,
        "wires": [
            [
                "2d500c6d04672fb7",
                "376d4eea80df1146"
            ]
        ]
    },
    {
        "id": "d2d01224ca8ace19",
        "type": "comment",
        "z": "58aeeaac02a3a4c7",
        "name": "Max Discharge Power of Inverter(Battery+PV)",
        "info": "",
        "x": 3070,
        "y": 160,
        "wires": []
    },
    {
        "id": "9b93fb5a4717969a",
        "type": "function",
        "z": "58aeeaac02a3a4c7",
        "name": "Battery Controller",
        "func": "// get inverter num of phases\nif(msg.payload.num_phases == null){\n    num_phases = 10000000000;// mimic to make power setpoint be 0 when there is no inverter phase there \n}else{\n    num_phases = msg.payload.num_phases;\n}\n\n// get max charge power\nif(msg.payload.max_configured_charge_power == null ||msg.payload.max_configured_charge_power<0){\n    max_charge_power=msg.payload.max_battery_charge_power;\n}else{\n    max_charge_power=Math.min(msg.payload.max_configured_charge_power,msg.payload.max_battery_charge_power);\n}\n\n// get battery number\nif(msg.payload.num_batteries == null){\n    n_batteries = 0;\n}else{\n    n_batteries = msg.payload.num_batteries;\n}\n\n// get current battery power\nif(msg.payload.battery_power == null){\n    battery_power = 0;\n}else{\n    battery_power = msg.payload.battery_power;\n}\n\n// get current power setpoint\nif(msg.payload.L1_AcPowerSetpoint == null){\n    L1_AcPowerSetpoint = 0;\n}else{\n    L1_AcPowerSetpoint=msg.payload.L1_AcPowerSetpoint;\n}\n\nif(msg.payload.L2_AcPowerSetpoint == null){\n    L2_AcPowerSetpoint = 0;\n}else{\n    L2_AcPowerSetpoint=msg.payload.L2_AcPowerSetpoint;\n}\n\nif(msg.payload.L3_AcPowerSetpoint == null){\n    L3_AcPowerSetpoint = 0;\n}else{\n    L3_AcPowerSetpoint=msg.payload.L3_AcPowerSetpoint;\n}\n\ninverter_power_setpoint= L1_AcPowerSetpoint+L2_AcPowerSetpoint+L3_AcPowerSetpoint;\n\n// get AC Out whihc is critical loads\nif(msg.payload.L1_AC_Out == null ||msg.payload.L2_AC_Out == null || msg.payload.L3_AC_Out == null){\n    AC_out=0;\n}else{\n    AC_out = msg.payload.L1_AC_Out + msg.payload.L2_AC_Out+msg.payload.L3_AC_Out;\n}\n\n// get PV production\nif(msg.payload.PVs_Power == null){\n    PV_production = 0;\n}else{\n    PV_production = msg.payload.PVs_Power;\n}\n\n// cal calculated max inverter power based on limb strings<=1 and DC Bus voltage >=44V when discharging, further details in flow 3\nconfigured_max_inverter_power = num_phases*10000;//3000W for each phase\nmax_discharge_current_batteries = 15*(5*n_batteries-msg.payload.num_limb_string);\nDC_BUS_Voltage = msg.payload.DC_BUS_Voltage;\n\nif(44.1<DC_BUS_Voltage && DC_BUS_Voltage <=45){\n    max_discharge_current_batteries -=(45-DC_BUS_Voltage)*20*n_batteries;\n}\n\nif(DC_BUS_Voltage <=44.1){\n    max_discharge_current_batteries = 0;\n}\n   \nmax_discharge_power_inverter = Math.floor(msg.payload.DC_BUS_Voltage*max_discharge_current_batteries+PV_production);\ncal_max_inverter_discharge_power = Math.min(max_discharge_power_inverter,configured_max_inverter_power);\n\n// variables for hold_min_soc controller\nBatterySelfDischargePower=150;//W\nHoldSocZone=3;\nP_CONST = 0.2;\nsoc = msg.payload.lowest_soc;\nmin_soc = msg.payload.min_soc;\na=-2*BatterySelfDischargePower*n_batteries/HoldSocZone;\nb=-a*(min_soc+HoldSocZone);\ntarget_dc_power_to_hold_min_soc=soc*a+b;\n\n// set batterylife state\nbatterylife_state = msg.payload.batterylife_state;\nif(soc <= min_soc -5){\n    batterylife_state = 12;\n}else if(min_soc -5 < soc && soc < min_soc){\n    batterylife_state = 11;\n}else{\n    batterylife_state = 10;\n}\n\n// calibration charge\nif(global.get('start_calibration_charge_now_button','file') == true || global.get('start_calibration_charge_now','file')==1){\n    inverter_setpower = AC_out+max_charge_power;\n    msg.payload.inverter_setpower = Math.floor(inverter_setpower/num_phases);\n    msg.payload.max_inverter_discharge_power = PV_production;\n    msg.payload.ess_mode = 3;\n    msg.payload.batterylife_state = batterylife_state;\n    msg.payload.controller_info  = \"Calibration charge\";\n    return msg;\n}\n\ntest = target_dc_power_to_hold_min_soc;\nif(min_soc<=soc&&soc<=min_soc+HoldSocZone){// hold min SOC controller\n    inverter_setpower = inverter_power_setpoint+P_CONST*target_dc_power_to_hold_min_soc;\n    max_inverter_discharge_power = PV_production;\n    ess_mode =1;\n    controller_info = \"Hold min SOC\";\n}else if(soc<min_soc){// charge to min SOC controller\n    inverter_setpower = AC_out+max_charge_power;\n    max_inverter_discharge_power = PV_production;\n    ess_mode =3;\n    controller_info = \"Charge to min SOC\";\n}else if(msg.payload.BatteryCold.some(value => value === true)){ // heat battery controller\n    inverter_setpower = AC_out+max_charge_power;\n    max_inverter_discharge_power = PV_production;\n    ess_mode =3;\n    controller_info = \"Heat Battery\";\n}else{// ESS self-consumption controller\n    inverter_setpower = inverter_power_setpoint;\n    max_inverter_discharge_power = cal_max_inverter_discharge_power;\n    ess_mode =1;\n    controller_info = \"ESS self-consumption\";\n}\n\npowerperphase = Math.floor(inverter_setpower/num_phases);\n\nmsg.payload.inverter_setpower = powerperphase;\nmsg.payload.ess_mode = ess_mode;\nmsg.payload.controller_info  = controller_info;\nmsg.payload.max_inverter_discharge_power = max_inverter_discharge_power;\nmsg.payload.batterylife_state = batterylife_state;\nmsg.payload.test = test;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2030,
        "y": 400,
        "wires": [
            [
                "c40f347a74b9ef10",
                "b4b77872b62e2859",
                "8575f4390d7502bb",
                "2066c1a0f48b4e2c",
                "e121ac014fa242c5",
                "52f0fa857f1d3a3c",
                "283f5123601abd28"
            ]
        ]
    },
    {
        "id": "cff4cb998f39466b",
        "type": "debug",
        "z": "58aeeaac02a3a4c7",
        "name": "Debug for inverter setpower per phase",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 3050,
        "y": 520,
        "wires": []
    },
    {
        "id": "cec2a974333eba22",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/BatteryLife/State",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/BatteryLife/State",
            "name": "/Settings/CGwacs/BatteryLife/State",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 270,
        "y": 1420,
        "wires": [
            [
                "be763dce41576f9e"
            ]
        ]
    },
    {
        "id": "38382b8faa6c7815",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.system/0",
        "path": "/Ac/ConsumptionOnOutput/L1/Power",
        "serviceObj": {
            "service": "com.victronenergy.system/0",
            "name": "com.victronenergy.system (0)"
        },
        "pathObj": {
            "path": "/Ac/ConsumptionOnOutput/L1/Power",
            "name": "/Ac/ConsumptionOnOutput/L1/Power",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 280,
        "y": 1060,
        "wires": [
            [
                "a1259e21e55c65c2"
            ]
        ]
    },
    {
        "id": "d699d371b43d31bf",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.system/0",
        "path": "/Ac/ConsumptionOnOutput/L2/Power",
        "serviceObj": {
            "service": "com.victronenergy.system/0",
            "name": "com.victronenergy.system (0)"
        },
        "pathObj": {
            "path": "/Ac/ConsumptionOnOutput/L2/Power",
            "name": "/Ac/ConsumptionOnOutput/L2/Power",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 280,
        "y": 1120,
        "wires": [
            [
                "44e14a9bd8752baf"
            ]
        ]
    },
    {
        "id": "673e40916f461638",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.system/0",
        "path": "/Ac/ConsumptionOnOutput/L3/Power",
        "serviceObj": {
            "service": "com.victronenergy.system/0",
            "name": "com.victronenergy.system (0)"
        },
        "pathObj": {
            "path": "/Ac/ConsumptionOnOutput/L3/Power",
            "name": "/Ac/ConsumptionOnOutput/L3/Power",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 280,
        "y": 1180,
        "wires": [
            [
                "152f4a870150b8cf"
            ]
        ]
    },
    {
        "id": "a1259e21e55c65c2",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "L1_AC_Out",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "L1_AC_Out",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 630,
        "y": 1060,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "44e14a9bd8752baf",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "L2_AC_Out",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "L2_AC_Out",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 630,
        "y": 1120,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "152f4a870150b8cf",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "L3_AC_Out",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "L3_AC_Out",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 630,
        "y": 1180,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "8e5473644f92db1a",
        "type": "comment",
        "z": "58aeeaac02a3a4c7",
        "name": "BatteryLife State",
        "info": "",
        "x": 120,
        "y": 1380,
        "wires": []
    },
    {
        "id": "be763dce41576f9e",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "batterylife_state",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "batterylife_state",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 620,
        "y": 1420,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "ac1ab9c301afc8b1",
        "type": "debug",
        "z": "58aeeaac02a3a4c7",
        "name": "Debug for batterylife state",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 3010,
        "y": 800,
        "wires": []
    },
    {
        "id": "8575f4390d7502bb",
        "type": "function",
        "z": "58aeeaac02a3a4c7",
        "name": "Get batterylife state",
        "func": "msg.payload = msg.payload.batterylife_state;\n//sg.payload = 10;\nreturn msg;",
        "outputs": 1,
        "timeout": "",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 2630,
        "y": 740,
        "wires": [
            [
                "ac1ab9c301afc8b1",
                "f3cd46b93ff1e4f8"
            ]
        ]
    },
    {
        "id": "e8fb7b9a4581ed30",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "num_phases",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "num_phases",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 610,
        "y": 1560,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "add21597ac06fa4e",
        "type": "comment",
        "z": "58aeeaac02a3a4c7",
        "name": "Num of Phase",
        "info": "",
        "x": 110,
        "y": 1500,
        "wires": []
    },
    {
        "id": "5b2a12a31ab376c0",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "DC_BUS_Voltage",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "DC_BUS_Voltage",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 660,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "6053a5629faaab1a",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.battery/1",
        "path": "/NumOfLimbStrings",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/NumOfLimbStrings",
            "name": "/NumOfLimbStrings",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 200,
        "y": 500,
        "wires": [
            [
                "714817160d66b48f"
            ]
        ]
    },
    {
        "id": "73eb6ddddb8d3431",
        "type": "comment",
        "z": "58aeeaac02a3a4c7",
        "name": "DBus Voltage",
        "info": "",
        "x": 110,
        "y": 620,
        "wires": []
    },
    {
        "id": "fe54eaf69a7fe10f",
        "type": "switch",
        "z": "58aeeaac02a3a4c7",
        "name": "only_move_on_when_batteries_are_healthy",
        "property": "payload.num_limb_string",
        "propertyType": "msg",
        "rules": [
            {
                "t": "gte",
                "v": "0",
                "vt": "str"
            },
            {
                "t": "else"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1630,
        "y": 420,
        "wires": [
            [
                "9b93fb5a4717969a"
            ],
            [
                "bcfea00921e46714",
                "ae0a6a009c8b9781"
            ]
        ]
    },
    {
        "id": "714817160d66b48f",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "limb_string_list",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "limb_string_list",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 500,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "bcfea00921e46714",
        "type": "debug",
        "z": "58aeeaac02a3a4c7",
        "name": " >=2 limb strings",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 2020,
        "y": 540,
        "wires": []
    },
    {
        "id": "fcb98057e9e5a076",
        "type": "debug",
        "z": "58aeeaac02a3a4c7",
        "name": "num_limb_string",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload.num_limb_string",
        "targetType": "msg",
        "statusVal": "payload.num_limb_string",
        "statusType": "auto",
        "x": 1540,
        "y": 480,
        "wires": []
    },
    {
        "id": "933a8eed519beb7a",
        "type": "ui_text",
        "z": "58aeeaac02a3a4c7",
        "group": "e177392401620838",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Battery Health",
        "format": "{{msg.payload.battery_health}}",
        "layout": "row-spread",
        "className": "",
        "style": false,
        "font": "Arial,Arial,Helvetica,sans-serif",
        "fontSize": "20",
        "color": "#000000",
        "x": 1540,
        "y": 360,
        "wires": []
    },
    {
        "id": "4f18dc53efd7160c",
        "type": "function",
        "z": "58aeeaac02a3a4c7",
        "name": "get_total_number_of_limb_strings",
        "func": "let total_num_limb_string=0;\nlimb_string_list = msg.payload.limb_string_list;\nmain_switch_state_list = msg.payload.main_switch_state;\nbattery_health = [];\nif (limb_string_list == null){\n    msg.payload.battery_health = \"BMS connection lost!\";\n    msg.payload.num_limb_string = -1\n    return msg;\n}\n\nfor (let i = 0; i < limb_string_list.length; i++) {\n    num_limb_string = limb_string_list[i][1][0];\n    \n    if(num_limb_string>1){\n        total_num_limb_string = -1;//if there are more than 1 limb string in a battery, should give alarm to stop use this battery\n        battery_health.push(\"Battery \"+(i+2)+\" has more than 1 limb string!\");\n    }\n    \n    if(num_limb_string<=1){\n        total_num_limb_string+=num_limb_string;\n        battery_health.push(\"Battery \"+(i+2)+\" has \" + num_limb_string+ \" limb strings.\");\n    }\n}\nmsg.payload.num_limb_string = total_num_limb_string;\nmsg.payload.battery_health = battery_health;\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1240,
        "y": 420,
        "wires": [
            [
                "fe54eaf69a7fe10f",
                "933a8eed519beb7a",
                "fcb98057e9e5a076"
            ]
        ]
    },
    {
        "id": "c40f347a74b9ef10",
        "type": "ui_text",
        "z": "58aeeaac02a3a4c7",
        "group": "e177392401620838",
        "order": 1,
        "width": 0,
        "height": 0,
        "name": "Controller Info",
        "label": "Controller Info",
        "format": "{{msg.payload.controller_info}}",
        "layout": "row-spread",
        "className": "",
        "style": false,
        "font": "Arial,Arial,Helvetica,sans-serif",
        "fontSize": "20",
        "color": "#000000",
        "x": 2620,
        "y": 160,
        "wires": []
    },
    {
        "id": "fbdb4518063f2fd0",
        "type": "victron-input-vebus",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.vebus/276",
        "path": "/Ac/NumberOfPhases",
        "serviceObj": {
            "service": "com.victronenergy.vebus/276",
            "name": "MultiGrid 48/3000/35-50"
        },
        "pathObj": {
            "path": "/Ac/NumberOfPhases",
            "type": "float",
            "name": "Phase count"
        },
        "name": "",
        "onlyChanges": false,
        "x": 190,
        "y": 1560,
        "wires": [
            [
                "e8fb7b9a4581ed30"
            ]
        ]
    },
    {
        "id": "52f0fa857f1d3a3c",
        "type": "debug",
        "z": "58aeeaac02a3a4c7",
        "name": "Debug for controller info",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload.controller_info",
        "targetType": "msg",
        "statusVal": "payload.controller_info",
        "statusType": "auto",
        "x": 2650,
        "y": 200,
        "wires": []
    },
    {
        "id": "92ad8226f257785c",
        "type": "victron-input-vebus",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.vebus/276",
        "path": "/Dc/0/Voltage",
        "serviceObj": {
            "service": "com.victronenergy.vebus/276",
            "name": "MultiGrid 48/3000/35-50"
        },
        "pathObj": {
            "path": "/Dc/0/Voltage",
            "type": "float",
            "name": "Battery voltage (V)"
        },
        "name": "",
        "onlyChanges": false,
        "roundValues": "0",
        "x": 210,
        "y": 660,
        "wires": [
            [
                "5b2a12a31ab376c0"
            ]
        ]
    },
    {
        "id": "02257e9416d1a7fa",
        "type": "victron-input-ess",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.vebus/276",
        "path": "/Hub4/L1/AcPowerSetpoint",
        "serviceObj": {
            "service": "com.victronenergy.vebus/276",
            "name": "MultiGrid 48/3000/35-50"
        },
        "pathObj": {
            "path": "/Hub4/L1/AcPowerSetpoint",
            "type": "integer",
            "name": "AC Power L1 setpoint (W)"
        },
        "name": "",
        "onlyChanges": false,
        "x": 230,
        "y": 760,
        "wires": [
            [
                "709a15b9236b4bb4"
            ]
        ]
    },
    {
        "id": "f2117fb0ac8584e0",
        "type": "victron-input-ess",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.vebus/276",
        "path": "/Hub4/L2/AcPowerSetpoint",
        "serviceObj": {
            "service": "com.victronenergy.vebus/276",
            "name": "MultiGrid 48/3000/35-50"
        },
        "pathObj": {
            "path": "/Hub4/L2/AcPowerSetpoint",
            "type": "integer",
            "name": "AC Power L2 setpoint (W)"
        },
        "name": "",
        "onlyChanges": false,
        "x": 230,
        "y": 840,
        "wires": [
            [
                "50510b712eae0e61"
            ]
        ]
    },
    {
        "id": "4c40824190b88353",
        "type": "victron-input-ess",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.vebus/276",
        "path": "/Hub4/L3/AcPowerSetpoint",
        "serviceObj": {
            "service": "com.victronenergy.vebus/276",
            "name": "MultiGrid 48/3000/35-50"
        },
        "pathObj": {
            "path": "/Hub4/L3/AcPowerSetpoint",
            "type": "integer",
            "name": "AC Power L3 setpoint (W)"
        },
        "name": "",
        "onlyChanges": false,
        "x": 230,
        "y": 920,
        "wires": [
            [
                "3cef16a03dd3e544"
            ]
        ]
    },
    {
        "id": "d4ab83f8c5fbbd6d",
        "type": "victron-output-ess",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.vebus/276",
        "path": "/Hub4/L3/AcPowerSetpoint",
        "serviceObj": {
            "service": "com.victronenergy.vebus/276",
            "name": "MultiGrid 48/3000/35-50"
        },
        "pathObj": {
            "path": "/Hub4/L3/AcPowerSetpoint",
            "type": "integer",
            "name": "AC Power L3 setpoint (W)",
            "writable": true
        },
        "name": "",
        "onlyChanges": false,
        "x": 3090,
        "y": 460,
        "wires": []
    },
    {
        "id": "44d34af9d1e68b87",
        "type": "victron-output-ess",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.vebus/276",
        "path": "/Hub4/L2/AcPowerSetpoint",
        "serviceObj": {
            "service": "com.victronenergy.vebus/276",
            "name": "MultiGrid 48/3000/35-50"
        },
        "pathObj": {
            "path": "/Hub4/L2/AcPowerSetpoint",
            "type": "integer",
            "name": "AC Power L2 setpoint (W)",
            "writable": true
        },
        "name": "",
        "onlyChanges": false,
        "x": 3090,
        "y": 400,
        "wires": []
    },
    {
        "id": "4ad6bb1ca25ee32a",
        "type": "victron-output-ess",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.vebus/276",
        "path": "/Hub4/L1/AcPowerSetpoint",
        "serviceObj": {
            "service": "com.victronenergy.vebus/276",
            "name": "MultiGrid 48/3000/35-50"
        },
        "pathObj": {
            "path": "/Hub4/L1/AcPowerSetpoint",
            "type": "integer",
            "name": "AC Power L1 setpoint (W)",
            "writable": true
        },
        "name": "",
        "onlyChanges": false,
        "x": 3090,
        "y": 340,
        "wires": []
    },
    {
        "id": "283f5123601abd28",
        "type": "debug",
        "z": "58aeeaac02a3a4c7",
        "name": "power_to_hold_min_soc",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload.test",
        "targetType": "msg",
        "statusVal": "payload.test",
        "statusType": "auto",
        "x": 2360,
        "y": 160,
        "wires": []
    },
    {
        "id": "ae0a6a009c8b9781",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "Please replace battery first!",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "Please replace battery first!",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2060,
        "y": 620,
        "wires": [
            [
                "c40f347a74b9ef10"
            ]
        ]
    },
    {
        "id": "53bdfc638f96e640",
        "type": "victron-input-custom",
        "z": "58aeeaac02a3a4c7",
        "service": "com.victronenergy.battery/1",
        "path": "/BatteryCold",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/BatteryCold",
            "name": "/BatteryCold",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 180,
        "y": 440,
        "wires": [
            [
                "4c26a8ddb2e1881c"
            ]
        ]
    },
    {
        "id": "4c26a8ddb2e1881c",
        "type": "function",
        "z": "58aeeaac02a3a4c7",
        "name": "Parse BatteryCold list",
        "func": "BatteryCold_list = [];\n\nBatteryCold = msg.payload;\n\n//equals to the number of battery\nn=BatteryCold.length;\n\nfor (i = 0; i < n; i++) {\n    BatteryCold_list.push(BatteryCold[i][1][0]);\n}\n\nmsg.payload = BatteryCold_list;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 480,
        "y": 440,
        "wires": [
            [
                "0f50a64d808a5b06"
            ]
        ]
    },
    {
        "id": "0f50a64d808a5b06",
        "type": "change",
        "z": "58aeeaac02a3a4c7",
        "name": "BatteryCold",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "BatteryCold",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 690,
        "y": 440,
        "wires": [
            [
                "464455af5139ee7f"
            ]
        ]
    },
    {
        "id": "bf31818b5561403e",
        "type": "comment",
        "z": "449f3115316b1767",
        "name": "Parse Alarms: 26",
        "info": "",
        "x": 240,
        "y": 80,
        "wires": []
    },
    {
        "id": "6cfdcab40b355672",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/CME",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/CME",
            "name": "/AlarmFlags/CME",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 920,
        "wires": [
            [
                "48d69f82af0f511b"
            ]
        ]
    },
    {
        "id": "0d3303a79e289d82",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/DATA",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/DATA",
            "name": "/AlarmFlags/DATA",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 1480,
        "wires": [
            [
                "b0769222c0c81594"
            ]
        ]
    },
    {
        "id": "563074cf40579013",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/FUSE",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/FUSE",
            "name": "/AlarmFlags/FUSE",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 680,
        "wires": [
            [
                "ea496aafa62fca89"
            ]
        ]
    },
    {
        "id": "51b00c9cd2fbe1b1",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/HEBT",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/HEBT",
            "name": "/AlarmFlags/HEBT",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1580,
        "wires": [
            [
                "2687afa4a3fb4fdd"
            ]
        ]
    },
    {
        "id": "70e342a4485f1343",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/HTFS",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/HTFS",
            "name": "/AlarmFlags/HTFS",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1440,
        "wires": [
            [
                "63715023d827fc1e"
            ]
        ]
    },
    {
        "id": "23c6de3f75ca40f7",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/HTRE",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/HTRE",
            "name": "/AlarmFlags/HTRE",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 740,
        "wires": [
            [
                "48a80e06931ecc03"
            ]
        ]
    },
    {
        "id": "22e2996f04a6a03b",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/HWEM",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/HWEM",
            "name": "/AlarmFlags/HWEM",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1040,
        "wires": [
            [
                "8b5302ef345a5ade"
            ]
        ]
    },
    {
        "id": "9ae9fbd4b39b8fd9",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/HWFL",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/HWFL",
            "name": "/AlarmFlags/HWFL",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 980,
        "wires": [
            [
                "c6162a8cbc2fa1dc"
            ]
        ]
    },
    {
        "id": "cc6841127ddbf006",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/IDM2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/IDM2",
            "name": "/AlarmFlags/IDM2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 500,
        "wires": [
            [
                "5da7a58078b2d992"
            ]
        ]
    },
    {
        "id": "d60a6034a1e15ff7",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/ISOB",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/ISOB",
            "name": "/AlarmFlags/ISOB",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 560,
        "wires": [
            [
                "145932ec555401dd"
            ]
        ]
    },
    {
        "id": "1617808449c51a48",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/LMPA",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/LMPA",
            "name": "/AlarmFlags/LMPA",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1540,
        "wires": [
            [
                "47401c80b95f2d5f"
            ]
        ]
    },
    {
        "id": "211ea82f9826409d",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/MID2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/MID2",
            "name": "/AlarmFlags/MID2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 1380,
        "wires": [
            [
                "52aa4d1b9994d41f"
            ]
        ]
    },
    {
        "id": "324aea697f08ab86",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/MSWE",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/MSWE",
            "name": "/AlarmFlags/MSWE",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 620,
        "wires": [
            [
                "7020aeefc2b065f7"
            ]
        ]
    },
    {
        "id": "2aef1941d39c2783",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/STRE",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/STRE",
            "name": "/AlarmFlags/STRE",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 860,
        "wires": [
            [
                "ea1c84dce431e761"
            ]
        ]
    },
    {
        "id": "73fde116548e1d39",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/TCPE",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/TCPE",
            "name": "/AlarmFlags/TCPE",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 800,
        "wires": [
            [
                "f5dd3b77cf306c42"
            ]
        ]
    },
    {
        "id": "c5eaf605d4d54f6d",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/TaM2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/TaM2",
            "name": "/AlarmFlags/TaM2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 200,
        "wires": [
            [
                "f0bd6424378e6521"
            ]
        ]
    },
    {
        "id": "3e3a5c9dae5a45c8",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/Tam",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/Tam",
            "name": "/AlarmFlags/Tam",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 140,
        "wires": [
            [
                "651cbb5a7a3b7c86"
            ]
        ]
    },
    {
        "id": "42e7c69a41b04403",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/TbM2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/TbM2",
            "name": "/AlarmFlags/TbM2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 320,
        "wires": [
            [
                "940370b80f41928c"
            ]
        ]
    },
    {
        "id": "5e766a107066d90e",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/Tbm",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/Tbm",
            "name": "/AlarmFlags/Tbm",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 260,
        "wires": [
            [
                "fccbcd60339ffc71"
            ]
        ]
    },
    {
        "id": "5d32609a7b711e03",
        "type": "function",
        "z": "449f3115316b1767",
        "name": "Parse_alarms_and_warnings",
        "func": "//battery health list\nbattery_health = [];\n\n//alarm list initialization\nTam_list = [];\nTaM2_list=[];\nTbm_list=[];\nTbM2_list=[];\nVBm2_list=[];\nVBM2_list=[];\nIDM2_list=[];\nISOB_list=[];\nMSWE_list=[];\nFUSE_list=[];\nHTRE_list=[];\nTCPE_list=[];\nSTRE_list=[];\nCME_list=[];\nHWFL_list=[];\nHWEM_list=[];\nThM_list=[];\nvsm2_list=[];\nvsM2_list=[];\niCM2_list=[];\niDM2_list=[];\nMID2_list=[];\nHTFS_list=[];\nDATA_list=[];\nLMPA_list=[];\nHEBT_list=[];\n\n//warning list initialization\nTaM1_list=[];\nTbM1_list=[];\nVBm1_list=[];\nVBM1_list=[];\nIDM1_list=[];\nvsm1_list=[];\nvsM1_list=[];\niCM1_list=[];\niDM1_list=[];\nMID1_list=[];\nBLPW_list=[];\nCCBF_list=[];\nAh_W_list=[];\nMPMM_list=[];\nTCdi_list=[];\nLMPW_list=[];\nTOCW_list=[];\n\n//read alarm data\nalarm_Tam = msg.payload.Tam;\nalarm_TaM2 = msg.payload.TaM2;\nalarm_Tbm = msg.payload.Tbm;\nalarm_TbM2 = msg.payload.TbM2;\nalarm_VBm2 = msg.payload.VBm2;\nalarm_VBM2 = msg.payload.VBM2;\nalarm_IDM2 = msg.payload.IDM2;\nalarm_ISOB = msg.payload.ISOB;\nalarm_MSWE = msg.payload.MSWE;\nalarm_FUSE = msg.payload.FUSE;\nalarm_HTRE = msg.payload.HTRE;\nalarm_TCPE = msg.payload.TCPE;\nalarm_STRE = msg.payload.STRE;\nalarm_CME = msg.payload.CME;\nalarm_HWFL = msg.payload.HWFL;\nalarm_HWEM = msg.payload.HWEM;\nalarm_ThM = msg.payload.ThM;\nalarm_vsm2 = msg.payload.vsm2;\nalarm_vsM2 = msg.payload.vsM2;\nalarm_iCM2 = msg.payload.iCM2;\nalarm_iDM2 = msg.payload.iDM2;\nalarm_MID2 = msg.payload.MID2;\nalarm_HTFS = msg.payload.HTFS;\nalarm_DATA = msg.payload.DATA;\nalarm_LMPA = msg.payload.LMPA;\nalarm_HEBT = msg.payload.HEBT;\n\n//read warning data\nwar_TaM1=msg.payload.TaM1;\nwar_TbM1=msg.payload.TbM1;\nwar_VBm1=msg.payload.VBm1;\nwar_VBM1=msg.payload.VBM1;\nwar_IDM1=msg.payload.IDM1;\nwar_vsm1=msg.payload.vsm1;\nwar_vsM1=msg.payload.vsM1;\nwar_iCM1=msg.payload.iCM1;\nwar_iDM1=msg.payload.iDM1;\nwar_MID1=msg.payload.MID1;\nwar_BLPW=msg.payload.BLPW;\nwar_CCBF=msg.payload.CCBF;\nwar_Ah_W=msg.payload.Ah_W;\nwar_MPMM=msg.payload.MPMM;\nwar_TCdi=msg.payload.TCdi;\nwar_LMPW=msg.payload.LMPW;\nwar_TOCW=msg.payload.TOCW;\n\n//equals to the number of battery\nif(alarm_Tam == null){\n    msg.payload = \"Battery lost!\"\n    return msg;\n}else{\n    n=alarm_Tam.length;\n}\n\nfor (i = 0; i < n; i++) {\n    Tam_list.push(alarm_Tam[i][1][0]);\n    TaM2_list.push(alarm_TaM2[i][1][0]);\n    Tbm_list.push(alarm_Tbm[i][1][0]);\n    TbM2_list.push(alarm_TbM2[i][1][0]);\n    VBm2_list.push(alarm_VBm2[i][1][0]);\n    VBM2_list.push(alarm_VBM2[i][1][0]);\n    IDM2_list.push(alarm_IDM2[i][1][0]);\n    ISOB_list.push(alarm_ISOB[i][1][0]);\n    MSWE_list.push(alarm_MSWE[i][1][0]);\n    FUSE_list.push(alarm_FUSE[i][1][0]);\n    HTRE_list.push(alarm_HTRE[i][1][0]);\n    TCPE_list.push(alarm_TCPE[i][1][0]);\n    STRE_list.push(alarm_STRE[i][1][0]);\n    CME_list.push(alarm_CME[i][1][0]);\n    HWFL_list.push(alarm_HWFL[i][1][0]);\n    HWEM_list.push(alarm_HWEM[i][1][0]);\n    ThM_list.push(alarm_ThM[i][1][0]);\n    vsm2_list.push(alarm_vsm2[i][1][0]);\n    vsM2_list.push(alarm_vsM2[i][1][0]);\n    iCM2_list.push(alarm_iCM2[i][1][0]);\n    iDM2_list.push(alarm_iDM2[i][1][0]);\n    MID2_list.push(alarm_MID2[i][1][0]);\n    HTFS_list.push(alarm_HTFS[i][1][0]);\n    DATA_list.push(alarm_DATA[i][1][0]);\n    LMPA_list.push(alarm_LMPA[i][1][0]);\n    HEBT_list.push(alarm_HEBT[i][1][0]);\n    \n    TaM1_list.push(war_TaM1[i][1][0]);\n    TbM1_list.push(war_TbM1[i][1][0]);\n    VBm1_list.push(war_VBm1[i][1][0]);\n    VBM1_list.push(war_VBM1[i][1][0]);\n    IDM1_list.push(war_IDM1[i][1][0]);\n    vsm1_list.push(war_vsm1[i][1][0]);\n    vsM1_list.push(war_vsM1[i][1][0]);\n    iCM1_list.push(war_iCM1[i][1][0]);\n    iDM1_list.push(war_iDM1[i][1][0]);\n    MID1_list.push(war_TaM1[i][1][0]);\n    BLPW_list.push(war_BLPW[i][1][0]);\n    CCBF_list.push(war_CCBF[i][1][0]);\n    Ah_W_list.push(war_Ah_W[i][1][0]);\n    MPMM_list.push(war_MPMM[i][1][0]);\n    TCdi_list.push(war_TCdi[i][1][0]);\n    LMPW_list.push(war_LMPW[i][1][0]);\n    TOCW_list.push(war_TOCW[i][1][0]);\n}\n\nif(Tam_list.includes(true)){\n    battery_health.push(\"Recoverable: BMS temperature too low\");\n}\n\nif(TaM2_list.includes(true)){\n    battery_health.push(\"Recoverable: BMS temperature too high\");\n}\n\nif(Tbm_list.includes(true)){\n    battery_health.push(\"Recoverable: Battery temperature too low\");\n}\n\nif(TbM2_list.includes(true)){\n    battery_health.push(\"Recoverable: Battery temperature too high\");\n}\n\nif(VBm2_list.includes(true)){\n    battery_health.push(\"Recoverable: Bus voltage too low\");\n}\n\nif(VBM2_list.includes(true)){\n    battery_health.push(\"Recoverable: Bus voltage too high\");\n}\n\nif(IDM2_list.includes(true)){\n    battery_health.push(\"Recoverable: Discharge current too high\");\n}\n\nif(ISOB_list.includes(true)){\n    battery_health.push(\"Unrecoverable: Electrical insulation failure\");\n}\n\nif(MSWE_list.includes(true)){\n    battery_health.push(\"Unrecoverable: Main switch failure\");\n}\n\nif(FUSE_list.includes(true)){\n    battery_health.push(\"Unrecoverable: Main fuse blown\");\n}\n\nif(HTRE_list.includes(true)){\n    battery_health.push(\"Recoverable: Battery failed to warm up\");\n}\n\nif(TCPE_list.includes(true)){\n    battery_health.push(\"Unrecoverable: Temperature sensor failure\");\n}\n\nif(STRE_list.includes(true)){\n    battery_health.push(\"Recoverable: Voltage measurement circuit fails\");\n}\n\nif(CME_list.includes(true)){\n    battery_health.push(\"Recoverable: Current sensor failure\");\n} \n\nif(HWFL_list.includes(true)){\n    battery_health.push(\"Recoverable: BMS hardware failure\");\n} \n\nif(HWEM_list.includes(true)){\n    battery_health.push(\"Recoverable: Hardware protection tripped\");\n}\n\nif(ThM_list.includes(true)){\n    battery_health.push(\"Recoverable: Heatsink temperature too high\");\n}\n\nif(vsm2_list.includes(true)){\n    battery_health.push(\"Unrecoverable: Low string voltage failure\");\n}\n\nif(vsM2_list.includes(true)){\n    battery_health.push(\"Recoverable: String voltage too high\");\n}\n\nif(iCM2_list.includes(true)){\n    battery_health.push(\"Unrecoverable: Charge current too high\");\n}\n\nif(iDM2_list.includes(true)){\n    battery_health.push(\"Recoverable: Discharge current too high\");\n} \n\nif(MID2_list.includes(true)){\n    battery_health.push(\"Recoverable: String voltage unbalance too high\");\n} \n\nif(HTFS_list.includes(true)){\n    battery_health.push(\"Unrecoverable: Heater Fuse Blown\");\n} \n\nif(DATA_list.includes(true)){\n    battery_health.push(\"Unrecoverable: Parameters out of range\");\n} \n\nif(LMPA_list.includes(true)){\n    battery_health.push(\"Unrecoverable: String voltages unbalance alarm\");\n} \n\nif(HEBT_list.includes(true)){\n    battery_health.push(\"Recoverable: Loss of heartbeat\");\n} \n\nif(TaM1_list.includes(true)){\n    battery_health.push(\"Warning: BMS temperature high\");\n} \n\nif(TbM1_list.includes(true)){\n    battery_health.push(\"Warning: Battery temperature high\");\n} \n\nif(VBm1_list.includes(true)){\n    battery_health.push(\"Warning: Bus voltage low\");\n} \n\nif(VBM1_list.includes(true)){\n    battery_health.push(\"Warning: Bus voltage high\");\n} \n\nif(IDM1_list.includes(true)){\n    battery_health.push(\"Warning: Discharge current high\");\n} \n\nif(vsm1_list.includes(true)){\n    battery_health.push(\"Warning: String voltage too low\");\n} \n\nif(vsM1_list.includes(true)){\n    battery_health.push(\"Warning: String voltage high\");\n}\n\nif(iCM1_list.includes(true)){\n    battery_health.push(\"Warning: Charge current high\");\n} \n\nif(iDM1_list.includes(true)){\n    battery_health.push(\"Warning: Discharge current high\");\n} \n\nif(MID1_list.includes(true)){\n    battery_health.push(\"Warning: String voltages unbalanced\");\n} \n\nif(BLPW_list.includes(true)){\n    battery_health.push(\"Warning: Not enough charging power on bus\");\n} \n\nif(CCBF_list.includes(true)){\n    battery_health.push(\"Warning: Internal charger hardware failure\");\n} \n\nif(Ah_W_list.includes(true)){\n    battery_health.push(\"Warning: String SOC low\");\n} \n\nif(MPMM_list.includes(true)){\n    battery_health.push(\"Warning: Midpoint wiring problem\");\n} \n\nif(TCdi_list.includes(true)){\n    battery_health.push(\"Warning: Temperature difference between strings high\");\n} \n\nif(LMPW_list.includes(true)){\n    battery_health.push(\"Warning: String voltages unbalance warning\");\n} \n\nif(TOCW_list.includes(true)){\n    battery_health.push(\"Warning: Top of Charge requested\");\n}\n\nif(battery_health.length === 0){\n    battery_health.push(\"No warning and no alarm\");\n}\n\nmsg.payload = battery_health;\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1120,
        "y": 1700,
        "wires": [
            [
                "9950564581b5af4e",
                "c8f9fbd1a718e92b"
            ]
        ]
    },
    {
        "id": "651cbb5a7a3b7c86",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "Tam",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "Tam",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 140,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "714cafa3bd1315f1",
        "type": "join",
        "z": "449f3115316b1767",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": true,
        "timeout": "",
        "count": "43",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 860,
        "y": 1700,
        "wires": [
            [
                "5d32609a7b711e03"
            ]
        ]
    },
    {
        "id": "f0bd6424378e6521",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "TaM2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "TaM2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 200,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "9950564581b5af4e",
        "type": "ui_text",
        "z": "449f3115316b1767",
        "group": "e177392401620838",
        "order": 4,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "Warnings and Alarms",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "className": "",
        "style": false,
        "font": "Arial,Arial,Helvetica,sans-serif",
        "fontSize": "20",
        "color": "#000000",
        "x": 1400,
        "y": 1700,
        "wires": []
    },
    {
        "id": "fccbcd60339ffc71",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "Tbm",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "Tbm",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 260,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "b87eb54e5438f25d",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/VBm2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/VBm2",
            "name": "/AlarmFlags/VBm2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 380,
        "wires": [
            [
                "1935d7ec73a6e600"
            ]
        ]
    },
    {
        "id": "c7506cd384e34f9f",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/VBM2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/VBM2",
            "name": "/AlarmFlags/VBM2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 440,
        "wires": [
            [
                "da45a83ea0455f32"
            ]
        ]
    },
    {
        "id": "6892a20f1aa2b6e5",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/ThM",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/ThM",
            "name": "/AlarmFlags/ThM",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 1100,
        "wires": [
            [
                "0eea322902b7925f"
            ]
        ]
    },
    {
        "id": "98888650ea5d2a96",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/vsm2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/vsm2",
            "name": "/AlarmFlags/vsm2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 1160,
        "wires": [
            [
                "d5c9a8c50fc8d0f4"
            ]
        ]
    },
    {
        "id": "c3f7ef97557d7615",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/vsM2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/vsM2",
            "name": "/AlarmFlags/vsM2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 1220,
        "wires": [
            [
                "69f4c090bfb3b6a7"
            ]
        ]
    },
    {
        "id": "8634dd2bb374e7dc",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/iCM2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/iCM2",
            "name": "/AlarmFlags/iCM2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 1280,
        "wires": [
            [
                "3a8599bc483c79aa"
            ]
        ]
    },
    {
        "id": "7fa84f8332c8fb96",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/AlarmFlags/iDM2",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/AlarmFlags/iDM2",
            "name": "/AlarmFlags/iDM2",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 310,
        "y": 1340,
        "wires": [
            [
                "d274893e4a47892d"
            ]
        ]
    },
    {
        "id": "940370b80f41928c",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "TbM2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "TbM2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 320,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "1935d7ec73a6e600",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "VBm2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "VBm2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 380,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "da45a83ea0455f32",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "VBM2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "VBM2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 440,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "5da7a58078b2d992",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "IDM2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "IDM2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 500,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "145932ec555401dd",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "ISOB",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "ISOB",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 560,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "7020aeefc2b065f7",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "MSWE",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "MSWE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 620,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "ea496aafa62fca89",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "FUSE",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "FUSE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 680,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "48a80e06931ecc03",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "HTRE",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "HTRE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 740,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "f5dd3b77cf306c42",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "TCPE",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "TCPE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 800,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "ea1c84dce431e761",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "STRE",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "STRE",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 860,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "48d69f82af0f511b",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "CME",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "CME",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 920,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "c6162a8cbc2fa1dc",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "HWFL",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "HWFL",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 980,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "8b5302ef345a5ade",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "HWEM",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "HWEM",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 560,
        "y": 1040,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "0eea322902b7925f",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "ThM",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "ThM",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1100,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "d5c9a8c50fc8d0f4",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "vsm2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "vsm2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1160,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "69f4c090bfb3b6a7",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "vsM2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "vsM2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1220,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "3a8599bc483c79aa",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "iCM2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "iCM2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1280,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "d274893e4a47892d",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "iDM2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "iDM2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1340,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "52aa4d1b9994d41f",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "MID2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "MID2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1380,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "63715023d827fc1e",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "HTFS",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "HTFS",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1440,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "b0769222c0c81594",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "DATA",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "DATA",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1480,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "47401c80b95f2d5f",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "LMPA",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "LMPA",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1540,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "2687afa4a3fb4fdd",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "HEBT",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "HEBT",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1580,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "50d6cb46307252fa",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/TaM1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/TaM1",
            "name": "/WarningFlags/TaM1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1700,
        "wires": [
            [
                "3f7e9f9d738dbdbd"
            ]
        ]
    },
    {
        "id": "70096fd1a8d1e527",
        "type": "comment",
        "z": "449f3115316b1767",
        "name": "Parse Warnings:  17",
        "info": "",
        "x": 250,
        "y": 1660,
        "wires": []
    },
    {
        "id": "028062370fed913e",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/TbM1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/TbM1",
            "name": "/WarningFlags/TbM1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1760,
        "wires": [
            [
                "d810e3509532a76d"
            ]
        ]
    },
    {
        "id": "1b22f9619f20aef4",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/VBm1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/VBm1",
            "name": "/WarningFlags/VBm1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1820,
        "wires": [
            [
                "aec3c11c306fc487"
            ]
        ]
    },
    {
        "id": "b1b68c7e0f04d624",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/VBM1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/VBM1",
            "name": "/WarningFlags/VBM1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1880,
        "wires": [
            [
                "1a27a18f8afcc0fd"
            ]
        ]
    },
    {
        "id": "fc32c5e6a2a29520",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/IDM1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/IDM1",
            "name": "/WarningFlags/IDM1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 1940,
        "wires": [
            [
                "933f082d544c7d43"
            ]
        ]
    },
    {
        "id": "bd531ea175cf9396",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/vsm1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/vsm1",
            "name": "/WarningFlags/vsm1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2000,
        "wires": [
            [
                "b68dfa2ca1af5042"
            ]
        ]
    },
    {
        "id": "849842cd109d005a",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/vsM1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/vsM1",
            "name": "/WarningFlags/vsM1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2060,
        "wires": [
            [
                "646620aa94a5a58b"
            ]
        ]
    },
    {
        "id": "62e7d8499b663da4",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/iCM1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/iCM1",
            "name": "/WarningFlags/iCM1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2120,
        "wires": [
            [
                "2f126354727a23bf"
            ]
        ]
    },
    {
        "id": "9dd7fb6509c7f419",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/iDM1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/iDM1",
            "name": "/WarningFlags/iDM1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2180,
        "wires": [
            [
                "633fb1e3fb40aa85"
            ]
        ]
    },
    {
        "id": "7d7ae3d9bcd23f66",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/MID1",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/MID1",
            "name": "/WarningFlags/MID1",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2240,
        "wires": [
            [
                "59be305aa99ae241"
            ]
        ]
    },
    {
        "id": "091b46b7dbb1bc8c",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/BLPW",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/BLPW",
            "name": "/WarningFlags/BLPW",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2300,
        "wires": [
            [
                "fb2f75ab6931515f"
            ]
        ]
    },
    {
        "id": "083488e978f234a8",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/CCBF",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/CCBF",
            "name": "/WarningFlags/CCBF",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2360,
        "wires": [
            [
                "6248c986d96c6ad6"
            ]
        ]
    },
    {
        "id": "b20ac5ae742b5138",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/Ah_W",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/Ah_W",
            "name": "/WarningFlags/Ah_W",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2420,
        "wires": [
            [
                "aa8070809a252db6"
            ]
        ]
    },
    {
        "id": "71b228354309c56f",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/MPMM",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/MPMM",
            "name": "/WarningFlags/MPMM",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 330,
        "y": 2480,
        "wires": [
            [
                "4faab6568a5d4404"
            ]
        ]
    },
    {
        "id": "ad7f9ba97722ce51",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/TCdi",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/TCdi",
            "name": "/WarningFlags/TCdi",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 320,
        "y": 2540,
        "wires": [
            [
                "52365fad40a27f93"
            ]
        ]
    },
    {
        "id": "a8d7dd081a0fdf21",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/LMPW",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/LMPW",
            "name": "/WarningFlags/LMPW",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 330,
        "y": 2600,
        "wires": [
            [
                "df72d64cca5dd3cd"
            ]
        ]
    },
    {
        "id": "3087d4cf9e009296",
        "type": "victron-input-custom",
        "z": "449f3115316b1767",
        "service": "com.victronenergy.battery/1",
        "path": "/WarningFlags/TOCW",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/WarningFlags/TOCW",
            "name": "/WarningFlags/TOCW",
            "type": "object"
        },
        "name": "",
        "onlyChanges": false,
        "x": 330,
        "y": 2660,
        "wires": [
            [
                "52110469fa1648e6"
            ]
        ]
    },
    {
        "id": "3f7e9f9d738dbdbd",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "TaM1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "TaM1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1700,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "d810e3509532a76d",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "TbM1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "TbM1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1760,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "aec3c11c306fc487",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "VBm1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "VBm1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1820,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "1a27a18f8afcc0fd",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "VBM1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "VBM1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1880,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "933f082d544c7d43",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "IDM1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "IDM1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 1940,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "b68dfa2ca1af5042",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "vsm1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "vsm1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2000,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "646620aa94a5a58b",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "vsM1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "vsM1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2060,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "2f126354727a23bf",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "iCM1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "iCM1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2120,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "633fb1e3fb40aa85",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "iDM1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "iDM1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2180,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "59be305aa99ae241",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "MID1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "MID1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2240,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "fb2f75ab6931515f",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "BLPW",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "BLPW",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2300,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "6248c986d96c6ad6",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "CCBF",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "CCBF",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2360,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "aa8070809a252db6",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "Ah_W",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "Ah_W",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2420,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "4faab6568a5d4404",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "MPMM",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "MPMM",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 580,
        "y": 2480,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "52365fad40a27f93",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "TCdi",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "TCdi",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 2540,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "df72d64cca5dd3cd",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "LMPW",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "LMPW",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 2600,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "52110469fa1648e6",
        "type": "change",
        "z": "449f3115316b1767",
        "name": "TOCW",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "TOCW",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 2660,
        "wires": [
            [
                "714cafa3bd1315f1"
            ]
        ]
    },
    {
        "id": "c8f9fbd1a718e92b",
        "type": "debug",
        "z": "449f3115316b1767",
        "name": "Debug for warnings and alarms",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 1430,
        "y": 1640,
        "wires": []
    },
    {
        "id": "1d4797e6a377f6bd",
        "type": "ui_text_input",
        "z": "9744d7fd57e81fe3",
        "name": "Grid Setpoint",
        "label": "Grid Setpoint",
        "tooltip": "",
        "group": "3290bd5996bd3175",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "number",
        "delay": "0",
        "topic": "topic",
        "sendOnBlur": false,
        "className": "",
        "topicType": "msg",
        "x": 710,
        "y": 320,
        "wires": [
            [
                "47479c689064cedc"
            ]
        ]
    },
    {
        "id": "47479c689064cedc",
        "type": "victron-output-custom",
        "z": "9744d7fd57e81fe3",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/AcPowerSetPoint",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/AcPowerSetPoint",
            "name": "/Settings/CGwacs/AcPowerSetPoint",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 1070,
        "y": 320,
        "wires": []
    },
    {
        "id": "556390611f6a678e",
        "type": "victron-input-custom",
        "z": "9744d7fd57e81fe3",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/AcPowerSetPoint",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/AcPowerSetPoint",
            "name": "/Settings/CGwacs/AcPowerSetPoint",
            "type": "number"
        },
        "name": "",
        "onlyChanges": true,
        "x": 350,
        "y": 320,
        "wires": [
            [
                "1d4797e6a377f6bd"
            ]
        ]
    },
    {
        "id": "b0ce481c0c609c63",
        "type": "victron-input-custom",
        "z": "9744d7fd57e81fe3",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
            "name": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
            "type": "number"
        },
        "name": "",
        "onlyChanges": true,
        "x": 390,
        "y": 380,
        "wires": [
            [
                "69cd8accae6fa947"
            ]
        ]
    },
    {
        "id": "69cd8accae6fa947",
        "type": "ui_text_input",
        "z": "9744d7fd57e81fe3",
        "name": "Min SOC",
        "label": "Min SOC",
        "tooltip": "",
        "group": "3290bd5996bd3175",
        "order": 2,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "number",
        "delay": "0",
        "topic": "topic",
        "sendOnBlur": false,
        "className": "",
        "topicType": "msg",
        "x": 760,
        "y": 380,
        "wires": [
            [
                "c13e22a0d82b1d03"
            ]
        ]
    },
    {
        "id": "c13e22a0d82b1d03",
        "type": "victron-output-custom",
        "z": "9744d7fd57e81fe3",
        "service": "com.victronenergy.settings",
        "path": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
        "serviceObj": {
            "service": "com.victronenergy.settings",
            "name": "com.victronenergy.settings"
        },
        "pathObj": {
            "path": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
            "name": "/Settings/CGwacs/BatteryLife/MinimumSocLimit",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 1130,
        "y": 380,
        "wires": []
    },
    {
        "id": "0b3ff7262ff95b26",
        "type": "ui_template",
        "z": "9744d7fd57e81fe3",
        "group": "e177392401620838",
        "name": "Battery Monitor",
        "order": 5,
        "width": 0,
        "height": 0,
        "format": "<a href=\"https://monitor.innov.energy/salidomo_installations/list/\" target=\"_blank\" class=\"button\"> Battery Monitor </a>\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "local",
        "className": "",
        "x": 200,
        "y": 500,
        "wires": [
            []
        ],
        "icon": "node-red/arrow-in.svg"
    },
    {
        "id": "d45cda2314ed0452",
        "type": "victron-input-custom",
        "z": "9744d7fd57e81fe3",
        "service": "com.victronenergy.battery/1",
        "path": "/Soc",
        "serviceObj": {
            "service": "com.victronenergy.battery/1",
            "name": "FZS 48TL200 x2 (1)"
        },
        "pathObj": {
            "path": "/Soc",
            "name": "/Soc",
            "type": "number"
        },
        "name": "",
        "onlyChanges": false,
        "x": 230,
        "y": 440,
        "wires": [
            [
                "2ba3d56099bc52e7"
            ]
        ]
    },
    {
        "id": "2ba3d56099bc52e7",
        "type": "ui_text",
        "z": "9744d7fd57e81fe3",
        "group": "3290bd5996bd3175",
        "order": 3,
        "width": 0,
        "height": 0,
        "name": "SOC",
        "label": "SOC",
        "format": "{{msg.payload}}",
        "layout": "row-spread",
        "className": "",
        "style": false,
        "font": "",
        "fontSize": 16,
        "color": "#000000",
        "x": 430,
        "y": 440,
        "wires": []
    }
]