Jutta-Proto / protocol-cpp

C++ JURA protocol implementation for controlling a Jura coffee maker over a serial (UART) connection.
GNU General Public License v3.0
64 stars 6 forks source link

Coffee Brewing Sequence. Node-Red Implementation #10

Open PascalW123 opened 1 year ago

PascalW123 commented 1 year ago

Hello,

I am trying to implement your Custom Coffee Brewing Sequence into a Node-Red Flow for a Jura E6 as well. Pressing the Buttons to Brew the Coffee Works fine but with the Custom Brewing Sequence I run into timing issues. I was unable to fully understand how you implemented your with the method write_and_wait. How do you know how long you need to wait after each step, i.E. Brew Group into Position.

Is this something you might be able to assist with? Below I have attached the JSON for of the Node-Red flow.

[ { "id": "2ce0f4a61d7f5eec", "type": "tab", "label": "Flow 2", "disabled": false, "info": "", "env": [] }, { "id": "05a27f5671fa28c3", "type": "serial out", "z": "2ce0f4a61d7f5eec", "name": "", "serial": "43003fd5.a314f", "x": 850, "y": 220, "wires": [] }, { "id": "6665c0024bb6ed87", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "obfuscation", "func": "var temp = msg.payload;\nvar arr = [];\nfor (var i=0; i < temp.length; i++){\n var char_temp = temp[i].charCodeAt(0).toString(2);\n for (var a=0; a<8;a++){\n if (char_temp.length != 8){\n char_temp = \"0\" + char_temp;\n }\n }\n var temp1 = [\"0\",\"1\",char_temp[6],\"1\",\"1\",char_temp[7],\"1\",\"1\"];\n var temp2 = [\"0\",\"1\",char_temp[4],\"1\",\"1\",char_temp[5],\"1\",\"1\"];\n var temp3 = [\"0\",\"1\",char_temp[2],\"1\",\"1\",char_temp[3],\"1\",\"1\"];\n var temp4 = [\"0\",\"1\",char_temp[0],\"1\",\"1\",char_temp[1],\"1\",\"1\"];\n arr.push(parseInt(temp1.join(\"\"),2),parseInt(temp2.join(\"\"),2),parseInt(temp3.join(\"\"),2),parseInt(temp4.join(\"\"),2));\n}\narr.push(95,127,91,91,123,123,91,91)\nmsg.payload = arr;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 530, "y": 220, "wires": [ [ "e2e40a69afddb0ef" ] ] }, { "id": "e2e40a69afddb0ef", "type": "buffer-maker", "z": "2ce0f4a61d7f5eec", "name": "", "specification": "spec", "specificationType": "ui", "items": [ { "name": "item1", "type": "int8", "length": 28, "dataType": "msg", "data": "payload" } ], "swap1": "", "swap2": "", "swap3": "", "swap1Type": "swap", "swap2Type": "swap", "swap3Type": "swap", "msgProperty": "payload", "msgPropertyType": "str", "x": 690, "y": 220, "wires": [ [ "05a27f5671fa28c3" ] ] }, { "id": "ccc498a275ae5f6c", "type": "inject", "z": "2ce0f4a61d7f5eec", "name": "Knopf oben links", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "FA:04", "payloadType": "str", "x": 200, "y": 100, "wires": [ [ "6665c0024bb6ed87" ] ] }, { "id": "30545ebab90e17c8", "type": "inject", "z": "2ce0f4a61d7f5eec", "name": "Knopf mitte links", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "FA:05", "payloadType": "str", "x": 200, "y": 140, "wires": [ [ "6665c0024bb6ed87" ] ] }, { "id": "231bc6ada5d8354e", "type": "inject", "z": "2ce0f4a61d7f5eec", "name": "Knopf unten links", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "FA:06", "payloadType": "str", "x": 200, "y": 180, "wires": [ [ "6665c0024bb6ed87" ] ] }, { "id": "899c064ccd1cb369", "type": "inject", "z": "2ce0f4a61d7f5eec", "name": "Knopf oben rechts", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "FA:07", "payloadType": "str", "x": 210, "y": 220, "wires": [ [ "6665c0024bb6ed87" ] ] }, { "id": "3e6e554e0a130652", "type": "inject", "z": "2ce0f4a61d7f5eec", "name": "Knopf mitte rechts", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "FA:08", "payloadType": "str", "x": 210, "y": 260, "wires": [ [ "6665c0024bb6ed87" ] ] }, { "id": "e03e245c2ae1b643", "type": "inject", "z": "2ce0f4a61d7f5eec", "name": "Knopf unten rechts", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "FA:09", "payloadType": "str", "x": 210, "y": 300, "wires": [ [ "6665c0024bb6ed87" ] ] }, { "id": "5aa3583d4f51c00d", "type": "inject", "z": "2ce0f4a61d7f5eec", "name": "Knopf unten rechts", "props": [ { "p": "payload" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "TY:", "payloadType": "str", "x": 210, "y": 340, "wires": [ [ "6665c0024bb6ed87" ] ] }, { "id": "ed60884f3a883465", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Kaffee mahlen Start", "func": "msg.payload = \"FN:07\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 310, "y": 540, "wires": [ [ "e1d706e3b3d8d5b6", "455a59053f025b43" ] ] }, { "id": "e1d706e3b3d8d5b6", "type": "delay", "z": "2ce0f4a61d7f5eec", "name": "Sleep 3 Sekunden", "pauseType": "delay", "timeout": "3", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "allowrate": false, "outputs": 1, "x": 570, "y": 540, "wires": [ [ "99d2afd936b8ad2e" ] ] }, { "id": "07b7c01d1e0e0762", "type": "inject", "z": "2ce0f4a61d7f5eec", "name": "", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 140, "y": 500, "wires": [ [ "ed60884f3a883465" ] ] }, { "id": "99d2afd936b8ad2e", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Kaffee mahlen Stop", "func": "msg.payload = \"FN:08\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 310, "y": 580, "wires": [ [ "14c6014a28de7111", "455a59053f025b43" ] ] }, { "id": "5a79e91ebf32e96d", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Brühgruppe in Position", "func": "msg.payload = \"FN:22\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 300, "y": 620, "wires": [ [ "62e2d5a2dca234b2", "455a59053f025b43" ] ] }, { "id": "14be57fe7108f0f3", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Presse an", "func": "msg.payload = \"FN:0B\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 340, "y": 660, "wires": [ [ "df6508883784272d", "455a59053f025b43" ] ] }, { "id": "df6508883784272d", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 660, "wires": [ [ "29033123216d3e21" ] ] }, { "id": "29033123216d3e21", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Presse aus", "func": "msg.payload = \"FN:0C\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 700, "wires": [ [ "5bae09d24a11faa3", "455a59053f025b43" ] ] }, { "id": "8625bd87307b2f58", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Heizen an", "func": "msg.payload = \"FN:03\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 340, "y": 740, "wires": [ [ "e282038d53de0aee", "455a59053f025b43" ] ] }, { "id": "57a481991ed3b32e", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Pumpe an", "func": "msg.payload = \"FN:01\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 780, "wires": [ [ "86bf0e6dee6a64b2", "455a59053f025b43" ] ] }, { "id": "86bf0e6dee6a64b2", "type": "delay", "z": "2ce0f4a61d7f5eec", "name": "", "pauseType": "delay", "timeout": "2", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "outputs": 1, "x": 560, "y": 780, "wires": [ [ "634e4d952b8c1a49" ] ] }, { "id": "634e4d952b8c1a49", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Pumpe aus", "func": "msg.payload = \"FN:02\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 820, "wires": [ [ "dc67c6bb3ef7ab96", "455a59053f025b43" ] ] }, { "id": "5aa37bb6a4175aff", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Heizen aus", "func": "msg.payload = \"FN:04\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 860, "wires": [ [ "64d2c34ae26fa35a", "455a59053f025b43" ] ] }, { "id": "64d2c34ae26fa35a", "type": "delay", "z": "2ce0f4a61d7f5eec", "name": "", "pauseType": "delay", "timeout": "2", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "outputs": 1, "x": 560, "y": 860, "wires": [ [ "7a2a86d7819462ab" ] ] }, { "id": "7a2a86d7819462ab", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Heizen an", "func": "msg.payload = \"FN:03\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 340, "y": 900, "wires": [ [ "455a59053f025b43", "d7caffe6ab9213ab" ] ] }, { "id": "39ea942247d64661", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Pumpe an", "func": "msg.payload = \"FN:01\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 940, "wires": [ [ "da09aaf17531ca3f", "455a59053f025b43" ] ] }, { "id": "da09aaf17531ca3f", "type": "delay", "z": "2ce0f4a61d7f5eec", "name": "", "pauseType": "delay", "timeout": "40", "timeoutUnits": "seconds", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "outputs": 1, "x": 570, "y": 940, "wires": [ [ "959314ce897a5e0c" ] ] }, { "id": "959314ce897a5e0c", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Pumpe aus", "func": "msg.payload = \"FN:02\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 980, "wires": [ [ "455a59053f025b43", "78dd45246f50b17a" ] ] }, { "id": "3e293c2aec5bef4e", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Heizen aus", "func": "msg.payload = \"FN:04\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 330, "y": 1020, "wires": [ [ "455a59053f025b43", "37c90c15be6d8107" ] ] }, { "id": "5c94fb3c936b0c49", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "Reset", "func": "msg.payload = \"FN:0D\"\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 350, "y": 1060, "wires": [ [ "455a59053f025b43" ] ] }, { "id": "14c6014a28de7111", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 580, "wires": [ [ "5a79e91ebf32e96d" ] ] }, { "id": "62e2d5a2dca234b2", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 620, "wires": [ [ "14be57fe7108f0f3" ] ] }, { "id": "5bae09d24a11faa3", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 700, "wires": [ [ "8625bd87307b2f58" ] ] }, { "id": "e282038d53de0aee", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 740, "wires": [ [ "57a481991ed3b32e" ] ] }, { "id": "dc67c6bb3ef7ab96", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 820, "wires": [ [ "5aa37bb6a4175aff" ] ] }, { "id": "455a59053f025b43", "type": "link out", "z": "2ce0f4a61d7f5eec", "name": "link out 3", "mode": "link", "links": [ "829761971f44a058" ], "x": 495, "y": 440, "wires": [] }, { "id": "d7caffe6ab9213ab", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 900, "wires": [ [ "39ea942247d64661" ] ] }, { "id": "78dd45246f50b17a", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 980, "wires": [ [ "3e293c2aec5bef4e" ] ] }, { "id": "37c90c15be6d8107", "type": "delay", "z": "2ce0f4a61d7f5eec", "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": 560, "y": 1020, "wires": [ [ "5c94fb3c936b0c49" ] ] }, { "id": "546cc0a3daa30852", "type": "buffer-maker", "z": "2ce0f4a61d7f5eec", "name": "", "specification": "spec", "specificationType": "ui", "items": [ { "name": "item1", "type": "int8", "length": 28, "dataType": "msg", "data": "payload" } ], "swap1": "", "swap2": "", "swap3": "", "swap1Type": "swap", "swap2Type": "swap", "swap3Type": "swap", "msgProperty": "payload", "msgPropertyType": "str", "x": 1010, "y": 440, "wires": [ [ "1397c3ce0d9d6354" ] ] }, { "id": "1397c3ce0d9d6354", "type": "serial out", "z": "2ce0f4a61d7f5eec", "name": "", "serial": "43003fd5.a314f", "x": 1170, "y": 440, "wires": [] }, { "id": "be3d2f0286575a64", "type": "function", "z": "2ce0f4a61d7f5eec", "name": "obfuscation", "func": "var temp = msg.payload;\nvar arr = [];\nfor (var i=0; i < temp.length; i++){\n var char_temp = temp[i].charCodeAt(0).toString(2);\n for (var a=0; a<8;a++){\n if (char_temp.length != 8){\n char_temp = \"0\" + char_temp;\n }\n }\n var temp1 = [\"0\",\"1\",char_temp[6],\"1\",\"1\",char_temp[7],\"1\",\"1\"];\n var temp2 = [\"0\",\"1\",char_temp[4],\"1\",\"1\",char_temp[5],\"1\",\"1\"];\n var temp3 = [\"0\",\"1\",char_temp[2],\"1\",\"1\",char_temp[3],\"1\",\"1\"];\n var temp4 = [\"0\",\"1\",char_temp[0],\"1\",\"1\",char_temp[1],\"1\",\"1\"];\n arr.push(parseInt(temp1.join(\"\"),2),parseInt(temp2.join(\"\"),2),parseInt(temp3.join(\"\"),2),parseInt(temp4.join(\"\"),2));\n}\narr.push(95,127,91,91,123,123,91,91)\nmsg.payload = arr;\nreturn msg;", "outputs": 1, "noerr": 0, "initialize": "", "finalize": "", "libs": [], "x": 850, "y": 440, "wires": [ [ "546cc0a3daa30852" ] ] }, { "id": "829761971f44a058", "type": "link in", "z": "2ce0f4a61d7f5eec", "name": "link in 2", "links": [ "455a59053f025b43", "dfd686287282cb4e" ], "x": 735, "y": 440, "wires": [ [ "be3d2f0286575a64" ] ] }, { "id": "43003fd5.a314f", "type": "serial-port", "serialport": "/dev/serial0", "serialbaud": "9600", "databits": "8", "parity": "none", "stopbits": "1", "waitfor": "", "dtr": "none", "rts": "none", "cts": "none", "dsr": "none", "newline": "", "bin": "bin", "out": "char", "addchar": "", "responsetimeout": "10000" } ]