[ { "id": "c43962b6ea552bbc", "type": "mqtt-broker", "name": "MQTT Broker (SAE)", "broker": "127.0.0.1", "port": 1883, "clientid": "", "autoConnect": true, "usetls": false, "protocolVersion": "4", "keepalive": "60", "cleansession": true, "birthTopic": "", "birthQos": "0", "birthPayload": "", "birthMsg": {}, "closeTopic": "", "closeQos": "0", "closePayload": "", "closeMsg": {}, "willTopic": "", "willQos": "0", "willPayload": "", "willMsg": {}, "sessionExpiry": "" }, { "id": "c708b02aa4ea7d17", "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" }, "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": "71cf749113c40c7c", "type": "ui_tab", "name": "Smart Appliance Enabler", "icon": "dashboard", "disabled": false, "hidden": false }, { "id": "b3d9d250e1d51bc2", "type": "tab", "label": "Allgemein", "disabled": false, "info": "" }, { "id": "dda3b4861f6afb0a", "type": "ui_group", "name": "Allgemein", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "e2b502e287ad182d", "type": "ui_template", "z": "b3d9d250e1d51bc2", "group": "dda3b4861f6afb0a", "name": "Styles", "order": 5, "width": 0, "height": 0, "format": "", "storeOutMessages": true, "fwdInMessages": true, "resendOnRefresh": true, "templateScope": "global", "className": "", "x": 170, "y": 40, "wires": [ [] ] }, { "id": "fcc5c3fdf1c8a138", "type": "mqtt in", "z": "b3d9d250e1d51bc2", "name": "", "topic": "sae/Event/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 100, "wires": [ [ "bb20ef6633dc9346" ] ] }, { "id": "bb20ef6633dc9346", "type": "join", "z": "b3d9d250e1d51bc2", "name": "", "mode": "custom", "build": "object", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 1, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 490, "y": 100, "wires": [ [ "bfb6ad4ad1a2b4f2" ] ] }, { "id": "bfb6ad4ad1a2b4f2", "type": "function", "z": "b3d9d250e1d51bc2", "name": "prepareData", "func": "return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'Letzte Abfrage durch Sunny Home Manager', 'Wert': msg.payload['sae/Event/SempDevice2EM']?.time ?? '-'},\n {'Parameter': 'Letzter Befehl vom Sunny Home Manager', 'Wert': msg.payload['sae/Event/SempEM2Device']?.time ?? '-'}\n ]\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 690, "y": 100, "wires": [ [ "0d4a2c7325ef8a90" ] ] }, { "id": "0d4a2c7325ef8a90", "type": "ui_table", "z": "b3d9d250e1d51bc2", "group": "dda3b4861f6afb0a", "name": "Events", "order": 1, "width": 0, "height": 0, "columns": [], "outputs": 0, "cts": false, "x": 890, "y": 100, "wires": [] }, { "id": "fa847e3cbabfc6d6", "type": "tab", "label": "F-23051969-000000000001-00", "disabled": false, "info": "" }, { "id": "bfaae87232122354", "type": "ui_group", "name": "F-23051969-000000000001-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "aa363fbabcf5a3e6", "type": "mqtt in", "z": "fa847e3cbabfc6d6", "name": "", "topic": "sae/F-23051969-000000000001-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "0b2aa55b5404cc03", "233af7fda6351fde", "eb7feb163d4c1dd6", "fd4195cc6614fe3f", "144a954120e05e49", "4baf41f9c050169b" ] ] }, { "id": "0b2aa55b5404cc03", "type": "switch", "z": "fa847e3cbabfc6d6", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "89db274cddb5eeb9" ] ] }, { "id": "233af7fda6351fde", "type": "switch", "z": "fa847e3cbabfc6d6", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "89db274cddb5eeb9" ] ] }, { "id": "eb7feb163d4c1dd6", "type": "switch", "z": "fa847e3cbabfc6d6", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "89db274cddb5eeb9" ] ] }, { "id": "89db274cddb5eeb9", "type": "join", "z": "fa847e3cbabfc6d6", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "b5df1c4734797fbd" ] ] }, { "id": "b5df1c4734797fbd", "type": "function", "z": "fa847e3cbabfc6d6", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "c88824f1c909589f" ] ] }, { "id": "c88824f1c909589f", "type": "ui_table", "z": "fa847e3cbabfc6d6", "group": "bfaae87232122354", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "fd4195cc6614fe3f", "type": "switch", "z": "fa847e3cbabfc6d6", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "89db274cddb5eeb9", "b6741679259144f1", "59d16a632a6f72a4" ] ] }, { "id": "b6741679259144f1", "type": "change", "z": "fa847e3cbabfc6d6", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "9870c2b1312e2741" ] ] }, { "id": "9870c2b1312e2741", "type": "ui_switch", "z": "fa847e3cbabfc6d6", "name": "Control", "label": "", "tooltip": "", "group": "bfaae87232122354", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "144a954120e05e49", "type": "switch", "z": "fa847e3cbabfc6d6", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "59d16a632a6f72a4", "92ec4032eb100943" ] ] }, { "id": "59d16a632a6f72a4", "type": "join", "z": "fa847e3cbabfc6d6", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "96c233252655c80b", "92ec4032eb100943" ] ] }, { "id": "96c233252655c80b", "type": "function", "z": "fa847e3cbabfc6d6", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "a9c9a3c4c59a7501" ], [ "a9c9a3c4c59a7501" ] ] }, { "id": "a9c9a3c4c59a7501", "type": "ui_chart", "z": "fa847e3cbabfc6d6", "name": "Meter", "group": "bfaae87232122354", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "92ec4032eb100943", "type": "function", "z": "fa847e3cbabfc6d6", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "276cd5109abde835" ] ] }, { "id": "276cd5109abde835", "type": "ui_text", "z": "fa847e3cbabfc6d6", "group": "bfaae87232122354", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "4baf41f9c050169b", "type": "switch", "z": "fa847e3cbabfc6d6", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "c27a6fa87958fcf9" ] ] }, { "id": "c27a6fa87958fcf9", "type": "function", "z": "fa847e3cbabfc6d6", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "9615e5ed522f8f2a" ] ] }, { "id": "9615e5ed522f8f2a", "type": "ui_timelines_chart", "z": "fa847e3cbabfc6d6", "group": "bfaae87232122354", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "3bbe3e748b5c4492", "type": "tab", "label": "F-23051969-000000000002-00", "disabled": false, "info": "" }, { "id": "fdd492e18e3b3810", "type": "ui_group", "name": "F-23051969-000000000002-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "e43f3999698261b9", "type": "mqtt in", "z": "3bbe3e748b5c4492", "name": "", "topic": "sae/F-23051969-000000000002-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "b0280ece39a33832", "be7e4569fb598186", "aff9cb8a49f06983", "28a760e2a091d81d", "5b2a5f25996b95a2", "13bfd5bb2a8ff7cf" ] ] }, { "id": "b0280ece39a33832", "type": "switch", "z": "3bbe3e748b5c4492", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "fdd6af5b0ab0c629" ] ] }, { "id": "be7e4569fb598186", "type": "switch", "z": "3bbe3e748b5c4492", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "fdd6af5b0ab0c629" ] ] }, { "id": "aff9cb8a49f06983", "type": "switch", "z": "3bbe3e748b5c4492", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "fdd6af5b0ab0c629" ] ] }, { "id": "fdd6af5b0ab0c629", "type": "join", "z": "3bbe3e748b5c4492", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "dae00ecbc7cb535a" ] ] }, { "id": "dae00ecbc7cb535a", "type": "function", "z": "3bbe3e748b5c4492", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "a16a77029786e004" ] ] }, { "id": "a16a77029786e004", "type": "ui_table", "z": "3bbe3e748b5c4492", "group": "fdd492e18e3b3810", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "28a760e2a091d81d", "type": "switch", "z": "3bbe3e748b5c4492", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "fdd6af5b0ab0c629", "ec7c729ee5878713", "b9e07298e49fc420" ] ] }, { "id": "ec7c729ee5878713", "type": "change", "z": "3bbe3e748b5c4492", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "22ef27b5442f4cb9" ] ] }, { "id": "22ef27b5442f4cb9", "type": "ui_switch", "z": "3bbe3e748b5c4492", "name": "Control", "label": "", "tooltip": "", "group": "fdd492e18e3b3810", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "5b2a5f25996b95a2", "type": "switch", "z": "3bbe3e748b5c4492", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "b9e07298e49fc420", "66fa884d849c170d" ] ] }, { "id": "b9e07298e49fc420", "type": "join", "z": "3bbe3e748b5c4492", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "cc1a0bdfadaa0411", "66fa884d849c170d" ] ] }, { "id": "cc1a0bdfadaa0411", "type": "function", "z": "3bbe3e748b5c4492", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "90e7876d7a661e5f" ], [ "90e7876d7a661e5f" ] ] }, { "id": "90e7876d7a661e5f", "type": "ui_chart", "z": "3bbe3e748b5c4492", "name": "Meter", "group": "fdd492e18e3b3810", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "66fa884d849c170d", "type": "function", "z": "3bbe3e748b5c4492", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "08a60b22bdc38902" ] ] }, { "id": "08a60b22bdc38902", "type": "ui_text", "z": "3bbe3e748b5c4492", "group": "fdd492e18e3b3810", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "13bfd5bb2a8ff7cf", "type": "switch", "z": "3bbe3e748b5c4492", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "548573c278bbc076" ] ] }, { "id": "548573c278bbc076", "type": "function", "z": "3bbe3e748b5c4492", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "ccd17091f17f6f7a" ] ] }, { "id": "ccd17091f17f6f7a", "type": "ui_timelines_chart", "z": "3bbe3e748b5c4492", "group": "fdd492e18e3b3810", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "03c66308f24b3c4b", "type": "tab", "label": "F-23051969-000000000003-00", "disabled": false, "info": "" }, { "id": "f5899c4b83c215e3", "type": "ui_group", "name": "F-23051969-000000000003-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "14df44081219053b", "type": "mqtt in", "z": "03c66308f24b3c4b", "name": "", "topic": "sae/F-23051969-000000000003-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "e991acf2075af568", "07f6e12f2589d116", "bc723d628d4d52f7", "82415060b1e08686", "dc8602c5092c9b83", "da3c820d86d478e9" ] ] }, { "id": "e991acf2075af568", "type": "switch", "z": "03c66308f24b3c4b", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "b7586ec546f45b86" ] ] }, { "id": "07f6e12f2589d116", "type": "switch", "z": "03c66308f24b3c4b", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "b7586ec546f45b86" ] ] }, { "id": "bc723d628d4d52f7", "type": "switch", "z": "03c66308f24b3c4b", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "b7586ec546f45b86" ] ] }, { "id": "b7586ec546f45b86", "type": "join", "z": "03c66308f24b3c4b", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "4f643dbfcdc7f2c1" ] ] }, { "id": "4f643dbfcdc7f2c1", "type": "function", "z": "03c66308f24b3c4b", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "ce8e1e68e3bb549d" ] ] }, { "id": "ce8e1e68e3bb549d", "type": "ui_table", "z": "03c66308f24b3c4b", "group": "f5899c4b83c215e3", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "82415060b1e08686", "type": "switch", "z": "03c66308f24b3c4b", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "b7586ec546f45b86", "64378f96a17e4361", "7b89088af6618be3" ] ] }, { "id": "64378f96a17e4361", "type": "change", "z": "03c66308f24b3c4b", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "573405b931115563" ] ] }, { "id": "573405b931115563", "type": "ui_switch", "z": "03c66308f24b3c4b", "name": "Control", "label": "", "tooltip": "", "group": "f5899c4b83c215e3", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "dc8602c5092c9b83", "type": "switch", "z": "03c66308f24b3c4b", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "7b89088af6618be3", "1c8a27fa3f804326" ] ] }, { "id": "7b89088af6618be3", "type": "join", "z": "03c66308f24b3c4b", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "11113e38a96428cf", "1c8a27fa3f804326" ] ] }, { "id": "11113e38a96428cf", "type": "function", "z": "03c66308f24b3c4b", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "0dd9f309e946fa70" ], [ "0dd9f309e946fa70" ] ] }, { "id": "0dd9f309e946fa70", "type": "ui_chart", "z": "03c66308f24b3c4b", "name": "Meter", "group": "f5899c4b83c215e3", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "1c8a27fa3f804326", "type": "function", "z": "03c66308f24b3c4b", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "90c66117949182c0" ] ] }, { "id": "90c66117949182c0", "type": "ui_text", "z": "03c66308f24b3c4b", "group": "f5899c4b83c215e3", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "da3c820d86d478e9", "type": "switch", "z": "03c66308f24b3c4b", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "89f3f51dc8fe55d8" ] ] }, { "id": "89f3f51dc8fe55d8", "type": "function", "z": "03c66308f24b3c4b", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "7b2c74329b6044f8" ] ] }, { "id": "7b2c74329b6044f8", "type": "ui_timelines_chart", "z": "03c66308f24b3c4b", "group": "f5899c4b83c215e3", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "01cd6d2b851d7798", "type": "tab", "label": "F-23051969-000000000004-00", "disabled": false, "info": "" }, { "id": "6c01aad9d89e3281", "type": "ui_group", "name": "F-23051969-000000000004-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "2c56182f95f93a08", "type": "mqtt in", "z": "01cd6d2b851d7798", "name": "", "topic": "sae/F-23051969-000000000004-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "cf2e762af4b82629", "b66be9e38e081904", "864dcd2d458b0221", "d02339d93523ce37", "dce2f0061251d58d", "0e429ec05bb910db" ] ] }, { "id": "cf2e762af4b82629", "type": "switch", "z": "01cd6d2b851d7798", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "cc6478987cf5dafb" ] ] }, { "id": "b66be9e38e081904", "type": "switch", "z": "01cd6d2b851d7798", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "cc6478987cf5dafb" ] ] }, { "id": "864dcd2d458b0221", "type": "switch", "z": "01cd6d2b851d7798", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "cc6478987cf5dafb" ] ] }, { "id": "cc6478987cf5dafb", "type": "join", "z": "01cd6d2b851d7798", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "a549dae096d8d154" ] ] }, { "id": "a549dae096d8d154", "type": "function", "z": "01cd6d2b851d7798", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "b58daefffcd1bb82" ] ] }, { "id": "b58daefffcd1bb82", "type": "ui_table", "z": "01cd6d2b851d7798", "group": "6c01aad9d89e3281", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "d02339d93523ce37", "type": "switch", "z": "01cd6d2b851d7798", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "cc6478987cf5dafb", "b3897138b170f97f", "92a1464e58a1e77d" ] ] }, { "id": "b3897138b170f97f", "type": "change", "z": "01cd6d2b851d7798", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "9b358aa4df3d4e7a" ] ] }, { "id": "9b358aa4df3d4e7a", "type": "ui_switch", "z": "01cd6d2b851d7798", "name": "Control", "label": "", "tooltip": "", "group": "6c01aad9d89e3281", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "dce2f0061251d58d", "type": "switch", "z": "01cd6d2b851d7798", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "92a1464e58a1e77d", "2e8cd835b8d80e3d" ] ] }, { "id": "92a1464e58a1e77d", "type": "join", "z": "01cd6d2b851d7798", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "5baf8aabc09a2bf3", "2e8cd835b8d80e3d" ] ] }, { "id": "5baf8aabc09a2bf3", "type": "function", "z": "01cd6d2b851d7798", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "19336feb14aa675f" ], [ "19336feb14aa675f" ] ] }, { "id": "19336feb14aa675f", "type": "ui_chart", "z": "01cd6d2b851d7798", "name": "Meter", "group": "6c01aad9d89e3281", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "2e8cd835b8d80e3d", "type": "function", "z": "01cd6d2b851d7798", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "a8b38b96c042a351" ] ] }, { "id": "a8b38b96c042a351", "type": "ui_text", "z": "01cd6d2b851d7798", "group": "6c01aad9d89e3281", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "0e429ec05bb910db", "type": "switch", "z": "01cd6d2b851d7798", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "a4da0b3ac450185a" ] ] }, { "id": "a4da0b3ac450185a", "type": "function", "z": "01cd6d2b851d7798", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "ac27f63a72879b2a" ] ] }, { "id": "ac27f63a72879b2a", "type": "ui_timelines_chart", "z": "01cd6d2b851d7798", "group": "6c01aad9d89e3281", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "0134324eaf300d16", "type": "tab", "label": "F-23051969-000000000005-00", "disabled": false, "info": "" }, { "id": "c2b090af76def31c", "type": "ui_group", "name": "F-23051969-000000000005-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "8a0abb82d7d1dce2", "type": "mqtt in", "z": "0134324eaf300d16", "name": "", "topic": "sae/F-23051969-000000000005-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "2d3e7c5163f6a9bb", "35a50ecec9fcda66", "b289803a91c7f5d9", "fad8c9a4390f477e", "aadbbced21085f8c", "13ab20875a7273ad" ] ] }, { "id": "2d3e7c5163f6a9bb", "type": "switch", "z": "0134324eaf300d16", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "5d9682cc72853d9b" ] ] }, { "id": "35a50ecec9fcda66", "type": "switch", "z": "0134324eaf300d16", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "5d9682cc72853d9b" ] ] }, { "id": "b289803a91c7f5d9", "type": "switch", "z": "0134324eaf300d16", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "5d9682cc72853d9b" ] ] }, { "id": "5d9682cc72853d9b", "type": "join", "z": "0134324eaf300d16", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "6e21d0955a635e7f" ] ] }, { "id": "6e21d0955a635e7f", "type": "function", "z": "0134324eaf300d16", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "02903f11de821980" ] ] }, { "id": "02903f11de821980", "type": "ui_table", "z": "0134324eaf300d16", "group": "c2b090af76def31c", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "fad8c9a4390f477e", "type": "switch", "z": "0134324eaf300d16", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "5d9682cc72853d9b", "0afe1c0d5a909384", "e07a7923a17d4a59" ] ] }, { "id": "0afe1c0d5a909384", "type": "change", "z": "0134324eaf300d16", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "968a8e4d590aaf79" ] ] }, { "id": "968a8e4d590aaf79", "type": "ui_switch", "z": "0134324eaf300d16", "name": "Control", "label": "", "tooltip": "", "group": "c2b090af76def31c", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "aadbbced21085f8c", "type": "switch", "z": "0134324eaf300d16", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "e07a7923a17d4a59", "66dc1ed08c95ac23" ] ] }, { "id": "e07a7923a17d4a59", "type": "join", "z": "0134324eaf300d16", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "0607d25041b7486d", "66dc1ed08c95ac23" ] ] }, { "id": "0607d25041b7486d", "type": "function", "z": "0134324eaf300d16", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "52ba3c472e1d57e1" ], [ "52ba3c472e1d57e1" ] ] }, { "id": "52ba3c472e1d57e1", "type": "ui_chart", "z": "0134324eaf300d16", "name": "Meter", "group": "c2b090af76def31c", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "66dc1ed08c95ac23", "type": "function", "z": "0134324eaf300d16", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "f1d1fe3982ca6902" ] ] }, { "id": "f1d1fe3982ca6902", "type": "ui_text", "z": "0134324eaf300d16", "group": "c2b090af76def31c", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "13ab20875a7273ad", "type": "switch", "z": "0134324eaf300d16", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "9ec03e16cc41fad2" ] ] }, { "id": "9ec03e16cc41fad2", "type": "function", "z": "0134324eaf300d16", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "d6780afabe86666a" ] ] }, { "id": "d6780afabe86666a", "type": "ui_timelines_chart", "z": "0134324eaf300d16", "group": "c2b090af76def31c", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "4bdc420905825b38", "type": "tab", "label": "F-23051969-000000000006-00", "disabled": false, "info": "" }, { "id": "6b4cf78ee3495fbc", "type": "ui_group", "name": "F-23051969-000000000006-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "96b486113d1f2553", "type": "mqtt in", "z": "4bdc420905825b38", "name": "", "topic": "sae/F-23051969-000000000006-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "cec3897eecec2b4d", "6955a2f12858c4cf", "bdf8ba5956c1094e", "0b8a54d58b8250f9", "4e07e70c98b085b2", "586a467e0bcb77e1" ] ] }, { "id": "cec3897eecec2b4d", "type": "switch", "z": "4bdc420905825b38", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "17dacd0e8d882098" ] ] }, { "id": "6955a2f12858c4cf", "type": "switch", "z": "4bdc420905825b38", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "17dacd0e8d882098" ] ] }, { "id": "bdf8ba5956c1094e", "type": "switch", "z": "4bdc420905825b38", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "17dacd0e8d882098" ] ] }, { "id": "17dacd0e8d882098", "type": "join", "z": "4bdc420905825b38", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "602d9f3538ec9cf8" ] ] }, { "id": "602d9f3538ec9cf8", "type": "function", "z": "4bdc420905825b38", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "88d8af1c3457b4d6" ] ] }, { "id": "88d8af1c3457b4d6", "type": "ui_table", "z": "4bdc420905825b38", "group": "6b4cf78ee3495fbc", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "0b8a54d58b8250f9", "type": "switch", "z": "4bdc420905825b38", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "17dacd0e8d882098", "21c51ef44d2e8c02", "2a5281737f92520e" ] ] }, { "id": "21c51ef44d2e8c02", "type": "change", "z": "4bdc420905825b38", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "49e5139e8dfe2909" ] ] }, { "id": "49e5139e8dfe2909", "type": "ui_switch", "z": "4bdc420905825b38", "name": "Control", "label": "", "tooltip": "", "group": "6b4cf78ee3495fbc", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "4e07e70c98b085b2", "type": "switch", "z": "4bdc420905825b38", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "2a5281737f92520e", "308b4170c14a93b7" ] ] }, { "id": "2a5281737f92520e", "type": "join", "z": "4bdc420905825b38", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "e00b7618777568a2", "308b4170c14a93b7" ] ] }, { "id": "e00b7618777568a2", "type": "function", "z": "4bdc420905825b38", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "13b7cc51dcc2dc36" ], [ "13b7cc51dcc2dc36" ] ] }, { "id": "13b7cc51dcc2dc36", "type": "ui_chart", "z": "4bdc420905825b38", "name": "Meter", "group": "6b4cf78ee3495fbc", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "308b4170c14a93b7", "type": "function", "z": "4bdc420905825b38", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "110cbd07ba89030b" ] ] }, { "id": "110cbd07ba89030b", "type": "ui_text", "z": "4bdc420905825b38", "group": "6b4cf78ee3495fbc", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "586a467e0bcb77e1", "type": "switch", "z": "4bdc420905825b38", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "05687a9242702b9a" ] ] }, { "id": "05687a9242702b9a", "type": "function", "z": "4bdc420905825b38", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "4b677fe81a41ad59" ] ] }, { "id": "4b677fe81a41ad59", "type": "ui_timelines_chart", "z": "4bdc420905825b38", "group": "6b4cf78ee3495fbc", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "d7779f46acb708c1", "type": "tab", "label": "F-23051969-000000000007-00", "disabled": false, "info": "" }, { "id": "4e0a93d5b348641e", "type": "ui_group", "name": "F-23051969-000000000007-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "5bbe4ec601430dc2", "type": "mqtt in", "z": "d7779f46acb708c1", "name": "", "topic": "sae/F-23051969-000000000007-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "d9445a6e3fce16f7", "5f1be4505ebb6cd3", "fa649d75b37096eb", "4fa83de841f128c4", "01bfb8aafea3fb8a", "97f27acb598a5b20" ] ] }, { "id": "d9445a6e3fce16f7", "type": "switch", "z": "d7779f46acb708c1", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "2806d9076ae860de" ] ] }, { "id": "5f1be4505ebb6cd3", "type": "switch", "z": "d7779f46acb708c1", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "2806d9076ae860de" ] ] }, { "id": "fa649d75b37096eb", "type": "switch", "z": "d7779f46acb708c1", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "2806d9076ae860de" ] ] }, { "id": "2806d9076ae860de", "type": "join", "z": "d7779f46acb708c1", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "84e1a0eb804d8deb" ] ] }, { "id": "84e1a0eb804d8deb", "type": "function", "z": "d7779f46acb708c1", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "d111f4f1cc526112" ] ] }, { "id": "d111f4f1cc526112", "type": "ui_table", "z": "d7779f46acb708c1", "group": "4e0a93d5b348641e", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "4fa83de841f128c4", "type": "switch", "z": "d7779f46acb708c1", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "2806d9076ae860de", "8b9c552477c4bbe6", "4c83cdb8dddc3c5f" ] ] }, { "id": "8b9c552477c4bbe6", "type": "change", "z": "d7779f46acb708c1", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "be291f80e70cc819" ] ] }, { "id": "be291f80e70cc819", "type": "ui_switch", "z": "d7779f46acb708c1", "name": "Control", "label": "", "tooltip": "", "group": "4e0a93d5b348641e", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "01bfb8aafea3fb8a", "type": "switch", "z": "d7779f46acb708c1", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "4c83cdb8dddc3c5f", "2434ecb086dff2bc" ] ] }, { "id": "4c83cdb8dddc3c5f", "type": "join", "z": "d7779f46acb708c1", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "61a6f4aea54f92e9", "2434ecb086dff2bc" ] ] }, { "id": "61a6f4aea54f92e9", "type": "function", "z": "d7779f46acb708c1", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "bfd9376d949305c5" ], [ "bfd9376d949305c5" ] ] }, { "id": "bfd9376d949305c5", "type": "ui_chart", "z": "d7779f46acb708c1", "name": "Meter", "group": "4e0a93d5b348641e", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "2434ecb086dff2bc", "type": "function", "z": "d7779f46acb708c1", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "b625a8805a44c36b" ] ] }, { "id": "b625a8805a44c36b", "type": "ui_text", "z": "d7779f46acb708c1", "group": "4e0a93d5b348641e", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "97f27acb598a5b20", "type": "switch", "z": "d7779f46acb708c1", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "48820ef5bb78fc1e" ] ] }, { "id": "48820ef5bb78fc1e", "type": "function", "z": "d7779f46acb708c1", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "f21fd82a5ee83cdf" ] ] }, { "id": "f21fd82a5ee83cdf", "type": "ui_timelines_chart", "z": "d7779f46acb708c1", "group": "4e0a93d5b348641e", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "d7a7dd2f347a1d61", "type": "tab", "label": "F-23051969-000000000009-00", "disabled": false, "info": "" }, { "id": "21c0c9902fa5e7bb", "type": "ui_group", "name": "F-23051969-000000000009-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "0d50105986f2394b", "type": "mqtt in", "z": "d7a7dd2f347a1d61", "name": "", "topic": "sae/F-23051969-000000000009-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "bc49c1bb1dc67ece", "53def5e005810210", "8106d4b666f3787d", "7516c54dc8b3dfbc", "a73a5734b3bb2ad3", "15582b2213371fca" ] ] }, { "id": "bc49c1bb1dc67ece", "type": "switch", "z": "d7a7dd2f347a1d61", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "350ec5792df98fbf" ] ] }, { "id": "53def5e005810210", "type": "switch", "z": "d7a7dd2f347a1d61", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "350ec5792df98fbf" ] ] }, { "id": "8106d4b666f3787d", "type": "switch", "z": "d7a7dd2f347a1d61", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "350ec5792df98fbf" ] ] }, { "id": "350ec5792df98fbf", "type": "join", "z": "d7a7dd2f347a1d61", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "ae72a6dd998577e8" ] ] }, { "id": "ae72a6dd998577e8", "type": "function", "z": "d7a7dd2f347a1d61", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "adc5ad7685a1a9d0" ] ] }, { "id": "adc5ad7685a1a9d0", "type": "ui_table", "z": "d7a7dd2f347a1d61", "group": "21c0c9902fa5e7bb", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "7516c54dc8b3dfbc", "type": "switch", "z": "d7a7dd2f347a1d61", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "350ec5792df98fbf", "191bc773653f6e5e", "7bbe36cfa0e85649" ] ] }, { "id": "191bc773653f6e5e", "type": "change", "z": "d7a7dd2f347a1d61", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "7f0601c4ae02a8fa" ] ] }, { "id": "7f0601c4ae02a8fa", "type": "ui_switch", "z": "d7a7dd2f347a1d61", "name": "Control", "label": "", "tooltip": "", "group": "21c0c9902fa5e7bb", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "a73a5734b3bb2ad3", "type": "switch", "z": "d7a7dd2f347a1d61", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "7bbe36cfa0e85649", "61277b24bf72b6da" ] ] }, { "id": "7bbe36cfa0e85649", "type": "join", "z": "d7a7dd2f347a1d61", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "8d8893322a03b49c", "61277b24bf72b6da" ] ] }, { "id": "8d8893322a03b49c", "type": "function", "z": "d7a7dd2f347a1d61", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "977ca719d92c7eef" ], [ "977ca719d92c7eef" ] ] }, { "id": "977ca719d92c7eef", "type": "ui_chart", "z": "d7a7dd2f347a1d61", "name": "Meter", "group": "21c0c9902fa5e7bb", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "61277b24bf72b6da", "type": "function", "z": "d7a7dd2f347a1d61", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "3d798da21a76fb34" ] ] }, { "id": "3d798da21a76fb34", "type": "ui_text", "z": "d7a7dd2f347a1d61", "group": "21c0c9902fa5e7bb", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "15582b2213371fca", "type": "switch", "z": "d7a7dd2f347a1d61", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "a9a5e0b5bf496094" ] ] }, { "id": "a9a5e0b5bf496094", "type": "function", "z": "d7a7dd2f347a1d61", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "792bbb4f0212ba00" ] ] }, { "id": "792bbb4f0212ba00", "type": "ui_timelines_chart", "z": "d7a7dd2f347a1d61", "group": "21c0c9902fa5e7bb", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "99c7f7f3a35e65a0", "type": "tab", "label": "F-23051969-000000000010-00", "disabled": false, "info": "" }, { "id": "7b9fdd46348acd4b", "type": "ui_group", "name": "F-23051969-000000000010-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "8fad1928c3922354", "type": "mqtt in", "z": "99c7f7f3a35e65a0", "name": "", "topic": "sae/F-23051969-000000000010-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "e9ee73dbe0643d56", "616327f2a14e8319", "73ab1087f2487e93", "5db16782ed695cfd", "56d4722cf4ebfca7", "a1ca437ea9604ec3" ] ] }, { "id": "e9ee73dbe0643d56", "type": "switch", "z": "99c7f7f3a35e65a0", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "d131c94d7a96b208" ] ] }, { "id": "616327f2a14e8319", "type": "switch", "z": "99c7f7f3a35e65a0", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "d131c94d7a96b208" ] ] }, { "id": "73ab1087f2487e93", "type": "switch", "z": "99c7f7f3a35e65a0", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "d131c94d7a96b208" ] ] }, { "id": "d131c94d7a96b208", "type": "join", "z": "99c7f7f3a35e65a0", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "b589d97402d6f4fa" ] ] }, { "id": "b589d97402d6f4fa", "type": "function", "z": "99c7f7f3a35e65a0", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "d177f29939b50714" ] ] }, { "id": "d177f29939b50714", "type": "ui_table", "z": "99c7f7f3a35e65a0", "group": "7b9fdd46348acd4b", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "5db16782ed695cfd", "type": "switch", "z": "99c7f7f3a35e65a0", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "d131c94d7a96b208", "16f20735f2b4e186", "b2c42b0c4c351553" ] ] }, { "id": "16f20735f2b4e186", "type": "change", "z": "99c7f7f3a35e65a0", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "4fcd305a3b7086c2" ] ] }, { "id": "4fcd305a3b7086c2", "type": "ui_switch", "z": "99c7f7f3a35e65a0", "name": "Control", "label": "", "tooltip": "", "group": "7b9fdd46348acd4b", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "56d4722cf4ebfca7", "type": "switch", "z": "99c7f7f3a35e65a0", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "b2c42b0c4c351553", "d4431ec31b1d738e" ] ] }, { "id": "b2c42b0c4c351553", "type": "join", "z": "99c7f7f3a35e65a0", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "5c1b8ecb014e5f24", "d4431ec31b1d738e" ] ] }, { "id": "5c1b8ecb014e5f24", "type": "function", "z": "99c7f7f3a35e65a0", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "6a3661a96c88242e" ], [ "6a3661a96c88242e" ] ] }, { "id": "6a3661a96c88242e", "type": "ui_chart", "z": "99c7f7f3a35e65a0", "name": "Meter", "group": "7b9fdd46348acd4b", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "d4431ec31b1d738e", "type": "function", "z": "99c7f7f3a35e65a0", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "d405ee13c7e698ed" ] ] }, { "id": "d405ee13c7e698ed", "type": "ui_text", "z": "99c7f7f3a35e65a0", "group": "7b9fdd46348acd4b", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "a1ca437ea9604ec3", "type": "switch", "z": "99c7f7f3a35e65a0", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "2d3142254f6b84a7" ] ] }, { "id": "2d3142254f6b84a7", "type": "function", "z": "99c7f7f3a35e65a0", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "ef19921694c99fb3" ] ] }, { "id": "ef19921694c99fb3", "type": "ui_timelines_chart", "z": "99c7f7f3a35e65a0", "group": "7b9fdd46348acd4b", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "34c89c50eee2c8be", "type": "tab", "label": "F-23051969-000000000011-00", "disabled": false, "info": "" }, { "id": "dd80acb31a58912e", "type": "ui_group", "name": "F-23051969-000000000011-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "76edce37173cb4b5", "type": "mqtt in", "z": "34c89c50eee2c8be", "name": "", "topic": "sae/F-23051969-000000000011-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "6ea643f43693cb8f", "965d667add600c66", "f391cc210d57a5c6", "2f2806fb55a08a55", "420a05c59c43d461", "5bf6147ba4be151e" ] ] }, { "id": "6ea643f43693cb8f", "type": "switch", "z": "34c89c50eee2c8be", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "83dfaa52f8ec0f27" ] ] }, { "id": "965d667add600c66", "type": "switch", "z": "34c89c50eee2c8be", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "83dfaa52f8ec0f27" ] ] }, { "id": "f391cc210d57a5c6", "type": "switch", "z": "34c89c50eee2c8be", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "83dfaa52f8ec0f27" ] ] }, { "id": "83dfaa52f8ec0f27", "type": "join", "z": "34c89c50eee2c8be", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "da54c6bb3d77d019" ] ] }, { "id": "da54c6bb3d77d019", "type": "function", "z": "34c89c50eee2c8be", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "07dea6d2e2017c05" ] ] }, { "id": "07dea6d2e2017c05", "type": "ui_table", "z": "34c89c50eee2c8be", "group": "dd80acb31a58912e", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "2f2806fb55a08a55", "type": "switch", "z": "34c89c50eee2c8be", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "83dfaa52f8ec0f27", "01b076d0ba37a98f", "f9e9447fdc6ed2d5" ] ] }, { "id": "01b076d0ba37a98f", "type": "change", "z": "34c89c50eee2c8be", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "8760c27302e1b66e" ] ] }, { "id": "8760c27302e1b66e", "type": "ui_switch", "z": "34c89c50eee2c8be", "name": "Control", "label": "", "tooltip": "", "group": "dd80acb31a58912e", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "420a05c59c43d461", "type": "switch", "z": "34c89c50eee2c8be", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "f9e9447fdc6ed2d5", "4e19dd1d640d577d" ] ] }, { "id": "f9e9447fdc6ed2d5", "type": "join", "z": "34c89c50eee2c8be", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "b055954ee2ef4a35", "4e19dd1d640d577d" ] ] }, { "id": "b055954ee2ef4a35", "type": "function", "z": "34c89c50eee2c8be", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "d4e024edc9a14f4b" ], [ "d4e024edc9a14f4b" ] ] }, { "id": "d4e024edc9a14f4b", "type": "ui_chart", "z": "34c89c50eee2c8be", "name": "Meter", "group": "dd80acb31a58912e", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "4e19dd1d640d577d", "type": "function", "z": "34c89c50eee2c8be", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "1a2b74c485d0e2c9" ] ] }, { "id": "1a2b74c485d0e2c9", "type": "ui_text", "z": "34c89c50eee2c8be", "group": "dd80acb31a58912e", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "5bf6147ba4be151e", "type": "switch", "z": "34c89c50eee2c8be", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "94a4aebbfcbd5ac0" ] ] }, { "id": "94a4aebbfcbd5ac0", "type": "function", "z": "34c89c50eee2c8be", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "54ff1655341aa410" ] ] }, { "id": "54ff1655341aa410", "type": "ui_timelines_chart", "z": "34c89c50eee2c8be", "group": "dd80acb31a58912e", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "978009fee72b707a", "type": "tab", "label": "F-23051969-000000000012-00", "disabled": false, "info": "" }, { "id": "5da9ea9bdc2a87da", "type": "ui_group", "name": "F-23051969-000000000012-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "de8caf9bcd213d7f", "type": "mqtt in", "z": "978009fee72b707a", "name": "", "topic": "sae/F-23051969-000000000012-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "6a12724e54d722e0", "515941c44302b145", "399fd495ad67f99c", "135ca2747a4b011f", "7e2321288026bc48", "eafefa212c9350cc" ] ] }, { "id": "6a12724e54d722e0", "type": "switch", "z": "978009fee72b707a", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "67713702e2c09f2a" ] ] }, { "id": "515941c44302b145", "type": "switch", "z": "978009fee72b707a", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "67713702e2c09f2a" ] ] }, { "id": "399fd495ad67f99c", "type": "switch", "z": "978009fee72b707a", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "67713702e2c09f2a" ] ] }, { "id": "67713702e2c09f2a", "type": "join", "z": "978009fee72b707a", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "9bc347e9bdddc9dd" ] ] }, { "id": "9bc347e9bdddc9dd", "type": "function", "z": "978009fee72b707a", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "4a777877db8fdc94" ] ] }, { "id": "4a777877db8fdc94", "type": "ui_table", "z": "978009fee72b707a", "group": "5da9ea9bdc2a87da", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "135ca2747a4b011f", "type": "switch", "z": "978009fee72b707a", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "67713702e2c09f2a", "4d6634dfad3c42f0", "f7326f35b52b6511" ] ] }, { "id": "4d6634dfad3c42f0", "type": "change", "z": "978009fee72b707a", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "968cc5f2466c009a" ] ] }, { "id": "968cc5f2466c009a", "type": "ui_switch", "z": "978009fee72b707a", "name": "Control", "label": "", "tooltip": "", "group": "5da9ea9bdc2a87da", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "7e2321288026bc48", "type": "switch", "z": "978009fee72b707a", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "f7326f35b52b6511", "63f0b5516db87550" ] ] }, { "id": "f7326f35b52b6511", "type": "join", "z": "978009fee72b707a", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "6bf1ae227eb3d1fb", "63f0b5516db87550" ] ] }, { "id": "6bf1ae227eb3d1fb", "type": "function", "z": "978009fee72b707a", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "e44f8258168d977f" ], [ "e44f8258168d977f" ] ] }, { "id": "e44f8258168d977f", "type": "ui_chart", "z": "978009fee72b707a", "name": "Meter", "group": "5da9ea9bdc2a87da", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "63f0b5516db87550", "type": "function", "z": "978009fee72b707a", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "e6b345de32d9800d" ] ] }, { "id": "e6b345de32d9800d", "type": "ui_text", "z": "978009fee72b707a", "group": "5da9ea9bdc2a87da", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "eafefa212c9350cc", "type": "switch", "z": "978009fee72b707a", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "6031b5fa89fe8ac6" ] ] }, { "id": "6031b5fa89fe8ac6", "type": "function", "z": "978009fee72b707a", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "5c0aa7d91ff12558" ] ] }, { "id": "5c0aa7d91ff12558", "type": "ui_timelines_chart", "z": "978009fee72b707a", "group": "5da9ea9bdc2a87da", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "7c7b2c696888a944", "type": "tab", "label": "F-23051969-000000000013-00", "disabled": false, "info": "" }, { "id": "b56979e38bfba1d3", "type": "ui_group", "name": "F-23051969-000000000013-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "d2dd1f30f197d3d2", "type": "mqtt in", "z": "7c7b2c696888a944", "name": "", "topic": "sae/F-23051969-000000000013-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "c8bc7568aa585e5b", "306cfd76f1299d15", "ebb7a577dab2cb62", "3ab9bcdbf98c6f0d", "d7f3c255394d368f", "c25aeb9bd6e4bde8" ] ] }, { "id": "c8bc7568aa585e5b", "type": "switch", "z": "7c7b2c696888a944", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "d24aa6303cb2b680" ] ] }, { "id": "306cfd76f1299d15", "type": "switch", "z": "7c7b2c696888a944", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "d24aa6303cb2b680" ] ] }, { "id": "ebb7a577dab2cb62", "type": "switch", "z": "7c7b2c696888a944", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "d24aa6303cb2b680" ] ] }, { "id": "d24aa6303cb2b680", "type": "join", "z": "7c7b2c696888a944", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "9b2b983716917629" ] ] }, { "id": "9b2b983716917629", "type": "function", "z": "7c7b2c696888a944", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "55d1c7886e523819" ] ] }, { "id": "55d1c7886e523819", "type": "ui_table", "z": "7c7b2c696888a944", "group": "b56979e38bfba1d3", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "3ab9bcdbf98c6f0d", "type": "switch", "z": "7c7b2c696888a944", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "d24aa6303cb2b680", "9f176dfe2e17ece9", "0f0e93fe89648f08" ] ] }, { "id": "9f176dfe2e17ece9", "type": "change", "z": "7c7b2c696888a944", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "a2f3de5d15f948fc" ] ] }, { "id": "a2f3de5d15f948fc", "type": "ui_switch", "z": "7c7b2c696888a944", "name": "Control", "label": "", "tooltip": "", "group": "b56979e38bfba1d3", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "d7f3c255394d368f", "type": "switch", "z": "7c7b2c696888a944", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "0f0e93fe89648f08", "8d763dc903565742" ] ] }, { "id": "0f0e93fe89648f08", "type": "join", "z": "7c7b2c696888a944", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "6f16ab7edb459769", "8d763dc903565742" ] ] }, { "id": "6f16ab7edb459769", "type": "function", "z": "7c7b2c696888a944", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "6071f9fc3e3a64a9" ], [ "6071f9fc3e3a64a9" ] ] }, { "id": "6071f9fc3e3a64a9", "type": "ui_chart", "z": "7c7b2c696888a944", "name": "Meter", "group": "b56979e38bfba1d3", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "8d763dc903565742", "type": "function", "z": "7c7b2c696888a944", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "2c6a5d485f7fc393" ] ] }, { "id": "2c6a5d485f7fc393", "type": "ui_text", "z": "7c7b2c696888a944", "group": "b56979e38bfba1d3", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "c25aeb9bd6e4bde8", "type": "switch", "z": "7c7b2c696888a944", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "b65562cf076159a6" ] ] }, { "id": "b65562cf076159a6", "type": "function", "z": "7c7b2c696888a944", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "2e7e173f8f2b6e53" ] ] }, { "id": "2e7e173f8f2b6e53", "type": "ui_timelines_chart", "z": "7c7b2c696888a944", "group": "b56979e38bfba1d3", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "17cda9ac486d3579", "type": "tab", "label": "F-23051969-000000000014-00", "disabled": false, "info": "" }, { "id": "e95b922b42a5c942", "type": "ui_group", "name": "F-23051969-000000000014-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "cb8381619d37074a", "type": "mqtt in", "z": "17cda9ac486d3579", "name": "", "topic": "sae/F-23051969-000000000014-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "bb1b98f77c742cde", "39a66720c72511fa", "a6716fc9b65c0b0c", "b928b15f41ecb819", "c66c6c01b555e0bd", "01173aa2ad7e54df" ] ] }, { "id": "bb1b98f77c742cde", "type": "switch", "z": "17cda9ac486d3579", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "7b2dc444794064ab" ] ] }, { "id": "39a66720c72511fa", "type": "switch", "z": "17cda9ac486d3579", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "7b2dc444794064ab" ] ] }, { "id": "a6716fc9b65c0b0c", "type": "switch", "z": "17cda9ac486d3579", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "7b2dc444794064ab" ] ] }, { "id": "7b2dc444794064ab", "type": "join", "z": "17cda9ac486d3579", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "d0edde947ddb5ed2" ] ] }, { "id": "d0edde947ddb5ed2", "type": "function", "z": "17cda9ac486d3579", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "c4862bbd7c247193" ] ] }, { "id": "c4862bbd7c247193", "type": "ui_table", "z": "17cda9ac486d3579", "group": "e95b922b42a5c942", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "b928b15f41ecb819", "type": "switch", "z": "17cda9ac486d3579", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "7b2dc444794064ab", "ed726c7b35335644", "1ad5894e2c02ef30" ] ] }, { "id": "ed726c7b35335644", "type": "change", "z": "17cda9ac486d3579", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "5dc72478cbda0510" ] ] }, { "id": "5dc72478cbda0510", "type": "ui_switch", "z": "17cda9ac486d3579", "name": "Control", "label": "", "tooltip": "", "group": "e95b922b42a5c942", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "c66c6c01b555e0bd", "type": "switch", "z": "17cda9ac486d3579", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "1ad5894e2c02ef30", "e5c63f05092d1798" ] ] }, { "id": "1ad5894e2c02ef30", "type": "join", "z": "17cda9ac486d3579", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "fa0701145e33955b", "e5c63f05092d1798" ] ] }, { "id": "fa0701145e33955b", "type": "function", "z": "17cda9ac486d3579", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "f7d3f8ded5fe2321" ], [ "f7d3f8ded5fe2321" ] ] }, { "id": "f7d3f8ded5fe2321", "type": "ui_chart", "z": "17cda9ac486d3579", "name": "Meter", "group": "e95b922b42a5c942", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "e5c63f05092d1798", "type": "function", "z": "17cda9ac486d3579", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "726f47cd5d9a4257" ] ] }, { "id": "726f47cd5d9a4257", "type": "ui_text", "z": "17cda9ac486d3579", "group": "e95b922b42a5c942", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "01173aa2ad7e54df", "type": "switch", "z": "17cda9ac486d3579", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "18c42969aaabe30a" ] ] }, { "id": "18c42969aaabe30a", "type": "function", "z": "17cda9ac486d3579", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "8da6336e16700eba" ] ] }, { "id": "8da6336e16700eba", "type": "ui_timelines_chart", "z": "17cda9ac486d3579", "group": "e95b922b42a5c942", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "5a06ee696b8f9020", "type": "tab", "label": "F-23051969-000000000015-00", "disabled": false, "info": "" }, { "id": "48f0d3db269cc8f6", "type": "ui_group", "name": "F-23051969-000000000015-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "e6043b499d2dc781", "type": "mqtt in", "z": "5a06ee696b8f9020", "name": "", "topic": "sae/F-23051969-000000000015-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "ad0f093d5de2e6a4", "14b1b3b56c814ccb", "bd4a7a4f45b9438e", "e47636266e61c57b", "50afd4eb501dddaa", "1439ca285e351f4f" ] ] }, { "id": "ad0f093d5de2e6a4", "type": "switch", "z": "5a06ee696b8f9020", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "98973373c39abf5c" ] ] }, { "id": "14b1b3b56c814ccb", "type": "switch", "z": "5a06ee696b8f9020", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "98973373c39abf5c" ] ] }, { "id": "bd4a7a4f45b9438e", "type": "switch", "z": "5a06ee696b8f9020", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "98973373c39abf5c" ] ] }, { "id": "98973373c39abf5c", "type": "join", "z": "5a06ee696b8f9020", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "34b770215a4c0135" ] ] }, { "id": "34b770215a4c0135", "type": "function", "z": "5a06ee696b8f9020", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "3bb3415ec6a69756" ] ] }, { "id": "3bb3415ec6a69756", "type": "ui_table", "z": "5a06ee696b8f9020", "group": "48f0d3db269cc8f6", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "e47636266e61c57b", "type": "switch", "z": "5a06ee696b8f9020", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "98973373c39abf5c", "a80c3e5d57c540b5", "6b4bdc34dc7a5d5c" ] ] }, { "id": "a80c3e5d57c540b5", "type": "change", "z": "5a06ee696b8f9020", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "5cb64006bc7ee6f0" ] ] }, { "id": "5cb64006bc7ee6f0", "type": "ui_switch", "z": "5a06ee696b8f9020", "name": "Control", "label": "", "tooltip": "", "group": "48f0d3db269cc8f6", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "50afd4eb501dddaa", "type": "switch", "z": "5a06ee696b8f9020", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "6b4bdc34dc7a5d5c", "b59209fe9c51b965" ] ] }, { "id": "6b4bdc34dc7a5d5c", "type": "join", "z": "5a06ee696b8f9020", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "8e74c7d5fcf9da4c", "b59209fe9c51b965" ] ] }, { "id": "8e74c7d5fcf9da4c", "type": "function", "z": "5a06ee696b8f9020", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "36b9a9693b1473e5" ], [ "36b9a9693b1473e5" ] ] }, { "id": "36b9a9693b1473e5", "type": "ui_chart", "z": "5a06ee696b8f9020", "name": "Meter", "group": "48f0d3db269cc8f6", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "b59209fe9c51b965", "type": "function", "z": "5a06ee696b8f9020", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "31c6349686aa98a9" ] ] }, { "id": "31c6349686aa98a9", "type": "ui_text", "z": "5a06ee696b8f9020", "group": "48f0d3db269cc8f6", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "1439ca285e351f4f", "type": "switch", "z": "5a06ee696b8f9020", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "dae4cf5ff8b26c90" ] ] }, { "id": "dae4cf5ff8b26c90", "type": "function", "z": "5a06ee696b8f9020", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "b7d93664240803c3" ] ] }, { "id": "b7d93664240803c3", "type": "ui_timelines_chart", "z": "5a06ee696b8f9020", "group": "48f0d3db269cc8f6", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] }, { "id": "ddd3e9c60af3bdc8", "type": "tab", "label": "F-23051969-000000000016-00", "disabled": false, "info": "" }, { "id": "6dc1983bda881325", "type": "ui_group", "name": "F-23051969-000000000016-00", "tab": "71cf749113c40c7c", "order": 4, "disp": true, "width": "27", "collapse": true, "className": "" }, { "id": "af3e05a27d77424e", "type": "mqtt in", "z": "ddd3e9c60af3bdc8", "name": "", "topic": "sae/F-23051969-000000000016-00/#", "qos": "2", "datatype": "json", "broker": "c43962b6ea552bbc", "nl": false, "rap": true, "rh": 0, "inputs": 0, "x": 170, "y": 280, "wires": [ [ "932f385995ef613a", "14f968c8c05d801d", "46c455e38d0f9560", "0343f76387338cc6", "1eb1eea5801c5cb6", "4882eddfcf302a1f" ] ] }, { "id": "932f385995ef613a", "type": "switch", "z": "ddd3e9c60af3bdc8", "name": "EVChargerSocChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerSocChanged", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 40, "wires": [ [ "2713f72a4d47e860" ] ] }, { "id": "14f968c8c05d801d", "type": "switch", "z": "ddd3e9c60af3bdc8", "name": "EVChargerStateChanged", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/EVChargerStateChanged$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 100, "wires": [ [ "2713f72a4d47e860" ] ] }, { "id": "46c455e38d0f9560", "type": "switch", "z": "ddd3e9c60af3bdc8", "name": "ApplianceInfo", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/ApplianceInfo$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 160, "wires": [ [ "2713f72a4d47e860" ] ] }, { "id": "2713f72a4d47e860", "type": "join", "z": "ddd3e9c60af3bdc8", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 160, "wires": [ [ "9c9ceb7c2d0c086f" ] ] }, { "id": "9c9ceb7c2d0c086f", "type": "function", "z": "ddd3e9c60af3bdc8", "name": "prepareData", "func": "if(msg.payload.applianceInfo.type === 'EVCharger') {\n if(msg.payload.newState === 'VEHICLE_NOT_CONNECTED') {\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n }\n return {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'state', 'Wert': msg.payload.newState},\n {'Parameter': 'socCurrent', 'Wert': msg.payload.socValues?.current},\n {'Parameter': 'socInitial', 'Wert': msg.payload.socValues?.initial},\n {'Parameter': 'socInitialTime', 'Wert': msg.payload.socInitialTime},\n {'Parameter': 'socRetrieved', 'Wert': msg.payload.socValues?.retrieved},\n {'Parameter': 'socRetrievedTime', 'Wert': msg.payload.socRetrievedTime},\n {'Parameter': 'chargePower', 'Wert': msg.payload.chargePower},\n {'Parameter': 'chargeLoss', 'Wert': msg.payload.chargeLoss},\n {'Parameter': 'batteryCapacity', 'Wert': msg.payload.socValues?.batteryCapacity},\n {'Parameter': 'minPowerConsumption', 'Wert': msg.payload.applianceInfo.minPowerConsumption},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n }\n}\nreturn {\n topic: msg.topic,\n payload: [\n {'Parameter': 'name', 'Wert': msg.payload.applianceInfo.name},\n {'Parameter': 'vendor', 'Wert': msg.payload.applianceInfo.vendor},\n {'Parameter': 'typ', 'Wert': msg.payload.applianceInfo.type},\n {'Parameter': 'maxPowerConsumption', 'Wert': msg.payload.applianceInfo.maxPowerConsumption},\n {'Parameter': 'interruptionsAllowed', 'Wert': msg.payload.applianceInfo.interruptionsAllowed}\n ]\n}", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 160, "wires": [ [ "47eb01f86e87a1df" ] ] }, { "id": "47eb01f86e87a1df", "type": "ui_table", "z": "ddd3e9c60af3bdc8", "group": "6dc1983bda881325", "name": "Appliance", "order": 1, "width": 8, "height": 8, "columns": [], "outputs": 0, "cts": false, "x": 1120, "y": 160, "wires": [] }, { "id": "0343f76387338cc6", "type": "switch", "z": "ddd3e9c60af3bdc8", "name": "Control", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Control$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 220, "wires": [ [ "2713f72a4d47e860", "c39cd90b2286da7c", "3ea0bd0a33ff8a23" ] ] }, { "id": "c39cd90b2286da7c", "type": "change", "z": "ddd3e9c60af3bdc8", "name": "on", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "payload.on", "tot": "msg" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 690, "y": 220, "wires": [ [ "ad1f650672568f66" ] ] }, { "id": "ad1f650672568f66", "type": "ui_switch", "z": "ddd3e9c60af3bdc8", "name": "Control", "label": "", "tooltip": "", "group": "6dc1983bda881325", "order": 2, "width": 2, "height": 5, "passthru": true, "decouple": "false", "topic": "topic", "topicType": "msg", "style": "", "onvalue": "true", "onvalueType": "bool", "onicon": "", "oncolor": "", "offvalue": "false", "offvalueType": "bool", "officon": "", "offcolor": "", "animate": false, "className": "", "x": 1120, "y": 220, "wires": [ [] ] }, { "id": "1eb1eea5801c5cb6", "type": "switch", "z": "ddd3e9c60af3bdc8", "name": "Meter", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/Meter$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 280, "wires": [ [ "3ea0bd0a33ff8a23", "c64d2c84a8f23223" ] ] }, { "id": "3ea0bd0a33ff8a23", "type": "join", "z": "ddd3e9c60af3bdc8", "name": "", "mode": "custom", "build": "merged", "property": "payload", "propertyType": "msg", "key": "topic", "joiner": "\\n", "joinerType": "str", "accumulate": true, "timeout": "", "count": 2, "reduceRight": false, "reduceExp": "", "reduceInit": "", "reduceInitType": "", "reduceFixup": "", "x": 690, "y": 280, "wires": [ [ "fac1b8e1280213d6", "c64d2c84a8f23223" ] ] }, { "id": "fac1b8e1280213d6", "type": "function", "z": "ddd3e9c60af3bdc8", "name": "prepareData", "func": "const power = msg.payload.power;\nconst powerThreshold = msg.payload.powerThreshold;\nvar msg1 = {topic: 'Leistung', payload: !!power ? power : 0};\nvar msg2 = {topic: 'Leistungsschaltgrenze', payload: powerThreshold};\nif(powerThreshold) {\n return [msg1, msg2]; \n}\nreturn [msg1];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 280, "wires": [ [ "7ae80298ac18c21f" ], [ "7ae80298ac18c21f" ] ] }, { "id": "7ae80298ac18c21f", "type": "ui_chart", "z": "ddd3e9c60af3bdc8", "name": "Meter", "group": "6dc1983bda881325", "order": 4, "width": 9, "height": "6", "label": "Leistung", "chartType": "line", "legend": "true", "xformat": "HH:mm:ss", "interpolate": "linear", "nodata": "", "dot": false, "ymin": "0", "ymax": "", "removeOlder": "10", "removeOlderPoints": "", "removeOlderUnit": "60", "cutout": 0, "useOneColor": false, "useUTC": false, "colors": [ "#1100ff", "#ff0000", "#ff7f0e", "#ff0000", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5" ], "outputs": 1, "useDifferentColor": false, "className": "", "x": 1120, "y": 280, "wires": [ [] ] }, { "id": "c64d2c84a8f23223", "type": "function", "z": "ddd3e9c60af3bdc8", "name": "prepareData", "func": "const energyString = new Intl.NumberFormat(undefined,\n { minimumFractionDigits: 2, maximumFractionDigits: 2 }\n).format(msg.payload.energy);\n\nreturn {\n topc: msg.topic,\n payload: `${msg.payload.power} W
${energyString} kWh`\n}\n\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 340, "wires": [ [ "4f07712251513a13" ] ] }, { "id": "4f07712251513a13", "type": "ui_text", "z": "ddd3e9c60af3bdc8", "group": "6dc1983bda881325", "order": 3, "width": "2", "height": 5, "name": "Meter", "label": "", "format": "{{msg.payload}}", "layout": "row-spread", "className": "", "x": 1120, "y": 340, "wires": [] }, { "id": "4882eddfcf302a1f", "type": "switch", "z": "ddd3e9c60af3bdc8", "name": "TimeframeIntervalQueue", "property": "topic", "propertyType": "msg", "rules": [ { "t": "regex", "v": ".*\\/TimeframeIntervalQueue$", "vt": "str", "case": false } ], "checkall": "true", "repair": false, "outputs": 1, "x": 490, "y": 400, "wires": [ [ "d1a464a488932934" ] ] }, { "id": "d1a464a488932934", "type": "function", "z": "ddd3e9c60af3bdc8", "name": "generateChart", "func": "var datefns = global.get('datefns');\nconst dateFormat = 'yyyy-MM-dd HH:mm:ss';\n\nconst startDateTime = new Date().setUTCHours(0, 0, 0, 0);\nconst endDateTime = datefns.addDays(new Date(startDateTime), 2);\n\nconst optionalEntries = msg.payload.entries.filter(entry => entry.min !== null && !!entry.max && entry.min !== entry.max)\nconst optionalEnabledEntries = optionalEntries.filter(entry => entry.enabled)\nconst optionalDisabledEntries = optionalEntries.filter(entry => !entry.enabled)\n\nconst requiredEntries = msg.payload.entries.filter(entry =>\n (entry.type === 'RuntimeRequest' && entry.min === null && entry.max > 0) || entry.type === 'SocRequest');\nconst requiredEnabledEntries = requiredEntries.filter(entry => entry.enabled)\nconst requiredDisabledEntries = requiredEntries.filter(entry => !entry.enabled)\n\nconst buildOptionalDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max - entry.min\n }\n};\n\nconst buildRequiredDataItem = (entry) => {\n return {\n timeRange: [\n entry.start,\n entry.end\n ],\n val: entry.max\n }\n};\n\nreturn {\n topic: msg.topic,\n payload: {\n dataItems: [\n {\n group: \"optional\",\n data: [\n {\n label: \"disabled\",\n data: optionalDisabledEntries.map(entry => buildOptionalDataItem(entry))\n },\n {\n label: \"enabled\",\n data: optionalEnabledEntries.map(entry => buildOptionalDataItem(entry))\n }\n ]\n },\n {\n group: \"required\",\n data: [\n {\n label: \"disabled\",\n data: requiredDisabledEntries.map(entry => buildRequiredDataItem(entry))\n },\n {\n label: \"enabled\",\n data: requiredEnabledEntries.map(entry => buildRequiredDataItem(entry))\n }\n ]\n }\n ],\n settings: {\n xAxis: {\n startDateTime: datefns.format(startDateTime, dateFormat),\n endDateTime: datefns.format(endDateTime, dateFormat),\n },\n chart: {\n height: 20,\n topMargin: 0\n }\n }\n }\n}\n", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 890, "y": 400, "wires": [ [ "83f8924477e10fcc" ] ] }, { "id": "83f8924477e10fcc", "type": "ui_timelines_chart", "z": "ddd3e9c60af3bdc8", "group": "6dc1983bda881325", "name": "Timeframes", "order": 5, "label": "Timeframes", "width": "27", "height": "5", "lineColors": [ { "statusColor": "#ff0000", "statusValue": "" } ], "xTickFormat": "HH:mm", "startDateTime": "", "endDateTime": "", "maxLineHeight": 60, "xAxisLabelsFontSize": 16, "xAxisLabelslColor": "#000000", "yAxisLabelsFontSize": 16, "yAxisLabelslColor": "#000000", "resetZoomLabelFontSize": 24, "resetZoomLabelColor": "#000000", "enableAnimations": false, "enableDateMarker": false, "forwardInputMessages": false, "x": 1120, "y": 400, "wires": [ [] ] } ]