diff --git a/lib/NodeRED.blockly b/lib/NodeRED.blockly index d7c5dc4e067713c6823c5b5dd5e588bd149c7560..3ae2cda07067e7eb6e2caee954f0d4d1c856b3d8 100644 --- a/lib/NodeRED.blockly +++ b/lib/NodeRED.blockly @@ -6,8 +6,6 @@ <variable id="3^jP4hL~~1UKs+hYG]M=">userdata</variable> <variable id="hhN.TK}9Z.Amq=e]DZw-">flags</variable> <variable id="V3k~kS60#RI4.BDH0[[V">rc</variable> - <variable id="3D-`gs^:bq;d91pNGB~Q">mid</variable> - <variable id="ZaV?_eX!T],LP^fr(.gk">granted_qos</variable> <variable id="zwEDqCW.^v7Q(.KpQ}v6">msg</variable> <variable id="Vi2yByi.9J~-4xUDT!]k">gtyp_Setup_x_Set_Pos_Activ</variable> <variable id="#ZVIt[,H@%Ms3XJhPF7y">gtyp_Setup_i_Pos_Selection</variable> @@ -19,10 +17,10 @@ <variable id="aQ:d%c!ilWYQz|GZ5N0~">gtyp_Setup_w_Threshold_White_Red</variable> <variable id="A{`)A3~(6e.5r^y~X;S1">gtyp_Setup_w_Threshold_Red_Blue</variable> <variable id="1R^uniMizt=l7#?^bm$c">gtyp_Setup_di_Pos_Rotate</variable> - <variable id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</variable> <variable id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</variable> - <variable id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</variable> + <variable id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</variable> <variable id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</variable> + <variable id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</variable> <variable id="mvCEZ!N=009NymF/qM7c">gtyp_Setup_di_Pos_Vertical</variable> <variable id="SxENFYiA)D/cgAH0A!|E">ts</variable> <variable id="5A|5#!$f-*CkU%!}@r8|">controller_name</variable> @@ -1282,141 +1280,127 @@ <block type="util_python" id="soiv=1GYGk1x%q@maBVQ" inline="true"> <field name="value">logging.debug('1')</field> <next> - <block type="import_function_noreturn" id="M[HH9m7FQXc%HGGy.8WI" inline="true"> - <mutation parentId="3Qf0~|~$oG8z5tP{6Km;"/> - <field name="name">set_calib_data_SLD</field> - <data>3Qf0~|~$oG8z5tP{6Km;</data> + <block type="import_function_noreturn" id="mYNNZg)WPJlr:~$ufsec" inline="true"> + <mutation parentId=":J%zX-c=Y4mZAR)aLyUn"/> + <field name="name">set_calib_data_DPS</field> + <data>:J%zX-c=Y4mZAR)aLyUn</data> <value name="_data"> - <block type="import_function_return" id="(5oQM![;])v/u0pcD6MD"> - <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> - <field name="name">get_calib_data_SLD</field> - <data>b|1;0mU=wNNO2Ry{f6,Z</data> + <block type="import_function_return" id="@;JC1=}]#34K48sx$z:f"> + <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> + <field name="name">get_calib_data_DPS</field> + <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <next> - <block type="variables_set" id="WAf,+!7J@v2-:Q$D}WRy"> + <block type="variables_set" id="]U{J=*zkyz1_tdI~ahab"> <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field> <value name="VALUE"> - <block type="math_convert" id="2A;=5MiWV;K=vSUi=Py|"> - <mutation option="TO_INT"/> - <field name="OP">TO_INT</field> - <field name="BASE">10</field> - <value name="NUM"> - <block type="import_function_return" id="lBF}3ws,,6TpfF}C;_a%"> - <mutation parentId="$]uSxm9]*Qu3iZl~w~MW"/> - <field name="name">readColorValue</field> - <data>$]uSxm9]*Qu3iZl~w~MW</data> - </block> - </value> + <block type="import_function_return" id="@L.Vk]qUp2Qx=/=#/mf;"> + <mutation parentId="![`j=,+%Mnlx`Drv~HID"/> + <field name="name">readDPSColorValue</field> + <data>![`j=,+%Mnlx`Drv~HID</data> </block> </value> <next> - <block type="variables_set" id="A;mMGOnf}=G4)(mUTBXB"> - <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> + <block type="variables_set" id="#qTi4fJvDN/gHpGR,QZL"> + <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> <value name="VALUE"> - <block type="lists_getIndex" id="l8(^@0LFn@VRt!9bbB@y"> + <block type="lists_getIndex" id="XHjGd8WI?lk^D`I(D#b="> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="[.lX-%{ZA`0XE/8@wh;6"> - <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> - <field name="name">get_calib_data_SLD</field> - <data>b|1;0mU=wNNO2Ry{f6,Z</data> + <block type="import_function_return" id="sY?[vd+tT0Nu7cz+s-nI"> + <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> + <field name="name">get_calib_data_DPS</field> + <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <value name="AT"> - <block type="math_number" id="#RosQS*Pqqky0x=BGHqe"> + <block type="math_number" id="0*d]I4B_:$fDgz,^vuWz"> <field name="NUM">1</field> </block> </value> </block> </value> <next> - <block type="variables_set" id="V$q[G}}_EqKbXxUdXZ?y"> - <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> + <block type="variables_set" id="D:=f2wh[w8ZBWyd[g(7}"> + <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> <value name="VALUE"> - <block type="lists_getIndex" id="-dw.:I!+I-1Z}iqg+9wq"> + <block type="lists_getIndex" id="wdG`|Kmg=qcF]7y]s%/Y"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="BynbVL(FDhK[^6E+Y]|%"> - <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> - <field name="name">get_calib_data_SLD</field> - <data>b|1;0mU=wNNO2Ry{f6,Z</data> + <block type="import_function_return" id="nkoTt5*j.7AKXq.ht:mP"> + <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> + <field name="name">get_calib_data_DPS</field> + <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <value name="AT"> - <block type="math_number" id="xKD0g;L20Gs#1K{x-1;t"> + <block type="math_number" id="{2;D6h`S7C3wQ-4YG}9K"> <field name="NUM">2</field> </block> </value> </block> </value> <next> - <block type="mqtt_publish" id="6fC(-bBrwzAL(!f*ENq9"> + <block type="mqtt_publish" id="q*l)lLvQ+gq071=B?@^C"> <value name="name"> - <block type="variables_get" id="!8D6PQ)C0:iovvEj~?6f"> + <block type="variables_get" id="F,Y)cUZYs0lOI-L0=p.l"> <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> </block> </value> <value name="topic"> - <shadow type="text" id="h2D6M*w}QakoV=9S]vcz"> - <field name="TEXT">gtyp_SLD/w_Threshold_White_Red</field> + <shadow type="text" id=")`awz#27RX.sH,6*)B6)"> + <field name="TEXT">gtyp_SSC/w_Threshold_White_Red</field> </shadow> </value> <value name="value"> <shadow type="logic_null"/> - <block type="variables_get" id="10DmxbPw;Kh6~X?xC^@="> - <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> + <block type="variables_get" id="SGGyieKA!!R@(D$b/RSW"> + <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> </block> </value> <value name="qos"> - <shadow type="math_number" id="f=LX{[z|sxhgBKhzMc7@"> + <shadow type="math_number" id="8{srU/E?AVvW$Dd[(}l]"> <field name="NUM">2</field> </shadow> </value> <value name="retain"> - <shadow type="logic_boolean" id="CZ4g*FL?4Mk=lj62[*yr"> + <shadow type="logic_boolean" id="vXK,eAojF*2ouQ1Jd#tp"> <field name="BOOL">FALSE</field> </shadow> </value> <next> - <block type="mqtt_publish" id="StL0d;=/[ck2._O_Id.("> + <block type="mqtt_publish" id="E#Pgwk-H%6WI!+Zg@xS)"> <value name="name"> - <block type="variables_get" id="N]59T`b2jIc;_qGW2?hE"> + <block type="variables_get" id="R3n.;F-Yx`_%3T(IqW~h"> <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> </block> </value> <value name="topic"> - <shadow type="text" id="9W@f;@ZG8JRhbU#pQb%V"> - <field name="TEXT">gtyp_SLD/w_Threshold_Red_Blue</field> + <shadow type="text" id="E`^{fo{,)eHSu{:O/6.V"> + <field name="TEXT">gtyp_SSC/w_Threshold_Red_Blue</field> </shadow> </value> <value name="value"> <shadow type="logic_null"/> - <block type="variables_get" id=".$OApgnU$;Ks5QCN7=.?"> - <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> + <block type="variables_get" id="jQ}sKf~Op2Pr:-kx:TM#"> + <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> </block> </value> <value name="qos"> - <shadow type="math_number" id="P@?U|z5SZY6k/NQSSaLr"> + <shadow type="math_number" id="J#pZ^?|%;:t7Amwb9W(W"> <field name="NUM">2</field> </shadow> </value> <value name="retain"> - <shadow type="logic_boolean" id=",B[1dxL!]ME%M)JCM)@^"> + <shadow type="logic_boolean" id="_dEw,Az-T1[gzI?|=7f*"> <field name="BOOL">FALSE</field> </shadow> </value> - <next> - <block type="import_function_noreturn" id="c{=w9)lmtKb$uKpfh|f1"> - <mutation parentId="g=6%Ka9Y1qYH|_c:bu9]"/> - <field name="name">startSLD</field> - <data>g=6%Ka9Y1qYH|_c:bu9]</data> - </block> - </next> </block> </next> </block> @@ -1450,134 +1434,134 @@ <block type="util_python" id="x0s]$+:+=z@PJ!naMKFJ" inline="true"> <field name="value">logging.debug('2')</field> <next> - <block type="import_function_noreturn" id="mYNNZg)WPJlr:~$ufsec" inline="true"> - <mutation parentId=":J%zX-c=Y4mZAR)aLyUn"/> - <field name="name">set_calib_data_DPS</field> - <data>:J%zX-c=Y4mZAR)aLyUn</data> + <block type="import_function_noreturn" id="M[HH9m7FQXc%HGGy.8WI" inline="true"> + <mutation parentId="3Qf0~|~$oG8z5tP{6Km;"/> + <field name="name">set_calib_data_SLD</field> + <data>3Qf0~|~$oG8z5tP{6Km;</data> <value name="_data"> - <block type="import_function_return" id="@;JC1=}]#34K48sx$z:f"> - <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> - <field name="name">get_calib_data_DPS</field> - <data>Q9p7dhe-|x*[t`L^}||B</data> + <block type="import_function_return" id="(5oQM![;])v/u0pcD6MD"> + <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> + <field name="name">get_calib_data_SLD</field> + <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <next> - <block type="variables_set" id="]U{J=*zkyz1_tdI~ahab"> + <block type="variables_set" id="WAf,+!7J@v2-:Q$D}WRy"> <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field> <value name="VALUE"> - <block type="math_convert" id="KxHe9y`eYq8M.q;u3Qf9"> - <mutation option="TO_INT"/> - <field name="OP">TO_INT</field> - <field name="BASE">10</field> - <value name="NUM"> - <block type="import_function_return" id="@L.Vk]qUp2Qx=/=#/mf;"> - <mutation parentId="![`j=,+%Mnlx`Drv~HID"/> - <field name="name">readDPSColorValue</field> - <data>![`j=,+%Mnlx`Drv~HID</data> - </block> - </value> + <block type="import_function_return" id="lBF}3ws,,6TpfF}C;_a%"> + <mutation parentId="$]uSxm9]*Qu3iZl~w~MW"/> + <field name="name">readColorValue</field> + <data>$]uSxm9]*Qu3iZl~w~MW</data> </block> </value> <next> - <block type="variables_set" id="#qTi4fJvDN/gHpGR,QZL"> - <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> + <block type="variables_set" id="A;mMGOnf}=G4)(mUTBXB"> + <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> <value name="VALUE"> - <block type="lists_getIndex" id="XHjGd8WI?lk^D`I(D#b="> + <block type="lists_getIndex" id="l8(^@0LFn@VRt!9bbB@y"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="sY?[vd+tT0Nu7cz+s-nI"> - <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> - <field name="name">get_calib_data_DPS</field> - <data>Q9p7dhe-|x*[t`L^}||B</data> + <block type="import_function_return" id="[.lX-%{ZA`0XE/8@wh;6"> + <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> + <field name="name">get_calib_data_SLD</field> + <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <value name="AT"> - <block type="math_number" id="0*d]I4B_:$fDgz,^vuWz"> + <block type="math_number" id="#RosQS*Pqqky0x=BGHqe"> <field name="NUM">1</field> </block> </value> </block> </value> <next> - <block type="variables_set" id="D:=f2wh[w8ZBWyd[g(7}"> - <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> + <block type="variables_set" id="V$q[G}}_EqKbXxUdXZ?y"> + <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> <value name="VALUE"> - <block type="lists_getIndex" id="wdG`|Kmg=qcF]7y]s%/Y"> + <block type="lists_getIndex" id="-dw.:I!+I-1Z}iqg+9wq"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="nkoTt5*j.7AKXq.ht:mP"> - <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> - <field name="name">get_calib_data_DPS</field> - <data>Q9p7dhe-|x*[t`L^}||B</data> + <block type="import_function_return" id="BynbVL(FDhK[^6E+Y]|%"> + <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> + <field name="name">get_calib_data_SLD</field> + <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <value name="AT"> - <block type="math_number" id="{2;D6h`S7C3wQ-4YG}9K"> + <block type="math_number" id="xKD0g;L20Gs#1K{x-1;t"> <field name="NUM">2</field> </block> </value> </block> </value> <next> - <block type="mqtt_publish" id="q*l)lLvQ+gq071=B?@^C"> + <block type="mqtt_publish" id="6fC(-bBrwzAL(!f*ENq9"> <value name="name"> - <block type="variables_get" id="F,Y)cUZYs0lOI-L0=p.l"> + <block type="variables_get" id="!8D6PQ)C0:iovvEj~?6f"> <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> </block> </value> <value name="topic"> - <shadow type="text" id=")`awz#27RX.sH,6*)B6)"> - <field name="TEXT">gtyp_SSC/w_Threshold_White_Red</field> + <shadow type="text" id="h2D6M*w}QakoV=9S]vcz"> + <field name="TEXT">gtyp_SLD/w_Threshold_White_Red</field> </shadow> </value> <value name="value"> <shadow type="logic_null"/> - <block type="variables_get" id="SGGyieKA!!R@(D$b/RSW"> - <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> + <block type="variables_get" id="10DmxbPw;Kh6~X?xC^@="> + <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> </block> </value> <value name="qos"> - <shadow type="math_number" id="8{srU/E?AVvW$Dd[(}l]"> + <shadow type="math_number" id="f=LX{[z|sxhgBKhzMc7@"> <field name="NUM">2</field> </shadow> </value> <value name="retain"> - <shadow type="logic_boolean" id="vXK,eAojF*2ouQ1Jd#tp"> + <shadow type="logic_boolean" id="CZ4g*FL?4Mk=lj62[*yr"> <field name="BOOL">FALSE</field> </shadow> </value> <next> - <block type="mqtt_publish" id="E#Pgwk-H%6WI!+Zg@xS)"> + <block type="mqtt_publish" id="StL0d;=/[ck2._O_Id.("> <value name="name"> - <block type="variables_get" id="R3n.;F-Yx`_%3T(IqW~h"> + <block type="variables_get" id="N]59T`b2jIc;_qGW2?hE"> <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> </block> </value> <value name="topic"> - <shadow type="text" id="E`^{fo{,)eHSu{:O/6.V"> - <field name="TEXT">gtyp_SSC/w_Threshold_Red_Blue</field> + <shadow type="text" id="9W@f;@ZG8JRhbU#pQb%V"> + <field name="TEXT">gtyp_SLD/w_Threshold_Red_Blue</field> </shadow> </value> <value name="value"> <shadow type="logic_null"/> - <block type="variables_get" id="jQ}sKf~Op2Pr:-kx:TM#"> - <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> + <block type="variables_get" id=".$OApgnU$;Ks5QCN7=.?"> + <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> </block> </value> <value name="qos"> - <shadow type="math_number" id="J#pZ^?|%;:t7Amwb9W(W"> + <shadow type="math_number" id="P@?U|z5SZY6k/NQSSaLr"> <field name="NUM">2</field> </shadow> </value> <value name="retain"> - <shadow type="logic_boolean" id="_dEw,Az-T1[gzI?|=7f*"> + <shadow type="logic_boolean" id=",B[1dxL!]ME%M)JCM)@^"> <field name="BOOL">FALSE</field> </shadow> </value> + <next> + <block type="import_function_noreturn" id="c{=w9)lmtKb$uKpfh|f1"> + <mutation parentId="g=6%Ka9Y1qYH|_c:bu9]"/> + <field name="name">startSLD</field> + <data>g=6%Ka9Y1qYH|_c:bu9]</data> + </block> + </next> </block> </next> </block> @@ -1765,61 +1749,54 @@ <block type="util_python" id="B0@44dFH@l?Wmn}!?8@U" inline="true"> <field name="value">logging.debug('1')</field> <next> - <block type="variables_set" id="BPg6vOMOI?;C`6A+QJsT"> + <block type="variables_set" id="9*`+]6N]2vvRh5r{)qUZ"> <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field> <value name="VALUE"> - <block type="math_convert" id="$0(^:}~o#8BHH)}4$Y!`"> - <mutation option="TO_INT"/> - <field name="OP">TO_INT</field> - <field name="BASE">10</field> - <value name="NUM"> - <block type="import_function_return" id="oJ7BxBI@76/r%%ru?)v}"> - <mutation parentId="$]uSxm9]*Qu3iZl~w~MW"/> - <field name="name">readColorValue</field> - <data>$]uSxm9]*Qu3iZl~w~MW</data> - </block> - </value> + <block type="import_function_return" id="dcG_(9Wi^pI2:{/h0uN?"> + <mutation parentId="![`j=,+%Mnlx`Drv~HID"/> + <field name="name">readDPSColorValue</field> + <data>![`j=,+%Mnlx`Drv~HID</data> </block> </value> <next> - <block type="variables_set" id="1Jy`?Na^yUC3;Z|gB3c7"> - <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> + <block type="variables_set" id="!Oq+x$%5d+!s%GW^IL1)"> + <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> <value name="VALUE"> - <block type="lists_getIndex" id="~fs!uVi1E8lRO)4=5;z["> + <block type="lists_getIndex" id=":5TIrIqi]}Xb}jT@l$*w"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="}Q-$}6fTF1GYJT1Po,K,"> - <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> - <field name="name">get_calib_data_SLD</field> - <data>b|1;0mU=wNNO2Ry{f6,Z</data> + <block type="import_function_return" id="h!xFYCh(nNmH9sqSAI$I"> + <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> + <field name="name">get_calib_data_DPS</field> + <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <value name="AT"> - <block type="math_number" id="amR(f,!]|GX_?d]8_w:."> + <block type="math_number" id="a,{!zAt=;F22-Yz8L!CI"> <field name="NUM">1</field> </block> </value> </block> </value> <next> - <block type="variables_set" id="7W9V2j6i4OTDkbN?9g~C"> - <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> + <block type="variables_set" id="`DHgbw8C:@@@VX1-ZfUz"> + <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> <value name="VALUE"> - <block type="lists_getIndex" id="jgWLl%?ue-EK/xR2IF7X"> + <block type="lists_getIndex" id="ydb%=g-IQpfs)69]XP$a"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="NgJyh*u),a?oiws6P3Ve"> - <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> - <field name="name">get_calib_data_SLD</field> - <data>b|1;0mU=wNNO2Ry{f6,Z</data> + <block type="import_function_return" id=".Z=/O/yxPs..1ytF/wXZ"> + <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> + <field name="name">get_calib_data_DPS</field> + <data>Q9p7dhe-|x*[t`L^}||B</data> </block> </value> <value name="AT"> - <block type="math_number" id="{e+d,:6:KIfmj|nsK,LV"> + <block type="math_number" id="uIk7]pVcrtg=,ua0zVPi"> <field name="NUM">2</field> </block> </value> @@ -1852,61 +1829,54 @@ <block type="util_python" id="r|k1IWqLgp1fm#phq8rp" inline="true"> <field name="value">logging.debug('2')</field> <next> - <block type="variables_set" id="9*`+]6N]2vvRh5r{)qUZ"> + <block type="variables_set" id="BPg6vOMOI?;C`6A+QJsT"> <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field> <value name="VALUE"> - <block type="math_convert" id="m#f}yT6yg[=rg4z7l}r!"> - <mutation option="TO_INT"/> - <field name="OP">TO_INT</field> - <field name="BASE">10</field> - <value name="NUM"> - <block type="import_function_return" id="dcG_(9Wi^pI2:{/h0uN?"> - <mutation parentId="![`j=,+%Mnlx`Drv~HID"/> - <field name="name">readDPSColorValue</field> - <data>![`j=,+%Mnlx`Drv~HID</data> - </block> - </value> + <block type="import_function_return" id="oJ7BxBI@76/r%%ru?)v}"> + <mutation parentId="$]uSxm9]*Qu3iZl~w~MW"/> + <field name="name">readColorValue</field> + <data>$]uSxm9]*Qu3iZl~w~MW</data> </block> </value> <next> - <block type="variables_set" id="!Oq+x$%5d+!s%GW^IL1)"> - <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> + <block type="variables_set" id="1Jy`?Na^yUC3;Z|gB3c7"> + <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> <value name="VALUE"> - <block type="lists_getIndex" id=":5TIrIqi]}Xb}jT@l$*w"> + <block type="lists_getIndex" id="~fs!uVi1E8lRO)4=5;z["> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id="h!xFYCh(nNmH9sqSAI$I"> - <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> - <field name="name">get_calib_data_DPS</field> - <data>Q9p7dhe-|x*[t`L^}||B</data> + <block type="import_function_return" id="}Q-$}6fTF1GYJT1Po,K,"> + <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> + <field name="name">get_calib_data_SLD</field> + <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <value name="AT"> - <block type="math_number" id="a,{!zAt=;F22-Yz8L!CI"> + <block type="math_number" id="amR(f,!]|GX_?d]8_w:."> <field name="NUM">1</field> </block> </value> </block> </value> <next> - <block type="variables_set" id="`DHgbw8C:@@@VX1-ZfUz"> - <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> + <block type="variables_set" id="7W9V2j6i4OTDkbN?9g~C"> + <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> <value name="VALUE"> - <block type="lists_getIndex" id="ydb%=g-IQpfs)69]XP$a"> + <block type="lists_getIndex" id="jgWLl%?ue-EK/xR2IF7X"> <mutation statement="false" at="true"/> <field name="MODE">GET</field> <field name="WHERE">FROM_START</field> <value name="VALUE"> - <block type="import_function_return" id=".Z=/O/yxPs..1ytF/wXZ"> - <mutation parentId="Q9p7dhe-|x*[t`L^}||B"/> - <field name="name">get_calib_data_DPS</field> - <data>Q9p7dhe-|x*[t`L^}||B</data> + <block type="import_function_return" id="NgJyh*u),a?oiws6P3Ve"> + <mutation parentId="b|1;0mU=wNNO2Ry{f6,Z"/> + <field name="name">get_calib_data_SLD</field> + <data>b|1;0mU=wNNO2Ry{f6,Z</data> </block> </value> <value name="AT"> - <block type="math_number" id="uIk7]pVcrtg=,ua0zVPi"> + <block type="math_number" id="{e+d,:6:KIfmj|nsK,LV"> <field name="NUM">2</field> </block> </value> @@ -2166,114 +2136,114 @@ </shadow> </value> <next> - <block type="mqtt_publish" id="Tr6*L5MmGUw.AvHyamY1"> + <block type="mqtt_publish" id="]+EFhfc|)bE:M?s~.ngZ"> <value name="name"> - <block type="variables_get" id="WCtWefm``a=@t.FvV6Ac"> + <block type="variables_get" id="/rhX}@]}|@N.dEfulb@p"> <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> </block> </value> <value name="topic"> - <shadow type="text" id="F]G-gNlf!`e_U_qdumeE"> - <field name="TEXT">gtyp_SLD/w_Threshold_White_Red</field> + <shadow type="text" id=";//4DTrS)DM6*idO;]QU"> + <field name="TEXT">gtyp_SSC/w_Threshold_White_Red</field> </shadow> </value> <value name="value"> <shadow type="logic_null"/> - <block type="variables_get" id="CA*7dY|3*S+0`O#yh$UV"> - <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> + <block type="variables_get" id="PJ+D)]FK6=D!^WDu/Z|5"> + <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> </block> </value> <value name="qos"> - <shadow type="math_number" id="V-RWpnm?!B]u{GqNJAg$"> + <shadow type="math_number" id="XROfsH:uPwEr;=?ZA2BH"> <field name="NUM">2</field> </shadow> </value> <value name="retain"> - <shadow type="logic_boolean" id="=RK^F}d7d^E_mU*W(1}S"> + <shadow type="logic_boolean" id="60}wRHbBKjeDf|]~O*k`"> <field name="BOOL">FALSE</field> </shadow> </value> <next> - <block type="mqtt_publish" id="E=2htASUa2V7[.Oh1Z~g"> + <block type="mqtt_publish" id="FME^shM?U!h!^!cby}W+"> <value name="name"> - <block type="variables_get" id="E=].S3E:1;mEJj~=9fb+"> + <block type="variables_get" id="SWRJBMR,KRCD#rU;5]k_"> <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> </block> </value> <value name="topic"> - <shadow type="text" id="1=udhKnD|L.;~2$e^_#_"> - <field name="TEXT">gtyp_SLD/w_Threshold_Red_Blue</field> + <shadow type="text" id="7H2q)ld@nos)0D@g-ST{"> + <field name="TEXT">gtyp_SSC/w_Threshold_Red_Blue</field> </shadow> </value> <value name="value"> <shadow type="logic_null"/> - <block type="variables_get" id="~}pnCIq5Q%wF4(fA0fsq"> - <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> + <block type="variables_get" id="M30M^ylqg=LNn8:gZP/N"> + <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> </block> </value> <value name="qos"> - <shadow type="math_number" id="E4b)TY}~jy~SgWRG28:A"> + <shadow type="math_number" id="SsA_tZ`x^1+}(_zKjKRu"> <field name="NUM">2</field> </shadow> </value> <value name="retain"> - <shadow type="logic_boolean" id="pQnV]dxl4;W):A3rbTA4"> + <shadow type="logic_boolean" id="!*}`Y.znZ+z.oXK--9c-"> <field name="BOOL">FALSE</field> </shadow> </value> <next> - <block type="mqtt_publish" id="]+EFhfc|)bE:M?s~.ngZ"> + <block type="mqtt_publish" id="Tr6*L5MmGUw.AvHyamY1"> <value name="name"> - <block type="variables_get" id="/rhX}@]}|@N.dEfulb@p"> + <block type="variables_get" id="WCtWefm``a=@t.FvV6Ac"> <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> </block> </value> <value name="topic"> - <shadow type="text" id=";//4DTrS)DM6*idO;]QU"> - <field name="TEXT">gtyp_SSC/w_Threshold_White_Red</field> + <shadow type="text" id="F]G-gNlf!`e_U_qdumeE"> + <field name="TEXT">gtyp_SLD/w_Threshold_White_Red</field> </shadow> </value> <value name="value"> <shadow type="logic_null"/> - <block type="variables_get" id="PJ+D)]FK6=D!^WDu/Z|5"> - <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field> + <block type="variables_get" id="CA*7dY|3*S+0`O#yh$UV"> + <field name="VAR" id="x43W3)orCB:l1qw2dLN`">gtyp_SLD_w_Threshold_White_Red</field> </block> </value> <value name="qos"> - <shadow type="math_number" id="XROfsH:uPwEr;=?ZA2BH"> + <shadow type="math_number" id="V-RWpnm?!B]u{GqNJAg$"> <field name="NUM">2</field> </shadow> </value> <value name="retain"> - <shadow type="logic_boolean" id="60}wRHbBKjeDf|]~O*k`"> + <shadow type="logic_boolean" id="=RK^F}d7d^E_mU*W(1}S"> <field name="BOOL">FALSE</field> </shadow> </value> <next> - <block type="mqtt_publish" id="FME^shM?U!h!^!cby}W+"> + <block type="mqtt_publish" id="E=2htASUa2V7[.Oh1Z~g"> <value name="name"> - <block type="variables_get" id="SWRJBMR,KRCD#rU;5]k_"> + <block type="variables_get" id="E=].S3E:1;mEJj~=9fb+"> <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> </block> </value> <value name="topic"> - <shadow type="text" id="7H2q)ld@nos)0D@g-ST{"> - <field name="TEXT">gtyp_SSC/w_Threshold_Red_Blue</field> + <shadow type="text" id="1=udhKnD|L.;~2$e^_#_"> + <field name="TEXT">gtyp_SLD/w_Threshold_Red_Blue</field> </shadow> </value> <value name="value"> <shadow type="logic_null"/> - <block type="variables_get" id="M30M^ylqg=LNn8:gZP/N"> - <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</field> + <block type="variables_get" id="~}pnCIq5Q%wF4(fA0fsq"> + <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</field> </block> </value> <value name="qos"> - <shadow type="math_number" id="SsA_tZ`x^1+}(_zKjKRu"> + <shadow type="math_number" id="E4b)TY}~jy~SgWRG28:A"> <field name="NUM">2</field> </shadow> </value> <value name="retain"> - <shadow type="logic_boolean" id="!*}`Y.znZ+z.oXK--9c-"> + <shadow type="logic_boolean" id="pQnV]dxl4;W):A3rbTA4"> <field name="BOOL">FALSE</field> </shadow> </value> @@ -2485,7 +2455,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="$jNNx1Oeez9#x~eQYP}z" x="0" y="7118"> + <block type="procedures_defnoreturn" id="$jNNx1Oeez9#x~eQYP}z" x="0" y="7078"> <field name="NAME">initMQTTLocal</field> <statement name="STACK"> <block type="variables_set" id="_C*fQdBXqrGb1uUWi?_1"> @@ -2521,7 +2491,7 @@ </value> <next> <block type="util_python" id="y*1(HC~,e^b68:5|4`v7"> - <field name="value">logging.debug('-')&#10;client = mqtt.Client("mqtt_client")&#10;client.connect('127.0.0.1',2883,60)&#10;&#10;client.on_connect = on_connect&#10;client.on_disconnect = on_disconnect&#10;client.on_message=on_message&#10;client.on_publish=on_publish&#10;client.on_subscribe=on_subscribe</field> + <field name="value">logging.debug('-')&#10;client = mqtt.Client("mqtt_client")&#10;client.connect('127.0.0.1',2883,60)&#10;&#10;client.on_connect = on_connect&#10;client.on_message=on_message</field> <next> <block type="import_function_noreturn" id="rEf;pH}ofmkjjEf`W^1^" inline="true"> <mutation parentId="}I6}i4~W2r@:$%]d!jWG"/> @@ -2581,7 +2551,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="R4vMowGJ0I?IYs_!-IwU" x="0" y="7693"> + <block type="procedures_defnoreturn" id="R4vMowGJ0I?IYs_!-IwU" x="0" y="7590"> <field name="NAME">thread_MQTTLocal</field> <statement name="STACK"> <block type="util_python" id="IiRVsU4_~OPjE]@(VC;/" inline="true"> @@ -2597,7 +2567,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="8u`{W^33E#gAnZ}n#.-h" x="0" y="7953"> + <block type="procedures_defnoreturn" id="8u`{W^33E#gAnZ}n#.-h" x="0" y="7850"> <mutation> <arg name="client" varid="d2.J:01W*;j`8R0B1!GX" argid="_4Lef8L=}Do}$CNf.$X3"/> <arg name="userdata" varid="3^jP4hL~~1UKs+hYG]M=" argid=".~Cx#%[dpU*oKQFZ*1}G"/> @@ -2787,8 +2757,33 @@ </block> </value> <next> - <block type="util_python" id="-.r([o`PE}mbN5xmI=N{" inline="true"> - <field name="value">client.publish("i/broadcast", payload=payload, qos=2)</field> + <block type="mqtt_publish" id="1b393QAe[g%Ps4tXc5gG"> + <value name="name"> + <block type="variables_get" id="nShnjQG]is0)pFz+7z]H"> + <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field> + </block> + </value> + <value name="topic"> + <shadow type="text" id="lJA~}X=+K;GY*x7^w#v:"> + <field name="TEXT">i/broadcast</field> + </shadow> + </value> + <value name="value"> + <shadow type="logic_null"/> + <block type="variables_get" id="6V@6)|N9HFdW=OLp]e%7"> + <field name="VAR" id="zOwa}}!Kwpb%%^EeOYAT">payload</field> + </block> + </value> + <value name="qos"> + <shadow type="math_number" id="U]x~^jkbJ(u#(Hzj$3Iv"> + <field name="NUM">2</field> + </shadow> + </value> + <value name="retain"> + <shadow type="logic_boolean" id="AXBZC=-Kepkb@GRQ[@nC"> + <field name="BOOL">FALSE</field> + </shadow> + </value> </block> </next> </block> @@ -2810,57 +2805,7 @@ </block> </statement> </block> - <block type="procedures_defnoreturn" id="_OzPkP~3{!(`00$xIV+e" x="0" y="8743"> - <mutation> - <arg name="client" varid="d2.J:01W*;j`8R0B1!GX" argid="_4Lef8L=}Do}$CNf.$X3"/> - <arg name="userdata" varid="3^jP4hL~~1UKs+hYG]M=" argid=".~Cx#%[dpU*oKQFZ*1}G"/> - <arg name="rc" varid="V3k~kS60#RI4.BDH0[[V" argid="c7a-Nx4?]FfPRP-J(R9:"/> - </mutation> - <field name="NAME">on_disconnect</field> - <field name="_4Lef8L=}Do}$CNf.$X3">client</field> - <field name=".~Cx#%[dpU*oKQFZ*1}G">userdata</field> - <field name="c7a-Nx4?]FfPRP-J(R9:">rc</field> - <statement name="STACK"> - <block type="util_python" id="]E0R;3T.kXJ6y|-(c^T)" inline="true"> - <field name="value">if rc != 0:&#10; print("Unexpected disconnection.")</field> - </block> - </statement> - </block> - <block type="procedures_defnoreturn" id="W9;^Y=ye_P7SI[QLip%+" x="0" y="8963"> - <mutation> - <arg name="client" varid="d2.J:01W*;j`8R0B1!GX" argid="_4Lef8L=}Do}$CNf.$X3"/> - <arg name="userdata" varid="3^jP4hL~~1UKs+hYG]M=" argid=".~Cx#%[dpU*oKQFZ*1}G"/> - <arg name="mid" varid="3D-`gs^:bq;d91pNGB~Q" argid="c7a-Nx4?]FfPRP-J(R9:"/> - </mutation> - <field name="NAME">on_publish</field> - <field name="_4Lef8L=}Do}$CNf.$X3">client</field> - <field name=".~Cx#%[dpU*oKQFZ*1}G">userdata</field> - <field name="c7a-Nx4?]FfPRP-J(R9:">mid</field> - <statement name="STACK"> - <block type="util_python" id="#9?%$$m8;@O:]`u=-uEE" inline="true"> - <field name="value">#print("on_publish")</field> - </block> - </statement> - </block> - <block type="procedures_defnoreturn" id="}B,U]C!V!/l^kl:ZS,ly" x="0" y="9162"> - <mutation> - <arg name="client" varid="d2.J:01W*;j`8R0B1!GX" argid="_4Lef8L=}Do}$CNf.$X3"/> - <arg name="userdata" varid="3^jP4hL~~1UKs+hYG]M=" argid=".~Cx#%[dpU*oKQFZ*1}G"/> - <arg name="mid" varid="3D-`gs^:bq;d91pNGB~Q" argid="c7a-Nx4?]FfPRP-J(R9:"/> - <arg name="granted_qos" varid="ZaV?_eX!T],LP^fr(.gk" argid="EB-n[C7hj_$X;%5HWttB"/> - </mutation> - <field name="NAME">on_subscribe</field> - <field name="_4Lef8L=}Do}$CNf.$X3">client</field> - <field name=".~Cx#%[dpU*oKQFZ*1}G">userdata</field> - <field name="c7a-Nx4?]FfPRP-J(R9:">mid</field> - <field name="EB-n[C7hj_$X;%5HWttB">granted_qos</field> - <statement name="STACK"> - <block type="util_python" id="1Y..jneKOkE{#2y0Lh?V" inline="true"> - <field name="value">print("on_subscribe")</field> - </block> - </statement> - </block> - <block type="procedures_defnoreturn" id="a]0!I}Zd7AawL:mU%,P1" x="0" y="9389"> + <block type="procedures_defnoreturn" id="a]0!I}Zd7AawL:mU%,P1" x="0" y="8644"> <mutation> <arg name="client" varid="d2.J:01W*;j`8R0B1!GX" argid="`n4M@;+Y^Ab44Gi.YYy-"/> <arg name="userdata" varid="3^jP4hL~~1UKs+hYG]M=" argid="]gLOm[vhCT0;N+Cp[1?5"/> @@ -2872,7 +2817,7 @@ <field name="O^[],^Qz}B+EL.?Yc(#x">msg</field> <statement name="STACK"> <block type="util_python" id="lL-Iq~*MkI@+8lHz@f*K"> - <field name="value">print("Received message '" + str(msg.payload) + "' on topic '"&#10; + msg.topic + "' with QoS " + str(msg.qos))&#10;&#10;topic = msg.topic&#10;payload = msg.payload&#10;&#10;try:&#10; m_decode=str(payload.decode("utf-8","ignore"))&#10; print(m_decode)&#10; processReceivedMessage(topic, m_decode)&#10;except:&#10; pass&#10;&#10;# m_decode=str(msg.payload.decode("utf-8","ignore"))&#10;# m_in=json.loads(m_decode)&#10;# x = m_in["x"]</field> + <field name="value">#print("Received message '" + str(msg.payload) + "' on topic '" + msg.topic + "' with QoS " + str(msg.qos))&#10;&#10;topic = msg.topic&#10;payload = msg.payload&#10;&#10;try:&#10; m_decode=str(payload.decode("utf-8","ignore"))&#10; #print(m_decode)&#10; processReceivedMessage(topic, m_decode)&#10;except:&#10; pass</field> </block> </statement> </block> diff --git a/lib/NodeRED.py b/lib/NodeRED.py index 6b42e7fa513d39fb7d6a5d6a40e506035712e044..452dafd1d84707839fb84c72341299739fe5c31d 100644 --- a/lib/NodeRED.py +++ b/lib/NodeRED.py @@ -24,8 +24,6 @@ client = None userdata = None flags = None rc = None -mid = None -granted_qos = None msg = None gtyp_Setup_x_Set_Pos_Activ = None gtyp_Setup_i_Pos_Selection = None @@ -37,10 +35,10 @@ gtyp_Setup_w_Actual_ColorValue = None gtyp_Setup_w_Threshold_White_Red = None gtyp_Setup_w_Threshold_Red_Blue = None gtyp_Setup_di_Pos_Rotate = None -gtyp_SLD_w_Threshold_Red_Blue = None gtyp_SSC_w_Threshold_Red_Blue = None -gtyp_SLD_w_Threshold_White_Red = None +gtyp_SLD_w_Threshold_Red_Blue = None gtyp_SSC_w_Threshold_White_Red = None +gtyp_SLD_w_Threshold_White_Red = None gtyp_Setup_di_Pos_Vertical = None ts = None controller_name = None @@ -48,7 +46,7 @@ gtyp_Setup_di_Pos_Horizontal = None def processReceivedMessage(topic, m_decode): - global client, userdata, flags, rc, mid, granted_qos, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal logging.log(logging.TRACE0, '%s %s', topic, m_decode) if topic == 'gtyp_Setup/x_Set_Pos_Activ': logging.debug('activate') @@ -150,21 +148,21 @@ def processReceivedMessage(topic, m_decode): client.publish(topic='gtyp_Setup/w_Threshold_Red_Blue', payload=gtyp_Setup_w_Threshold_Red_Blue, qos=2, retain=False) if gtyp_Setup_i_Color_Sensor_Selection == 1: logging.debug('1') + set_calib_data_DPS(get_calib_data_DPS()) + gtyp_Setup_w_Actual_ColorValue = readDPSColorValue() + gtyp_SSC_w_Threshold_Red_Blue = (get_calib_data_DPS())[0] + gtyp_SSC_w_Threshold_White_Red = (get_calib_data_DPS())[1] + client.publish(topic='gtyp_SSC/w_Threshold_White_Red', payload=gtyp_SSC_w_Threshold_White_Red, qos=2, retain=False) + client.publish(topic='gtyp_SSC/w_Threshold_Red_Blue', payload=gtyp_SSC_w_Threshold_Red_Blue, qos=2, retain=False) + elif gtyp_Setup_i_Color_Sensor_Selection == 2: + logging.debug('2') set_calib_data_SLD(get_calib_data_SLD()) - gtyp_Setup_w_Actual_ColorValue = int(readColorValue(), 10) + gtyp_Setup_w_Actual_ColorValue = readColorValue() gtyp_SLD_w_Threshold_Red_Blue = (get_calib_data_SLD())[0] gtyp_SLD_w_Threshold_White_Red = (get_calib_data_SLD())[1] client.publish(topic='gtyp_SLD/w_Threshold_White_Red', payload=gtyp_SLD_w_Threshold_White_Red, qos=2, retain=False) client.publish(topic='gtyp_SLD/w_Threshold_Red_Blue', payload=gtyp_SLD_w_Threshold_Red_Blue, qos=2, retain=False) startSLD() - elif gtyp_Setup_i_Color_Sensor_Selection == 2: - logging.debug('2') - set_calib_data_DPS(get_calib_data_DPS()) - gtyp_Setup_w_Actual_ColorValue = int(readDPSColorValue(), 10) - gtyp_SSC_w_Threshold_Red_Blue = (get_calib_data_DPS())[0] - gtyp_SSC_w_Threshold_White_Red = (get_calib_data_DPS())[1] - client.publish(topic='gtyp_SSC/w_Threshold_White_Red', payload=gtyp_SSC_w_Threshold_White_Red, qos=2, retain=False) - client.publish(topic='gtyp_SSC/w_Threshold_Red_Blue', payload=gtyp_SSC_w_Threshold_Red_Blue, qos=2, retain=False) else: pass elif topic == 'gtyp_Setup/x_Color_Sensor_Calibration': @@ -182,14 +180,14 @@ def processReceivedMessage(topic, m_decode): gtyp_Setup_i_Color_Sensor_Selection = int(m_decode, 10) if gtyp_Setup_i_Color_Sensor_Selection == 1: logging.debug('1') - gtyp_Setup_w_Actual_ColorValue = int(readColorValue(), 10) - gtyp_SLD_w_Threshold_Red_Blue = (get_calib_data_SLD())[0] - gtyp_SLD_w_Threshold_White_Red = (get_calib_data_SLD())[1] - elif gtyp_Setup_i_Color_Sensor_Selection == 2: - logging.debug('2') - gtyp_Setup_w_Actual_ColorValue = int(readDPSColorValue(), 10) + gtyp_Setup_w_Actual_ColorValue = readDPSColorValue() gtyp_SSC_w_Threshold_Red_Blue = (get_calib_data_DPS())[0] gtyp_SSC_w_Threshold_White_Red = (get_calib_data_DPS())[1] + elif gtyp_Setup_i_Color_Sensor_Selection == 2: + logging.debug('2') + gtyp_Setup_w_Actual_ColorValue = readColorValue() + gtyp_SLD_w_Threshold_Red_Blue = (get_calib_data_SLD())[0] + gtyp_SLD_w_Threshold_White_Red = (get_calib_data_SLD())[1] else: logging.debug('none') gtyp_Setup_w_Actual_ColorValue = 0 @@ -204,10 +202,10 @@ def processReceivedMessage(topic, m_decode): client.publish(topic='gtyp_Setup/w_Calib_ColorValue_White', payload=(get_calibvalue_list())[0], qos=2, retain=False) client.publish(topic='gtyp_Setup/w_Calib_ColorValue_Red', payload=(get_calibvalue_list())[1], qos=2, retain=False) client.publish(topic='gtyp_Setup/w_Calib_ColorValue_Blue', payload=(get_calibvalue_list())[2], qos=2, retain=False) - client.publish(topic='gtyp_SLD/w_Threshold_White_Red', payload=gtyp_SLD_w_Threshold_White_Red, qos=2, retain=False) - client.publish(topic='gtyp_SLD/w_Threshold_Red_Blue', payload=gtyp_SLD_w_Threshold_Red_Blue, qos=2, retain=False) client.publish(topic='gtyp_SSC/w_Threshold_White_Red', payload=gtyp_SSC_w_Threshold_White_Red, qos=2, retain=False) client.publish(topic='gtyp_SSC/w_Threshold_Red_Blue', payload=gtyp_SSC_w_Threshold_Red_Blue, qos=2, retain=False) + client.publish(topic='gtyp_SLD/w_Threshold_White_Red', payload=gtyp_SLD_w_Threshold_White_Red, qos=2, retain=False) + client.publish(topic='gtyp_SLD/w_Threshold_Red_Blue', payload=gtyp_SLD_w_Threshold_Red_Blue, qos=2, retain=False) elif topic == 'gtyp_Setup/x_Counter_Value_Calibration': logging.debug('calibrate push out') elif topic == 'gtyp_Setup/x_Set_CounterValues': @@ -228,7 +226,7 @@ def processReceivedMessage(topic, m_decode): def initMQTTLocal(): - global topic, m_decode, client, userdata, flags, rc, mid, granted_qos, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global topic, m_decode, client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal gtyp_Setup_x_Set_Pos_Activ = 0 gtyp_Setup_i_Pos_Selection = 0 gtyp_Setup_x_Color_Sensor_Calibration = 0 @@ -238,10 +236,7 @@ def initMQTTLocal(): client.connect('127.0.0.1',2883,60) client.on_connect = on_connect - client.on_disconnect = on_disconnect client.on_message=on_message - client.on_publish=on_publish - client.on_subscribe=on_subscribe initNodeRED_HBW(client) initNodeRED_VGR(client) initNodeRED_SSC(client) @@ -249,7 +244,7 @@ def initMQTTLocal(): def thread_MQTTLocal(): - global topic, m_decode, client, userdata, flags, rc, mid, granted_qos, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global topic, m_decode, client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal logging.debug('-') #client.loop_forever() client.loop_start() @@ -258,7 +253,7 @@ def thread_MQTTLocal(): def on_connect(client, userdata, flags, rc): - global topic, m_decode, mid, granted_qos, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + global topic, m_decode, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal print("Connection returned result: "+mqtt.connack_string(rc)) client.subscribe("#") #client.subscribe("$SYS/#") @@ -271,42 +266,21 @@ def on_connect(client, userdata, flags, rc): controller_name = os.uname()[1] ts = datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z" payload = '{{"ts":"{}","hardwareId":"{}","hardwareModel":"{}","softwareName":"{}","softwareVersion":"{}","message":"{}"}}'.format(ts, controller_name, 'TXT4.0', 'FactoryCalib', display.get_attr("txt_label_version.text"), 'init') - client.publish("i/broadcast", payload=payload, qos=2) - - -def on_disconnect(client, userdata, rc): - global topic, m_decode, flags, mid, granted_qos, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal - if rc != 0: - print("Unexpected disconnection.") - - -def on_publish(client, userdata, mid): - global topic, m_decode, flags, rc, granted_qos, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal - #print("on_publish") - - -def on_subscribe(client, userdata, mid, granted_qos): - global topic, m_decode, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal - print("on_subscribe") + client.publish(topic='i/broadcast', payload=payload, qos=2, retain=False) def on_message(client, userdata, msg): - global topic, m_decode, flags, rc, mid, granted_qos, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal - print("Received message '" + str(msg.payload) + "' on topic '" - + msg.topic + "' with QoS " + str(msg.qos)) + global topic, m_decode, flags, rc, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, state_positioning, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal + #print("Received message '" + str(msg.payload) + "' on topic '" + msg.topic + "' with QoS " + str(msg.qos)) topic = msg.topic payload = msg.payload try: m_decode=str(payload.decode("utf-8","ignore")) - print(m_decode) + #print(m_decode) processReceivedMessage(topic, m_decode) except: pass - # m_decode=str(msg.payload.decode("utf-8","ignore")) - # m_in=json.loads(m_decode) - # x = m_in["x"] -