diff --git a/contrib/html/index.html b/contrib/html/index.html index 2ef13e31..06b80a92 100644 --- a/contrib/html/index.html +++ b/contrib/html/index.html @@ -134,7 +134,7 @@ jsPlumb.ready(function() { } } if (anchor.hasOwnProperty('connectWith') && needConnections) { - needConnections.push(new Array(anchUUID).concat(anchor.connectWith)); // to-circuit, to-endpoint[, item-circuit, item-name[, item-parts]] + needConnections.push(new Array(anchUUID).concat(anchor.connectWith)); // to-circuit, to-endpoint[, item-circuit, item-name[, item-format]] } var endp = instance.addEndpoint(divId, endpoint, { anchor: anchor.anchor, uuid: anchUUID, @@ -205,8 +205,8 @@ jsPlumb.ready(function() { var heat = false, water = false; var switchActions = { - broadcasthwStatus: function(fields){ - console.log("action broadcasthwStatus:"+fields); + /*"broadcast/hwcStatus": function(fields){ + console.log("action broadcast/hwcStatus:"+fields); if (!fields) return; var val = fields[0].value; if (val=='on') { @@ -227,11 +227,11 @@ jsPlumb.ready(function() { } } }, - bcStatus: function(fields) { - console.log("action bcStatus:"+fields); + "ehp/HwcHcValve": function(fields) { + console.log("action ehp/HwcHcValve:"+fields); if (!fields) return; - var val = fields[3].value; - if (val=='03 2c 00 00') { // heat + var val = fields['onoff'].value; + if (val=='off') { // heat heat = true; ehpFlow.addType("hot"); hwcFlow.removeType("hot"); @@ -248,21 +248,21 @@ jsPlumb.ready(function() { hwcReturn.removeType("cold"); } } - } + }*/ }; - var buildText = function(parts, fields) { + var buildText = function(format, fields) { var ret = ''; - if (parts) { - parts = parts.split(' '); - for (var i=0; i0) ret += ', '; - if (isNaN(parts[i])) { - if (parts[i]=='\\n') + if (format[i][0]!='$') { + if (format[i]=='\\n') ret += "
"; else - ret += parts[i]; - } else if (fields && fields.hasOwnProperty(parts[i])){ - var field = fields[parts[i]]; + ret += format[i]; + } else if (fields && fields.hasOwnProperty(format[i].substring(1))){ + var field = fields[format[i].substring(1)]; ret += field.hasOwnProperty('value')&&field.value!=null?field.value:'?'; if (field.unit) { ret += ' '+field.unit; @@ -272,7 +272,7 @@ jsPlumb.ready(function() { } } } else if (fields) { - for (var i=0; i0) ret += ', '; var field = fields[i]; ret += field.hasOwnProperty('value')&&field.value!=null?field.value:'?'; @@ -298,19 +298,23 @@ jsPlumb.ready(function() { return ret?ret[0]:null; }; var checkCondition = function(condition, allMessages) { - for (var k=0; k0) { needed = true; @@ -528,7 +532,7 @@ jsPlumb.ready(function() { continue; } each(elems, function(elem) { - elem.innerHTML = buildText(elem.getAttribute('data-parts'), fields); + elem.innerHTML = buildText(elem.getAttribute('data-format'), fields); }); } } diff --git a/contrib/html/items/broadcast.json b/contrib/html/items/broadcast.json index b49da740..b260ab72 100644 --- a/contrib/html/items/broadcast.json +++ b/contrib/html/items/broadcast.json @@ -1,10 +1,10 @@ - { +{ "title": "DCF", "bounds": [10,0,54,48], "image": "dcf.svg", "image-pos": [10, 10], "items": [ - {"name": "datetime", "parts": "0", "top": 0, "left": 1}, - {"name": "datetime", "parts": "2 1", "top": 0.45, "left": 1} + {"name": "datetime", "format": "$outsidetemp", "top": 0, "left": 1}, + {"name": "datetime", "format": "$date $time", "top": 0.45, "left": 1} ] - } +} diff --git a/contrib/html/items/ehp.json b/contrib/html/items/ehp.json index 437f2450..846d43ca 100644 --- a/contrib/html/items/ehp.json +++ b/contrib/html/items/ehp.json @@ -8,23 +8,31 @@ "title": "Quelle", "bounds": [-130,108,80,100], "endpoints": [ - {"name": "Flow", "anchor": [0.25, 0, 0, -1], "label": "Source", "connectWith": ["ehp", "SourceInput", "ehp", "SourceTempInput", "0"]}, - {"name": "Return", "anchor": [0.75, 0, 0, -1], "target": true, "label": "Source", "connectWith": ["ehp", "SourceOutput", "ehp", "SourceTempOutput", "0"]} + {"name": "Flow", "anchor": [0.25, 0, 0, -1], "label": "Source", + "connectWith": ["ehp", "SourceInput", "ehp", "SourceTempInput", "0"] + }, + {"name": "Return", "anchor": [0.75, 0, 0, -1], "target": true, "label": "Source", + "connectWith": ["ehp", "SourceOutput", "ehp", "SourceTempOutput", "0"] + } ] }, { "name": "valve", - "condition": [["ehp", "HydraulicScheme", 4, "ehp", "HydraulicScheme", 3]], + "condition": ["ehp", "HydraulicScheme", [3, 4]], "title": "Valve", "bounds": [200,16,25,31], "image": "valve.svg", "endpoints": [ - {"name": "Flow", "anchor": "Top", "target": true, "connectWith": ["ehp", "HcFlow", "ehp", "FlowTemp", "0"]}, - {"name": "HwcFlow", "anchor": "Right", "connectWith": ["storage", "HwcInput"], "update": - {"type": ["hot", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "on"]]} + {"name": "Flow", "anchor": "Top", "target": true, + "connectWith": ["ehp", "HcFlow", "ehp", "FlowTemp", "0"] }, - {"name": "HcFlow", "anchor": "Left", "connectWith": ["storage", "HcInput", "ehp", "HcFlowTemp", "0"], "update": - {"type": ["cold", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "off"]]} + {"name": "HwcFlow", "anchor": "Right", + "connectWith": ["storage", "HwcInput"], + "update": {"type": ["hot", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "on"]]} + }, + {"name": "HcFlow", "anchor": "Left", + "connectWith": ["storage", "HcInput", "ehp", "HcFlowTemp", "0"], + "update": {"type": ["cold", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "off"]]} } ], "items": [ @@ -33,7 +41,7 @@ }, { "name": "storage", - "condition": [["ehp", "HydraulicScheme", 4]], + "condition": ["ehp", "HydraulicScheme", 4], "title": "Speicher", "bounds": [390,-48,134,334], "image": "storage.svg", @@ -48,14 +56,14 @@ {"name": "HcOutput", "anchor": [0, 0.67, -1, 0]} ], "items": [ - {"circuit": "ehp", "name": "HwcTemp", "parts": "0", "topc": 0.12, "left": 0.04}, - {"circuit": "ehp", "name": "StorageTempTop", "parts": "0", "topc": 0.48, "left": 0.04}, - {"circuit": "ehp", "name": "StorageTempBottom", "parts": "0", "topc": 0.62, "left": 0.04} + {"circuit": "ehp", "name": "HwcTemp", "format": "$temp", "topc": 0.12, "left": 0.04}, + {"circuit": "ehp", "name": "StorageTempTop", "format": "$temp", "topc": 0.48, "left": 0.04}, + {"circuit": "ehp", "name": "StorageTempBottom", "format": "$temp", "topc": 0.62, "left": 0.04} ] }, { "name": "storage", - "condition": [["ehp", "HydraulicScheme", 3]], + "condition": ["ehp", "HydraulicScheme", 3], "title": "Wasserspeicher", "bounds": [390,47,134,239], "image": "buffer.svg", @@ -66,60 +74,64 @@ {"name": "HwcOutput", "anchor": [0, 0.85, -1, 0]} ], "items": [ - {"circuit": "ehp", "name": "HwcTemp", "parts": "0", "topc": 0.12, "left": 0.04} + {"circuit": "ehp", "name": "HwcTemp", "format": "$temp", "topc": 0.12, "left": 0.04} ] }, { "name": "storage", - "condition": [["ehp", "HydraulicScheme", 2]], + "condition": ["ehp", "HydraulicScheme", 2], "title": "Pufferspeicher", "bounds": [390,47,134,239], "image": "buffer.svg", "endpoints": [ {"name": "HcFlow", "anchor": [1, 0.15, 1, 0]}, - {"name": "HcInput", "anchor": [0, 0.15, -1, 0], "target": true, "connectWith": ["ehp", "HcFlow", "ehp", "FlowTemp", "0"]}, + {"name": "HcInput", "anchor": [0, 0.15, -1, 0], "target": true, + "connectWith": ["ehp", "HcFlow", "ehp", "FlowTemp", "0"] + }, {"name": "HcReturn", "anchor": [1, 0.85, 1, 0], "target": true, "distance": [0,0,0.7]}, {"name": "HcOutput", "anchor": [0, 0.85, -1, 0]} ], "items": [ - {"circuit": "ehp", "name": "StorageTempTop", "parts": "0", "topc": 0.15, "left": 0.04}, - {"circuit": "ehp", "name": "StorageTempBottom", "parts": "0", "topc": 0.85, "left": 0.04} + {"circuit": "ehp", "name": "StorageTempTop", "format": "$temp", "topc": 0.15, "left": 0.04}, + {"circuit": "ehp", "name": "StorageTempBottom", "format": "$temp", "topc": 0.85, "left": 0.04} ] } ], "endpoints": [ {"name": "SourceOutput", "anchor": [0.12, 0, 0, -1], "label": "Source", "update": - {"type": ["cold", "off"], "condition": [["ehp", "Source", "on"]]} + {"type": ["cold", "off"], "condition": ["ehp", "Source", "on"]} }, {"name": "SourceInput", "anchor": [0.22, 0, 0, -1], "target": true, "label": "Source", "distance": [0,60], "update": - {"type": ["hot", "off"], "condition": [["ehp", "Source", "on"]]} + {"type": ["hot", "off"], "condition": ["ehp", "Source", "on"]} }, - {"name": "HwcReturn", "anchor": [0.53, 0, 0, -1], "target": true, "distance": [0,80,0.3], "connectWith": ["storage", "HwcOutput"], "update": - {"type": ["hot", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "on"]]} + {"name": "HwcReturn", "anchor": [0.53, 0, 0, -1], "target": true, "distance": [0,80,0.3], + "connectWith": ["storage", "HwcOutput"], + "update": {"type": ["hot", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "on"]]} }, - {"name": "HcReturn", "anchor": [0.78, 0, 0, -1], "target": true, "distance": [0,60,0.42], "connectWith": ["storage", "HcOutput", "ehp", "HcReturnTemp", "0"], "update": - {"type": ["cold", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "off"]]} + {"name": "HcReturn", "anchor": [0.78, 0, 0, -1], "target": true, "distance": [0,60,0.42], + "connectWith": ["storage", "HcOutput", "ehp", "HcReturnTemp", "0"], + "update": {"type": ["cold", "off"], "condition": [["ehp", "Hc1Pump", "on"], ["ehp", "HwcHcValve", "off"]]} }, - {"name": "HcFlow", "anchor": [0.88, 0, 0, -1], "priority": 1, "update": - {"type": ["hot", "off"], "condition": [["ehp", "Hc1Pump", "on"]]} + {"name": "HcFlow", "anchor": [0.88, 0, 0, -1], "priority": 1, + "update": {"type": ["hot", "off"], "condition": ["ehp", "Hc1Pump", "on"]} } ], "items": [ - {"name": "SourcePress", "parts": "0", "topc": 0.2, "left": 0.01}, + {"name": "SourcePress", "format": "$press", "topc": 0.2, "left": 0.01}, {"name": "Source", "topc": 0.53, "leftc": 0.12}, - {"name": "HcPress", "parts": "0", "topc": 0.2, "left": 0.5}, + {"name": "HcPress", "format": "$press", "topc": 0.2, "left": 0.5}, {"name": "HwcHcValve", "topc": 0.4, "leftc": 0.65}, {"name": "Hc1Pump", "topc": 0.53, "leftc": 0.665}, {"name": "Backup", "topc": 0.54, "leftc": 0.9}, - {"name": "TempOutput", "parts": "0", "left": 0.2, "topc": 0.68}, - {"name": "CompPressHigh", "parts": "0", "left": 0.6, "topc": 0.68}, - {"name": "ActualEnvironmentPower", "parts": "0", "leftc": 0.12, "topc": 0.81}, + {"name": "TempOutput", "format": "$temp", "left": 0.2, "topc": 0.68}, + {"name": "CompPressHigh", "format": "$press", "left": 0.6, "topc": 0.68}, + {"name": "ActualEnvironmentPower", "leftc": 0.12, "topc": 0.81}, {"name": "Comp", "leftc": 0.5, "topc": 0.81}, {"name": "HeatPumpStatus", "left": 1, "topc": 0.81}, - {"name": "TempInput", "parts": "0", "left": 0.2, "topc": 0.94}, - {"name": "CondensorTemp", "parts": "0", "left": 0.65, "topc": 0.81}, - {"name": "CompPressLow", "parts": "0", "left": 0.6, "topc": 0.94}, - {"name": "YieldEnvironmentEnergy", "parts": "0", "left": 0, "top": 1}, - {"name": "PowerCut", "parts": "cut: 0", "left": 0.5, "top": 1} + {"name": "TempInput", "format": "$temp", "left": 0.2, "topc": 0.94}, + {"name": "CondensorTemp", "format": "$temp", "left": 0.65, "topc": 0.81}, + {"name": "CompPressLow", "format": "$press", "left": 0.6, "topc": 0.94}, + {"name": "YieldEnvironmentEnergy", "left": 0, "top": 1}, + {"name": "PowerCut", "format": "cut: $yesno", "left": 0.5, "top": 1} ] } diff --git a/contrib/html/items/hwc.json b/contrib/html/items/hwc.json index e3fed370..2a20fb93 100644 --- a/contrib/html/items/hwc.json +++ b/contrib/html/items/hwc.json @@ -1,4 +1,4 @@ - { +{ "title": "Warmwasser", "bounds": [510,40,174,52], "image": "hwc.svg", @@ -9,6 +9,6 @@ "items": [ {"name": "OperatingMode", "topc": 0.2, "left": 0.6}, {"circuit": "ehp", "name": "CirPump", "topc": 0.8, "leftc": 0.85}, - {"circuit": "cp", "name": "Mode", "parts": "1 0", "top": 1, "left": 0.6} + {"circuit": "cc", "name": "Mode", "format": "$1 $0", "top": 1, "left": 0.6} ] - } +} diff --git a/contrib/html/items/mc.4.json b/contrib/html/items/mc.4.json index 50bd00ac..1e72a77f 100644 --- a/contrib/html/items/mc.4.json +++ b/contrib/html/items/mc.4.json @@ -9,11 +9,11 @@ {"name":"HcReturn", "anchor": [1, 0.96, 1, 0]} ], "items": [ - {"name": "Status", "parts": "2", "top": 0.04, "left": 0.04}, + {"name": "Status", "format": "$2", "top": 0.04, "left": 0.04}, {"circuit": "uih", "name": "HcName4", "top": 0.25, "leftc": 0.5}, - {"name": "Mode", "parts": "1 0", "topc": 0.4, "leftc": 0.5}, + {"name": "Mode", "format": "$1 $0", "topc": 0.4, "leftc": 0.5}, {"name": "HcPumpPort", "topc": 0.56, "leftc": 0.22}, {"name": "MixerDutyCycle", "topc": 0.73, "leftc": 0.24}, - {"name": "Status", "parts": "1 0", "topc": 0.9, "leftc": 0.4} + {"name": "Status", "format": "$1 $0", "topc": 0.9, "leftc": 0.4} ] } diff --git a/contrib/html/items/rcc.4.json b/contrib/html/items/rcc.4.json index b4df05ea..3947a066 100644 --- a/contrib/html/items/rcc.4.json +++ b/contrib/html/items/rcc.4.json @@ -5,6 +5,6 @@ "image-pos": [10,0], "items": [ {"circuit": "uih", "name": "HcName4", "top": 0.1, "leftc": 0.5}, - {"name": "RoomTemp", "parts": "0", "top": 1, "left": 0} + {"name": "RoomTemp", "format": "$temp", "top": 1, "left": 0} ] } diff --git a/contrib/html/items/rcc.json b/contrib/html/items/rcc.json index b6c69ca8..fce0880d 100644 --- a/contrib/html/items/rcc.json +++ b/contrib/html/items/rcc.json @@ -5,6 +5,6 @@ "image-pos": [10,0], "items": [ {"circuit": "uih", "name": "HcName2", "top": 0.1, "leftc": 0.5}, - {"name": "RoomTemp", "parts": "0", "top": 1, "left": 0} + {"name": "RoomTemp", "format": "$temp", "top": 1, "left": 0} ] }