[ { "id": "103b1fd4c70bd5ad", "type": "tab", "label": "Chaudière MQTT", "disabled": false, "info": "", "env": [] }, { "id": "248a31587c7960fe", "type": "maxcube out", "z": "103b1fd4c70bd5ad", "server": "9a07e5adcaeb56f7", "singleMessage": true, "x": 220, "y": 540, "wires": [ [ "9fabcb15eb75a432", "2ebfae9701dd6b68" ] ] }, { "id": "fd3ce805ed926c80", "type": "inject", "z": "103b1fd4c70bd5ad", "name": "timer", "props": [], "repeat": "15", "crontab": "", "once": true, "onceDelay": "1", "topic": "", "x": 90, "y": 540, "wires": [ [ "248a31587c7960fe" ] ] }, { "id": "7b8330524ea2f4c4", "type": "mqtt out", "z": "103b1fd4c70bd5ad", "name": "mqtt chaudiere", "topic": "tasmota/chaudiere/cmnd/POWER", "qos": "0", "retain": "false", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "d7efe4ef4af81eb9", "x": 620, "y": 280, "wires": [] }, { "id": "9fabcb15eb75a432", "type": "function", "z": "103b1fd4c70bd5ad", "name": "compute action", "func": "var res = {};\nvar miss = 0;\nfor (const [key, value] of Object.entries(msg.payload)) {\n if (value.device_type == 3) {\n name = value.room_name.replace(\" \", \"_\");// + \"_\" + value.device_name.replace(\" \", \"_\");\n if (value.temp < value.setpoint) {\n if (value.room_name != 'WC')\n miss += value.setpoint - value.temp;\n }\n res[name] = { \"status\": \"off\" };\n }\n}\n\nvar action = null;\nif (miss <= 0.5) {\n action = 'OFF';\n}\nif (miss >= 0.9) {\n action = 'ON';\n for (const [key, value] of Object.entries(msg.payload)) {\n if (value.device_type == 3) {\n name = value.room_name.replace(\" \", \"_\");// + \"_\" + value.device_name.replace(\" \", \"_\")\n if (value.temp < value.setpoint && value.room_name != 'WC') {\n status = 'heat';\n } else {\n status = 'off';\n }\n res[name] = { \"status\": status };\n }\n }\n}\nreturn [ { 'payload': action, 'heat': miss }, { \"payload\": res } ];", "outputs": 2, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 400, "y": 300, "wires": [ [ "7b8330524ea2f4c4", "87831a7d8384ba61" ], [ "f1d30ee021d42cf6" ] ] }, { "id": "3355f9d8134bb8d5", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 590, "y": 560, "wires": [ [ "abcd09898c38c8b2", "92e0fc2670adcad8" ] ] }, { "id": "bd0c8714d97255f4", "type": "mqtt out", "z": "103b1fd4c70bd5ad", "name": "mqtt thermostat", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "d7efe4ef4af81eb9", "x": 1100, "y": 560, "wires": [] }, { "id": "abcd09898c38c8b2", "type": "function", "z": "103b1fd4c70bd5ad", "name": "config", "func": "msg.topic = 'homeassistant/climate/' + msg.payload.room_name.replace(\" \", \"_\");\nmsg.payload.config = {}\nmsg.payload.config[\"~\"] = msg.topic;\nmsg.payload.config[\"uniq_id\"] = \"maxcube_\" + msg.payload.room_name.replace(\" \", \"_\");\nmsg.payload.config[\"name\"] = \"Thermostat \" + msg.payload.room_name;\nmsg.payload.config[\"modes\"] = [ \"heat\", \"off\" ]\nmsg.payload.config[\"mode_state_topic\"] = \"~/status\";\nmsg.payload.config[\"temp_cmd_t\"] = \"~/setpoint/set\";\nmsg.payload.config[\"temp_stat_t\"] = \"~/setpoint\";\nmsg.payload.config[\"curr_temp_t\"] = \"~/temp\";\nmsg.payload.config[\"min_temp\"] = \"12\";\nmsg.payload.config[\"max_temp\"] = \"25\";\nmsg.payload.config[\"temp_step\"] = \"0.5\";\nmsg.payload.config[\"preset_modes\"] = [ \"AUTO\", \"MANUAL\", \"BOOST\" ];\nmsg.payload.config[\"preset_mode_command_topic\"] = \"~/mode/set\";\nmsg.payload.config[\"preset_mode_state_topic\"] = \"~/mode\";\ndelete msg.parts;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 710, "y": 560, "wires": [ [ "6e516fa2a5793285" ] ] }, { "id": "6e516fa2a5793285", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "key", "x": 830, "y": 560, "wires": [ [ "7ffcfab4ee726aaf" ] ] }, { "id": "7ffcfab4ee726aaf", "type": "function", "z": "103b1fd4c70bd5ad", "name": "suffix", "func": "msg.topic = msg.topic + '/' + msg.key;\ndelete msg.key;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 950, "y": 560, "wires": [ [ "bd0c8714d97255f4" ] ] }, { "id": "a9b073610ed0da42", "type": "mqtt in", "z": "103b1fd4c70bd5ad", "name": "", "topic": "", "qos": "2", "datatype": "auto", "broker": "d7efe4ef4af81eb9", "nl": false, "rap": true, "rh": 0, "inputs": 1, "x": 850, "y": 500, "wires": [ [ "e9411a4bc76c03a2" ] ] }, { "id": "92e0fc2670adcad8", "type": "function", "z": "103b1fd4c70bd5ad", "name": "subscribe", "func": "msgo = {}\nmsgo.action = 'subscribe'\nmsgo.topic = 'homeassistant/climate/' + msg.payload.room_name.replace(\" \", \"_\") + '/setpoint/set';\nvar persist = flow.get('persist', 'file');\nif (typeof persist == 'undefined') {\n persist = {};\n}\npersist[msgo.topic] = msg.payload.rf_address;\nflow.set('persist', persist, 'file');\nreturn msgo;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 720, "y": 500, "wires": [ [ "a9b073610ed0da42" ] ] }, { "id": "2ebfae9701dd6b68", "type": "function", "z": "103b1fd4c70bd5ad", "name": "decode", "func": "var res = {};\nfor (const [key, value] of Object.entries(msg.payload)) {\n if (value.device_type) {\n name = value.room_name.replace(\" \", \"_\") + \"_\" + value.device_name.replace(\" \", \"_\");\n if (!(value.device_type in res))\n res[value.device_type] = {};\n res[value.device_type][name] = value;\n }\n}\nreturn [ { \"payload\": res[1] }, { \"payload\": res[3] }, { \"payload\": res[4] }, res ];", "outputs": 4, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 380, "y": 540, "wires": [ [ "f3a618cb9b217476" ], [ "3355f9d8134bb8d5" ], [ "da37c30786c72470" ], [] ] }, { "id": "f1d30ee021d42cf6", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 590, "y": 340, "wires": [ [ "835b0a70c0092e13" ] ] }, { "id": "87ccec39faacfbcc", "type": "mqtt out", "z": "103b1fd4c70bd5ad", "name": "mqtt thermostat etat", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "d7efe4ef4af81eb9", "x": 1120, "y": 340, "wires": [] }, { "id": "835b0a70c0092e13", "type": "function", "z": "103b1fd4c70bd5ad", "name": "config", "func": "msg.topic = 'homeassistant/climate/' + msg.parts.key.replace(\" \", \"_\");\ndelete msg.parts;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 710, "y": 340, "wires": [ [ "f18cca60a898e6f9" ] ] }, { "id": "f18cca60a898e6f9", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "key", "x": 830, "y": 340, "wires": [ [ "6396fa8e0d2f7d94" ] ] }, { "id": "6396fa8e0d2f7d94", "type": "function", "z": "103b1fd4c70bd5ad", "name": "suffix", "func": "msg.topic = msg.topic + '/' + msg.key;\ndelete msg.key;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 950, "y": 340, "wires": [ [ "87ccec39faacfbcc" ] ] }, { "id": "f3a618cb9b217476", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 590, "y": 440, "wires": [ [ "8513a6b21cadce2a" ] ] }, { "id": "62f3a5b66c9cb055", "type": "mqtt out", "z": "103b1fd4c70bd5ad", "name": "mqtt valve", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "d7efe4ef4af81eb9", "x": 1090, "y": 440, "wires": [] }, { "id": "8513a6b21cadce2a", "type": "function", "z": "103b1fd4c70bd5ad", "name": "config", "func": "msg.topic = 'homeassistant/climate/' + msg.parts.key.replace(\" \", \"_\");\nmsg.payload.config = {}\nmsg.payload.config[\"~\"] = msg.topic;\nmsg.payload.config[\"uniq_id\"] = \"maxcube_valve_\" + msg.parts.key.replace(\" \", \"_\");\nmsg.payload.config[\"name\"] = \"Valve \" + msg.payload.room_name + \" / \" + msg.payload.device_name;\nmsg.payload.config[\"temp_cmd_t\"] = \"~/setpoint/set\";\nmsg.payload.config[\"temp_stat_t\"] = \"~/setpoint\";\nmsg.payload.config[\"curr_temp_t\"] = \"~/temp\";\nmsg.payload.config[\"min_temp\"] = \"12\";\nmsg.payload.config[\"max_temp\"] = \"25\";\nmsg.payload.config[\"temp_step\"] = \"0.5\";\ndelete msg.parts;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 710, "y": 440, "wires": [ [ "aa8232289a396eff" ] ] }, { "id": "aa8232289a396eff", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "key", "x": 830, "y": 440, "wires": [ [ "27fc31acdbfffe24" ] ] }, { "id": "27fc31acdbfffe24", "type": "function", "z": "103b1fd4c70bd5ad", "name": "suffix", "func": "msg.topic = msg.topic + '/' + msg.key;\ndelete msg.key;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 950, "y": 440, "wires": [ [ "62f3a5b66c9cb055" ] ] }, { "id": "da37c30786c72470", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "", "x": 590, "y": 620, "wires": [ [ "6c5e65de567ed8c2" ] ] }, { "id": "110869ca1733d7fc", "type": "mqtt out", "z": "103b1fd4c70bd5ad", "name": "mqtt window", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "d7efe4ef4af81eb9", "x": 1090, "y": 620, "wires": [] }, { "id": "6c5e65de567ed8c2", "type": "function", "z": "103b1fd4c70bd5ad", "name": "config", "func": "msg.topic = 'homeassistant/binary_sensor/' + msg.parts.key.replace(\" \", \"_\");\nmsg.payload.config = {}\nmsg.payload.config[\"~\"] = msg.topic;\nmsg.payload.config[\"uniq_id\"] = \"maxcube_\" + msg.parts.key.replace(\" \", \"_\");\nmsg.payload.config[\"name\"] = \"Contact \" + msg.payload.room_name + \" / \" + msg.payload.device_name;\nmsg.payload.config[\"state_topic\"] = \"~/open\";\nmsg.payload.config[\"device_class\"] = \"window\";\nmsg.payload.config[\"payload_off\"] = \"false\";\nmsg.payload.config[\"payload_on\"] = \"true\";\ndelete msg.parts;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 710, "y": 620, "wires": [ [ "ed64e89cb77da718" ] ] }, { "id": "ed64e89cb77da718", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "key", "x": 830, "y": 620, "wires": [ [ "034bc8bc91f49b79" ] ] }, { "id": "034bc8bc91f49b79", "type": "function", "z": "103b1fd4c70bd5ad", "name": "suffix", "func": "msg.topic = msg.topic + '/' + msg.key;\ndelete msg.key;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 950, "y": 620, "wires": [ [ "110869ca1733d7fc" ] ] }, { "id": "e9411a4bc76c03a2", "type": "function", "z": "103b1fd4c70bd5ad", "name": "get_rfaddress", "func": "var persist = flow.get('persist', 'file');\nreturn { \"payload\": { \"rf_address\": persist[msg.topic], \"degrees\": parseFloat(msg.payload), \"mode\": \"MANUAL\" } };", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 1000, "y": 500, "wires": [ [ "5991875a317f02fa" ] ] }, { "id": "5991875a317f02fa", "type": "maxcube in", "z": "103b1fd4c70bd5ad", "server": "9a07e5adcaeb56f7", "x": 1160, "y": 500, "wires": [ [ "5d446138a103fe2c" ] ] }, { "id": "5d446138a103fe2c", "type": "delay", "z": "103b1fd4c70bd5ad", "name": "", "pauseType": "delay", "timeout": "1", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 1300, "y": 500, "wires": [ [ "248a31587c7960fe" ] ] }, { "id": "87831a7d8384ba61", "type": "function", "z": "103b1fd4c70bd5ad", "name": "config", "func": "msgo = {};\nmsgo.payload = msg;\nmsgo.payload.heat = msgo.payload.heat.toFixed(1)\nmsgo.topic = 'homeassistant/sensor/maxcube_heat';\nmsgo.payload.config = {}\nmsgo.payload.config[\"~\"] = msgo.topic;\nmsgo.payload.config[\"uniq_id\"] = \"maxcube_heat\";\nmsgo.payload.config[\"name\"] = \"Chaudière Total\";\nmsgo.payload.config[\"state_topic\"] = \"~/heat\";\nmsgo.payload.config[\"unit_of_measurement\"] = \"°\";\nreturn msgo;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 590, "y": 240, "wires": [ [ "f855b4166b9fe922" ] ] }, { "id": "9288a4f985382537", "type": "mqtt out", "z": "103b1fd4c70bd5ad", "name": "mqtt chaudiere total", "topic": "", "qos": "", "retain": "", "respTopic": "", "contentType": "", "userProps": "", "correl": "", "expiry": "", "broker": "d7efe4ef4af81eb9", "x": 1020, "y": 240, "wires": [] }, { "id": "f855b4166b9fe922", "type": "split", "z": "103b1fd4c70bd5ad", "name": "", "splt": "\\n", "spltType": "str", "arraySplt": 1, "arraySpltType": "len", "stream": false, "addname": "key", "x": 730, "y": 240, "wires": [ [ "9f45cc50a1240208" ] ] }, { "id": "9f45cc50a1240208", "type": "function", "z": "103b1fd4c70bd5ad", "name": "suffix", "func": "msg.topic = msg.topic + '/' + msg.key;\ndelete msg.key;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 850, "y": 240, "wires": [ [ "9288a4f985382537" ] ] }, { "id": "29949c9d2834f922", "type": "comment", "z": "103b1fd4c70bd5ad", "name": "pilotage chaudière", "info": "cette section est reservée au pilotage de la chaudière. elle fait le total du nombre de degrés manquant dans chacune des pièces et allume la chaudière si ce total dépasse un certain seuil et éteint la chaudière en dessous d'un autre seuil.\nils sont par défaut à 0.9 et 0.5.", "x": 410, "y": 260, "wires": [] }, { "id": "af681e641dcfc3b7", "type": "comment", "z": "103b1fd4c70bd5ad", "name": "pilotage domotique", "info": "cette section envoie en mqtt tout les devices maxcube", "x": 410, "y": 480, "wires": [] }, { "id": "9a07e5adcaeb56f7", "type": "maxcube-server", "host": "10.68.69.120", "port": "62910", "disabled": false }, { "id": "d7efe4ef4af81eb9", "type": "mqtt-broker", "name": "MQTT", "broker": "mqtt", "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": "" } ]