From 49a3b24df3c21481d14f64db11d7d282118dc8b9 Mon Sep 17 00:00:00 2001 From: ODSMarcus <17219291+ODSMarcus@users.noreply.github.com> Date: Mon, 5 Jul 2021 23:23:43 -0400 Subject: [PATCH] Allow the toggle of the front heat pump unit Some units (primarily Vanleigh RVs) may not have a front Heat Pump or it may be moved to a new location in the coach --- .../files/configurator/cp_config.pl | 5 + .../flows_coachproxy-template.json | 162 ++++++++++++++---- 2 files changed, 137 insertions(+), 30 deletions(-) diff --git a/roles/coachproxy/files/configurator/cp_config.pl b/roles/coachproxy/files/configurator/cp_config.pl index 7607641..d3d7f85 100755 --- a/roles/coachproxy/files/configurator/cp_config.pl +++ b/roles/coachproxy/files/configurator/cp_config.pl @@ -201,6 +201,11 @@ sub create_habridge_device { } else { push @tags, '/furn1-spacer/'; } + if ($configs{'frontheat'} ne 'true') { + push @tags, '/heatpump0/'; # Delete heat pump button + } else { + push @tags, '/heatpump0-spacer/'; # Delete heat pump spacer + } if ($configs{'midheat'} ne 'true') { push @tags, '/heatpump1/'; # Delete heat pump button } else { diff --git a/roles/coachproxy/files/configurator/flows_coachproxy-template.json b/roles/coachproxy/files/configurator/flows_coachproxy-template.json index 0fcf317..54b3e07 100644 --- a/roles/coachproxy/files/configurator/flows_coachproxy-template.json +++ b/roles/coachproxy/files/configurator/flows_coachproxy-template.json @@ -5871,7 +5871,7 @@ "name": "", "label": "Third Air Conditioner Zone", "group": "dd373808.7ec1d8", - "order": 8, + "order": 9, "width": 0, "height": 0, "passthru": true, @@ -5991,7 +5991,7 @@ "name": "", "label": "Second Furnace Zone", "group": "dd373808.7ec1d8", - "order": 9, + "order": 10, "width": 0, "height": 0, "passthru": true, @@ -6175,7 +6175,7 @@ "type": "function", "z": "f6c367c2.63b9b8", "name": "Set TV Lift", - "func": "// Populate the \"TV Lift\" toggle based on the chosen model.\n\nvar tvlift = ['37_BH', '40_IH', '44_OH', '45_MP', '45_OPP', '45_PZ'];\nvar msg = { topic: '', payload: '' };\n\nmsg.payload = tvlift.includes(flow.get('floorplan'));\n\nreturn msg;", + "func": "// Populate the \"TV Lift\" toggle based on the chosen model.\n\nvar tvlift = ['37_BH', '40_IH', '44_OH', '45_MP', '45_OPP', '45_PZ', '385_RD', '42_RDB'];\nvar msg = { topic: '', payload: '' };\n\nmsg.payload = tvlift.includes(flow.get('floorplan'));\n\nreturn msg;", "outputs": 1, "noerr": 0, "x": 510, @@ -6664,7 +6664,7 @@ "type": "function", "z": "f6c367c2.63b9b8", "name": "Save to Database", - "func": "// Save the global config settings to the database\n\nvar msgs = []; // An array of database query messages\n\nfor (var item of ['year', 'model', 'floorplan', 'aquahot', 'floorheat', 'ceilfan', 'tvlift', 'thirdtstat', 'secondfurnace', 'midheat', 'rearheat', 'busundercoach', 'powerbed', 'shades_interior']) {\n var newmsg = {};\n newmsg.topic = 'INSERT OR REPLACE INTO configs (key, value) VALUES(?, ?)';\n newmsg.payload = [item, String(flow.get(item))];\n msgs.push(newmsg);\n}\n\nreturn [msgs, {payload: 'Saving changes...'}];", + "func": "// Save the global config settings to the database\n\nvar msgs = []; // An array of database query messages\n\nfor (var item of ['year', 'model', 'floorplan', 'aquahot', 'floorheat', 'ceilfan', 'tvlift', 'thirdtstat', 'secondfurnace', 'frontheat', 'midheat', 'rearheat', 'busundercoach', 'powerbed', 'shades_interior']) {\n var newmsg = {};\n newmsg.topic = 'INSERT OR REPLACE INTO configs (key, value) VALUES(?, ?)';\n newmsg.payload = [item, String(flow.get(item))];\n msgs.push(newmsg);\n}\n\nreturn [msgs, {payload: 'Saving changes...'}];", "outputs": 2, "noerr": 0, "x": 1070, @@ -7594,7 +7594,7 @@ "name": "", "label": "Mid Zone Heat Pump", "group": "dd373808.7ec1d8", - "order": 10, + "order": 12, "width": 0, "height": 0, "passthru": true, @@ -7624,7 +7624,7 @@ "name": "", "label": "Rear Zone Heat Pump", "group": "dd373808.7ec1d8", - "order": 11, + "order": 13, "width": 0, "height": 0, "passthru": true, @@ -7701,13 +7701,92 @@ ] ] }, + { + "id": "d5161853.26c588", + "type": "change", + "z": "f6c367c2.63b9b8", + "name": "Set Saved Front Heat Pump", + "rules": [ + { + "t": "set", + "p": "payload", + "pt": "msg", + "to": "payload.frontheat = 'true'", + "tot": "jsonata" + } + ], + "action": "", + "property": "", + "from": "", + "to": "", + "reg": false, + "x": 460, + "y": 1120, + "wires": [ + [ + "5788c0d8.42cb8" + ] + ] + }, + { + "id": "e953ecbb.7cb86", + "type": "function", + "z": "f6c367c2.63b9b8", + "name": "Set Front Heat Pump", + "func": "var front_hp = ['Phaeton', 'Allegro_Bus', 'Zephyr', 'VanLeigh_Vilano', 'VanLeigh_Beacon'];\nvar msg = { topic: '', payload: '', enabled: true };\n\nif (flow.get('model')) {\n if (front_hp.includes(flow.get('model'))) {\n msg.payload = true;\n }\n}\n\nif (flow.get('year') < 2018 && flow.get('model').substr(0,8) != 'VanLeigh') {\n msg.enabled = false;\n msg.payload = false;\n}\n\nreturn msg;", + "outputs": 1, + "noerr": 0, + "initialize": "", + "finalize": "", + "libs": [], + "x": 480, + "y": 1160, + "wires": [ + [ + "5788c0d8.42cb8" + ] + ] + }, + { + "id": "5788c0d8.42cb8", + "type": "ui_switch", + "z": "f6c367c2.63b9b8", + "name": "", + "label": "Front Zone Heat Pump", + "tooltip": "", + "group": "dd373808.7ec1d8", + "order": 11, + "width": 0, + "height": 0, + "passthru": true, + "decouple": "false", + "topic": "frontheat", + "topicType": "str", + "style": "", + "onvalue": "true", + "onvalueType": "bool", + "onicon": "", + "oncolor": "", + "offvalue": "false", + "offvalueType": "bool", + "officon": "", + "offcolor": "", + "animate": true, + "x": 800, + "y": 1140, + "wires": [ + [ + "4f256116.a0922" + ] + ] + }, { "id": "176c91be.746e3e", "type": "ui_template", "z": "f6c367c2.63b9b8", "group": "dd373808.7ec1d8", "name": "Config HVAC Header", - "order": 7, + "order": 8, "width": "6", "height": "1", "format": "