diff --git a/lib/NodeRED.blockly b/lib/NodeRED.blockly
index 6efa6aa5ec567f51464364ccbf3e7f6211a35989..a075f085f2135fdb543fa428c9fee52030ee55b4 100644
--- a/lib/NodeRED.blockly
+++ b/lib/NodeRED.blockly
@@ -18,10 +18,10 @@
     <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="-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="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</variable>
-    <variable id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</variable>
     <variable id="mvCEZ!N=009NymF/qM7c">gtyp_Setup_di_Pos_Vertical</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="SxENFYiA)D/cgAH0A!|E">ts</variable>
     <variable id="5A|5#!$f-*CkU%!}@r8|">controller_name</variable>
     <variable id="_zze=bLQ.syYiP?$h%sl">gtyp_Setup_di_Pos_Horizontal</variable>
@@ -29,7 +29,7 @@
   <block type="util_python_imports" id="l-w#:2(*$u(EYdsy=A93" x="0" y="0">
     <field name="value">#TXT FW 3.1.0: https://pypi.org/project/paho-mqtt/1.3.1/&amp;#10;&amp;#10;import paho.mqtt.client as mqtt&amp;#10;import json&amp;#10;from datetime import datetime&amp;#10;import logging</field>
   </block>
-  <block type="procedures_defnoreturn" id="qn*eC1u~xJda3N0eHbi7" x="0" y="206">
+  <block type="procedures_defnoreturn" id="qn*eC1u~xJda3N0eHbi7" x="0" y="213">
     <field name="NAME">thread_updateColorValue</field>
     <statement name="STACK">
       <block type="loop_endless" id="n7hjG.$:dLO^J{Rt!}hz">
@@ -175,7 +175,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id=")uU.pE+gxp-xV{l06;]^" x="0" y="651">
+  <block type="procedures_defnoreturn" id=")uU.pE+gxp-xV{l06;]^" x="0" y="669">
     <mutation>
       <arg name="topic" varid="J0n.(S2c_J^ul.Ya```o" argid="o[hL6u/X-Hh$Q2+P#$+Z"/>
       <arg name="m_decode" varid="tfig7HBYbEq22iBgastC" argid="Hbe2WDx-@,*Wg@:(`|^."/>
@@ -1568,63 +1568,72 @@
                                                           </block>
                                                         </value>
                                                         <next>
-                                                          <block type="mqtt_publish" id="q*l)lLvQ+gq071=B?@^C">
-                                                            <value name="name">
-                                                              <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=")`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="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="8{srU/E?AVvW$Dd[(}l]">
-                                                                <field name="NUM">2</field>
-                                                              </shadow>
-                                                            </value>
-                                                            <value name="retain">
-                                                              <shadow type="logic_boolean" id="vXK,eAojF*2ouQ1Jd#tp">
+                                                          <block type="controls_if" id="X=}ePX3dRW%fJa5h8JpE">
+                                                            <value name="IF0">
+                                                              <block type="logic_boolean" id="R#_Z,4T5WxB:,jRh|}fe">
                                                                 <field name="BOOL">FALSE</field>
-                                                              </shadow>
+                                                              </block>
                                                             </value>
-                                                            <next>
-                                                              <block type="mqtt_publish" id="E#Pgwk-H%6WI!+Zg@xS)">
+                                                            <statement name="DO0">
+                                                              <block type="mqtt_publish" id="q*l)lLvQ+gq071=B?@^C">
                                                                 <value name="name">
-                                                                  <block type="variables_get" id="R3n.;F-Yx`_%3T(IqW~h">
+                                                                  <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="E`^{fo{,)eHSu{:O/6.V">
-                                                                    <field name="TEXT">gtyp_SSC/w_Threshold_Red_Blue</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="jQ}sKf~Op2Pr:-kx:TM#">
-                                                                    <field name="VAR" id="TZ7zEdrg=Q,vG9XutiCF">gtyp_SSC_w_Threshold_Red_Blue</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="J#pZ^?|%;:t7Amwb9W(W">
+                                                                  <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="_dEw,Az-T1[gzI?|=7f*">
+                                                                  <shadow type="logic_boolean" id="vXK,eAojF*2ouQ1Jd#tp">
                                                                     <field name="BOOL">FALSE</field>
                                                                   </shadow>
                                                                 </value>
+                                                                <next>
+                                                                  <block type="mqtt_publish" id="E#Pgwk-H%6WI!+Zg@xS)">
+                                                                    <value name="name">
+                                                                      <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="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="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="J#pZ^?|%;:t7Amwb9W(W">
+                                                                        <field name="NUM">2</field>
+                                                                      </shadow>
+                                                                    </value>
+                                                                    <value name="retain">
+                                                                      <shadow type="logic_boolean" id="_dEw,Az-T1[gzI?|=7f*">
+                                                                        <field name="BOOL">FALSE</field>
+                                                                      </shadow>
+                                                                    </value>
+                                                                  </block>
+                                                                </next>
                                                               </block>
-                                                            </next>
+                                                            </statement>
                                                           </block>
                                                         </next>
                                                       </block>
@@ -1718,63 +1727,72 @@
                                                           </block>
                                                         </value>
                                                         <next>
-                                                          <block type="mqtt_publish" id="6fC(-bBrwzAL(!f*ENq9">
-                                                            <value name="name">
-                                                              <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="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="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="f=LX{[z|sxhgBKhzMc7@">
-                                                                <field name="NUM">2</field>
-                                                              </shadow>
-                                                            </value>
-                                                            <value name="retain">
-                                                              <shadow type="logic_boolean" id="CZ4g*FL?4Mk=lj62[*yr">
+                                                          <block type="controls_if" id="`X7QX^^=:PLG2CHMA6a:">
+                                                            <value name="IF0">
+                                                              <block type="logic_boolean" id=")u:lZ@r%^v)K:Bz]:sJ#">
                                                                 <field name="BOOL">FALSE</field>
-                                                              </shadow>
+                                                              </block>
                                                             </value>
-                                                            <next>
-                                                              <block type="mqtt_publish" id="StL0d;=/[ck2._O_Id.(">
+                                                            <statement name="DO0">
+                                                              <block type="mqtt_publish" id="6fC(-bBrwzAL(!f*ENq9">
                                                                 <value name="name">
-                                                                  <block type="variables_get" id="N]59T`b2jIc;_qGW2?hE">
+                                                                  <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="9W@f;@ZG8JRhbU#pQb%V">
-                                                                    <field name="TEXT">gtyp_SLD/w_Threshold_Red_Blue</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=".$OApgnU$;Ks5QCN7=.?">
-                                                                    <field name="VAR" id="z}xxgCaN^$Fn.vEFUV}F">gtyp_SLD_w_Threshold_Red_Blue</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="P@?U|z5SZY6k/NQSSaLr">
+                                                                  <shadow type="math_number" id="f=LX{[z|sxhgBKhzMc7@">
                                                                     <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="CZ4g*FL?4Mk=lj62[*yr">
                                                                     <field name="BOOL">FALSE</field>
                                                                   </shadow>
                                                                 </value>
+                                                                <next>
+                                                                  <block type="mqtt_publish" id="StL0d;=/[ck2._O_Id.(">
+                                                                    <value name="name">
+                                                                      <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="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=".$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="P@?U|z5SZY6k/NQSSaLr">
+                                                                        <field name="NUM">2</field>
+                                                                      </shadow>
+                                                                    </value>
+                                                                    <value name="retain">
+                                                                      <shadow type="logic_boolean" id=",B[1dxL!]ME%M)JCM)@^">
+                                                                        <field name="BOOL">FALSE</field>
+                                                                      </shadow>
+                                                                    </value>
+                                                                  </block>
+                                                                </next>
                                                               </block>
-                                                            </next>
+                                                            </statement>
                                                           </block>
                                                         </next>
                                                       </block>
@@ -1996,506 +2014,530 @@
                       </block>
                     </value>
                     <next>
-                      <block type="controls_if" id="i)7:3#B1h`;^NoVTxH@D">
-                        <mutation elseif="1" else="1"/>
-                        <value name="IF0">
-                          <block type="logic_compare" id="[g~P~J0QFx,Gj.,XHL|5">
-                            <field name="OP">EQ</field>
-                            <value name="A">
-                              <block type="variables_get" id="Jn9hVn5C6c.(j~CJ:q^6">
-                                <field name="VAR" id=")XfA{xXx7sN)MA=qSY=H">gtyp_Setup_i_Color_Sensor_Selection</field>
-                              </block>
-                            </value>
-                            <value name="B">
-                              <block type="math_number" id="K)nseD5~CB3[LMk?D]oq">
-                                <field name="NUM">1</field>
-                              </block>
-                            </value>
+                      <block type="import_function_noreturn" id="pP}9%Bs)9]$fD$H/@=As" inline="true">
+                        <mutation parentId="VSmATTY?.L[C{f,=c#1:"/>
+                        <field name="name">set_calibvalue_white</field>
+                        <data>VSmATTY?.L[C{f,=c#1:</data>
+                        <value name="v">
+                          <block type="math_number" id="tb{pe]#KLCojOWWR,]P4">
+                            <field name="NUM">0</field>
                           </block>
                         </value>
-                        <statement name="DO0">
-                          <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="9*`+]6N]2vvRh5r{)qUZ">
-                                <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field>
-                                <value name="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="h#uurdd|D)N@)6fb}y]Y">
-                                    <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field>
-                                    <value name="VALUE">
-                                      <block type="lists_getIndex" id="Zo@.F4}A.L8jh?*%otDt">
-                                        <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="#X_2y^P,9@Y_NC9O|pIA">
-                                            <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="B@LxNrLbeQR?25F?uYyW">
-                                            <field name="NUM">1</field>
-                                          </block>
-                                        </value>
-                                      </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>
-                                        <value name="VALUE">
-                                          <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="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="a,{!zAt=;F22-Yz8L!CI">
-                                                <field name="NUM">2</field>
-                                              </block>
-                                            </value>
-                                          </block>
-                                        </value>
-                                        <next>
-                                          <block type="import_function_noreturn" id="ti#5)tatK*KSfQ?~f~AW">
-                                            <mutation parentId="[VeFt!3!rIfU$B.I(^(^"/>
-                                            <field name="name">stopSLD</field>
-                                            <data>[VeFt!3!rIfU$B.I(^(^</data>
-                                          </block>
-                                        </next>
-                                      </block>
-                                    </next>
-                                  </block>
-                                </next>
-                              </block>
-                            </next>
-                          </block>
-                        </statement>
-                        <value name="IF1">
-                          <block type="logic_compare" id="Ry6/b?!9g(1r]eiqx:?~">
-                            <field name="OP">EQ</field>
-                            <value name="A">
-                              <block type="variables_get" id="$fas2_adI*|Cw;HQeIg5">
-                                <field name="VAR" id=")XfA{xXx7sN)MA=qSY=H">gtyp_Setup_i_Color_Sensor_Selection</field>
-                              </block>
-                            </value>
-                            <value name="B">
-                              <block type="math_number" id="dp4NVdb_hk+tD)/QC[x5">
-                                <field name="NUM">2</field>
+                        <next>
+                          <block type="import_function_noreturn" id="T[KPPJTp(uGcU!,C^YIz" inline="true">
+                            <mutation parentId="(h]YqJ@0g{:(ai*WF@?!"/>
+                            <field name="name">set_calibvalue_red</field>
+                            <data>(h]YqJ@0g{:(ai*WF@?!</data>
+                            <value name="v">
+                              <block type="math_number" id="4`yo3W2#s*iwoL6aXidC">
+                                <field name="NUM">0</field>
                               </block>
                             </value>
-                          </block>
-                        </value>
-                        <statement name="DO1">
-                          <block type="util_python" id="r|k1IWqLgp1fm#phq8rp" inline="true">
-                            <field name="value">logging.debug('2')</field>
                             <next>
-                              <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="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="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="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="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="{e+d,:6:KIfmj|nsK,LV">
-                                            <field name="NUM">1</field>
-                                          </block>
-                                        </value>
-                                      </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>
-                                        <value name="VALUE">
-                                          <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="}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="amR(f,!]|GX_?d]8_w:.">
-                                                <field name="NUM">2</field>
-                                              </block>
-                                            </value>
-                                          </block>
-                                        </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>
-                                </next>
-                              </block>
-                            </next>
-                          </block>
-                        </statement>
-                        <statement name="ELSE">
-                          <block type="util_python" id="rWWm)}Q.WvYJz$62-AC:" inline="true">
-                            <field name="value">logging.debug('none')</field>
-                            <next>
-                              <block type="variables_set" id="g)-8V^Z,Zx{V:R_f]i_.">
-                                <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field>
-                                <value name="VALUE">
-                                  <block type="math_number" id="Gof8u):q_v1H]SGYCc7y">
+                              <block type="import_function_noreturn" id="whAV8d/04#02f*fp7z8d" inline="true">
+                                <mutation parentId="L]1+4A^?Yt^]vOcR=Sf5"/>
+                                <field name="name">set_calibvalue_blue</field>
+                                <data>L]1+4A^?Yt^]vOcR=Sf5</data>
+                                <value name="v">
+                                  <block type="math_number" id="D]m:m}L4P~4,ZKK%6,4b">
                                     <field name="NUM">0</field>
                                   </block>
                                 </value>
                                 <next>
-                                  <block type="import_function_noreturn" id="pP}9%Bs)9]$fD$H/@=As" inline="true">
-                                    <mutation parentId="VSmATTY?.L[C{f,=c#1:"/>
-                                    <field name="name">set_calibvalue_white</field>
-                                    <data>VSmATTY?.L[C{f,=c#1:</data>
+                                  <block type="import_function_noreturn" id="%~,94Z6lLTs,iBawI=zi" inline="true">
+                                    <mutation parentId="By#/eOVl{%tWXHnq;[t8"/>
+                                    <field name="name">set_thresh_white_red</field>
+                                    <data>By#/eOVl{%tWXHnq;[t8</data>
                                     <value name="v">
-                                      <block type="math_number" id="tb{pe]#KLCojOWWR,]P4">
+                                      <block type="math_number" id="v]X6Y1-)n_(46A_Pb9.P">
                                         <field name="NUM">0</field>
                                       </block>
                                     </value>
                                     <next>
-                                      <block type="import_function_noreturn" id="T[KPPJTp(uGcU!,C^YIz" inline="true">
-                                        <mutation parentId="(h]YqJ@0g{:(ai*WF@?!"/>
-                                        <field name="name">set_calibvalue_red</field>
-                                        <data>(h]YqJ@0g{:(ai*WF@?!</data>
+                                      <block type="import_function_noreturn" id="NLEbw)lXdnkENN_V.h4:" inline="true">
+                                        <mutation parentId="Z!dZf*!e$c:zz,}xl0R~"/>
+                                        <field name="name">set_thresh_red_blue</field>
+                                        <data>Z!dZf*!e$c:zz,}xl0R~</data>
                                         <value name="v">
-                                          <block type="math_number" id="4`yo3W2#s*iwoL6aXidC">
+                                          <block type="math_number" id="BBN5)UL;LWSgSmGB2R,?">
                                             <field name="NUM">0</field>
                                           </block>
                                         </value>
                                         <next>
-                                          <block type="import_function_noreturn" id="whAV8d/04#02f*fp7z8d" inline="true">
-                                            <mutation parentId="L]1+4A^?Yt^]vOcR=Sf5"/>
-                                            <field name="name">set_calibvalue_blue</field>
-                                            <data>L]1+4A^?Yt^]vOcR=Sf5</data>
-                                            <value name="v">
-                                              <block type="math_number" id="D]m:m}L4P~4,ZKK%6,4b">
-                                                <field name="NUM">0</field>
+                                          <block type="controls_if" id="i)7:3#B1h`;^NoVTxH@D">
+                                            <mutation elseif="1" else="1"/>
+                                            <value name="IF0">
+                                              <block type="logic_compare" id="[g~P~J0QFx,Gj.,XHL|5">
+                                                <field name="OP">EQ</field>
+                                                <value name="A">
+                                                  <block type="variables_get" id="Jn9hVn5C6c.(j~CJ:q^6">
+                                                    <field name="VAR" id=")XfA{xXx7sN)MA=qSY=H">gtyp_Setup_i_Color_Sensor_Selection</field>
+                                                  </block>
+                                                </value>
+                                                <value name="B">
+                                                  <block type="math_number" id="K)nseD5~CB3[LMk?D]oq">
+                                                    <field name="NUM">1</field>
+                                                  </block>
+                                                </value>
                                               </block>
                                             </value>
-                                            <next>
-                                              <block type="import_function_noreturn" id="IJy_!,2i)(ygN%+GHla}">
-                                                <mutation parentId="[VeFt!3!rIfU$B.I(^(^"/>
-                                                <field name="name">stopSLD</field>
-                                                <data>[VeFt!3!rIfU$B.I(^(^</data>
-                                              </block>
-                                            </next>
-                                          </block>
-                                        </next>
-                                      </block>
-                                    </next>
-                                  </block>
-                                </next>
-                              </block>
-                            </next>
-                          </block>
-                        </statement>
-                        <next>
-                          <block type="mqtt_publish" id="x,T;`pWHXbo87!Rvm0G`">
-                            <value name="name">
-                              <block type="variables_get" id="i{O?M+Ri-ZE?KAY-X*:O">
-                                <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field>
-                              </block>
-                            </value>
-                            <value name="topic">
-                              <shadow type="text" id="LR9uuA$)sP[%^NTy0HFw">
-                                <field name="TEXT">gtyp_Setup/w_Actual_ColorValue</field>
-                              </shadow>
-                            </value>
-                            <value name="value">
-                              <shadow type="logic_null" id="yj8b%%[6em;{+Ec*l(IJ"/>
-                              <block type="variables_get" id="DK#4,,B,e()PG{h$I8Y0">
-                                <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field>
-                              </block>
-                            </value>
-                            <value name="qos">
-                              <shadow type="math_number" id="^7R#[u$F*-SU8B**H/@S">
-                                <field name="NUM">2</field>
-                              </shadow>
-                            </value>
-                            <value name="retain">
-                              <shadow type="logic_boolean" id="uk;Mv7J@HAYh#UU(xK4J">
-                                <field name="BOOL">FALSE</field>
-                              </shadow>
-                            </value>
-                            <next>
-                              <block type="mqtt_publish" id="C0H}e^9yo]hxUOeBc2*#">
-                                <value name="name">
-                                  <block type="variables_get" id="p0X8sj!EoEpI#(j?rjDK">
-                                    <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field>
-                                  </block>
-                                </value>
-                                <value name="topic">
-                                  <shadow type="text" id="z:c)5vp$ci1uAFGaHp9@">
-                                    <field name="TEXT">gtyp_Setup/w_Calib_ColorValue_White</field>
-                                  </shadow>
-                                </value>
-                                <value name="value">
-                                  <shadow type="logic_null"/>
-                                  <block type="lists_getIndex" id="l.X3$reE0r0jh;[~pmK?">
-                                    <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="p!Jl7zNx)|e~9Fftb3Aq">
-                                        <mutation parentId="cYBcy|]-F?s-:oG+Ch0Q"/>
-                                        <field name="name">get_calibvalue_list</field>
-                                        <data>cYBcy|]-F?s-:oG+Ch0Q</data>
-                                      </block>
-                                    </value>
-                                    <value name="AT">
-                                      <block type="math_number" id=")W:^5ed^eR@S*e*lYCoR">
-                                        <field name="NUM">1</field>
-                                      </block>
-                                    </value>
-                                  </block>
-                                </value>
-                                <value name="qos">
-                                  <shadow type="math_number" id="pJrgZ-rCs|Ad-4CQ5p)|">
-                                    <field name="NUM">2</field>
-                                  </shadow>
-                                </value>
-                                <value name="retain">
-                                  <shadow type="logic_boolean" id="M0DD;M,Hob1i8$@!sGQ^">
-                                    <field name="BOOL">FALSE</field>
-                                  </shadow>
-                                </value>
-                                <next>
-                                  <block type="mqtt_publish" id="6(}h+sRHy(m_(J]gH)GR">
-                                    <value name="name">
-                                      <block type="variables_get" id="xY;/XLdNbXQ3;tu*QM56">
-                                        <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field>
-                                      </block>
-                                    </value>
-                                    <value name="topic">
-                                      <shadow type="text" id="rnI=(fq~]rAZ*GJ^Nsbe">
-                                        <field name="TEXT">gtyp_Setup/w_Calib_ColorValue_Red</field>
-                                      </shadow>
-                                    </value>
-                                    <value name="value">
-                                      <shadow type="logic_null"/>
-                                      <block type="lists_getIndex" id="B[0R|c2aW8}-ekM%I*R+">
-                                        <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="n5}84DJyLkX[AcIKKqOG">
-                                            <mutation parentId="cYBcy|]-F?s-:oG+Ch0Q"/>
-                                            <field name="name">get_calibvalue_list</field>
-                                            <data>cYBcy|]-F?s-:oG+Ch0Q</data>
-                                          </block>
-                                        </value>
-                                        <value name="AT">
-                                          <block type="math_number" id="^0d1L4TeD^3v$Qkg(`G!">
-                                            <field name="NUM">2</field>
-                                          </block>
-                                        </value>
-                                      </block>
-                                    </value>
-                                    <value name="qos">
-                                      <shadow type="math_number" id="jwypWoaA/Ms?!x#.s`W}">
-                                        <field name="NUM">2</field>
-                                      </shadow>
-                                    </value>
-                                    <value name="retain">
-                                      <shadow type="logic_boolean" id="Lkx1trZNK~vbYT|gFqYX">
-                                        <field name="BOOL">FALSE</field>
-                                      </shadow>
-                                    </value>
-                                    <next>
-                                      <block type="mqtt_publish" id="1MYf1lFc}Jj5_67cwb(U">
-                                        <value name="name">
-                                          <block type="variables_get" id="3HZ3;JzBOh~iIC0^5miG">
-                                            <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field>
-                                          </block>
-                                        </value>
-                                        <value name="topic">
-                                          <shadow type="text" id="o2M46gBb@/`+9y).JjYt">
-                                            <field name="TEXT">gtyp_Setup/w_Calib_ColorValue_Blue</field>
-                                          </shadow>
-                                        </value>
-                                        <value name="value">
-                                          <shadow type="logic_null"/>
-                                          <block type="lists_getIndex" id="@LQUgWD|$gN;t$G[,s=T">
-                                            <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="KGR)MXzy7LpO6Dhskvr;">
-                                                <mutation parentId="cYBcy|]-F?s-:oG+Ch0Q"/>
-                                                <field name="name">get_calibvalue_list</field>
-                                                <data>cYBcy|]-F?s-:oG+Ch0Q</data>
+                                            <statement name="DO0">
+                                              <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="9*`+]6N]2vvRh5r{)qUZ">
+                                                    <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field>
+                                                    <value name="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="h#uurdd|D)N@)6fb}y]Y">
+                                                        <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field>
+                                                        <value name="VALUE">
+                                                          <block type="lists_getIndex" id="Zo@.F4}A.L8jh?*%otDt">
+                                                            <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="#X_2y^P,9@Y_NC9O|pIA">
+                                                                <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="B@LxNrLbeQR?25F?uYyW">
+                                                                <field name="NUM">1</field>
+                                                              </block>
+                                                            </value>
+                                                          </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>
+                                                            <value name="VALUE">
+                                                              <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="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="a,{!zAt=;F22-Yz8L!CI">
+                                                                    <field name="NUM">2</field>
+                                                                  </block>
+                                                                </value>
+                                                              </block>
+                                                            </value>
+                                                            <next>
+                                                              <block type="import_function_noreturn" id="ti#5)tatK*KSfQ?~f~AW">
+                                                                <mutation parentId="[VeFt!3!rIfU$B.I(^(^"/>
+                                                                <field name="name">stopSLD</field>
+                                                                <data>[VeFt!3!rIfU$B.I(^(^</data>
+                                                              </block>
+                                                            </next>
+                                                          </block>
+                                                        </next>
+                                                      </block>
+                                                    </next>
+                                                  </block>
+                                                </next>
                                               </block>
-                                            </value>
-                                            <value name="AT">
-                                              <block type="math_number" id="g_4bY$Uhq@X1lktX(%Nl">
-                                                <field name="NUM">3</field>
+                                            </statement>
+                                            <value name="IF1">
+                                              <block type="logic_compare" id="Ry6/b?!9g(1r]eiqx:?~">
+                                                <field name="OP">EQ</field>
+                                                <value name="A">
+                                                  <block type="variables_get" id="$fas2_adI*|Cw;HQeIg5">
+                                                    <field name="VAR" id=")XfA{xXx7sN)MA=qSY=H">gtyp_Setup_i_Color_Sensor_Selection</field>
+                                                  </block>
+                                                </value>
+                                                <value name="B">
+                                                  <block type="math_number" id="dp4NVdb_hk+tD)/QC[x5">
+                                                    <field name="NUM">2</field>
+                                                  </block>
+                                                </value>
                                               </block>
                                             </value>
-                                          </block>
-                                        </value>
-                                        <value name="qos">
-                                          <shadow type="math_number" id="uZqL9;3W0@^a@,kryyS{">
-                                            <field name="NUM">2</field>
-                                          </shadow>
-                                        </value>
-                                        <value name="retain">
-                                          <shadow type="logic_boolean" id="sF:XBpP20BdY^@UwskAj">
-                                            <field name="BOOL">FALSE</field>
-                                          </shadow>
-                                        </value>
-                                        <next>
-                                          <block type="mqtt_publish" id="]+EFhfc|)bE:M?s~.ngZ">
-                                            <value name="name">
-                                              <block type="variables_get" id="/rhX}@]}|@N.dEfulb@p">
-                                                <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field>
+                                            <statement name="DO1">
+                                              <block type="util_python" id="r|k1IWqLgp1fm#phq8rp" inline="true">
+                                                <field name="value">logging.debug('2')</field>
+                                                <next>
+                                                  <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="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="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="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="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="{e+d,:6:KIfmj|nsK,LV">
+                                                                <field name="NUM">1</field>
+                                                              </block>
+                                                            </value>
+                                                          </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>
+                                                            <value name="VALUE">
+                                                              <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="}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="amR(f,!]|GX_?d]8_w:.">
+                                                                    <field name="NUM">2</field>
+                                                                  </block>
+                                                                </value>
+                                                              </block>
+                                                            </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>
+                                                    </next>
+                                                  </block>
+                                                </next>
                                               </block>
-                                            </value>
-                                            <value name="topic">
-                                              <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="PJ+D)]FK6=D!^WDu/Z|5">
-                                                <field name="VAR" id="-XOZ;@M!{qgTA%xgUef-">gtyp_SSC_w_Threshold_White_Red</field>
+                                            </statement>
+                                            <statement name="ELSE">
+                                              <block type="util_python" id="rWWm)}Q.WvYJz$62-AC:" inline="true">
+                                                <field name="value">logging.debug('none')</field>
+                                                <next>
+                                                  <block type="variables_set" id="g)-8V^Z,Zx{V:R_f]i_.">
+                                                    <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field>
+                                                    <value name="VALUE">
+                                                      <block type="math_number" id="Gof8u):q_v1H]SGYCc7y">
+                                                        <field name="NUM">0</field>
+                                                      </block>
+                                                    </value>
+                                                    <next>
+                                                      <block type="import_function_noreturn" id="IJy_!,2i)(ygN%+GHla}">
+                                                        <mutation parentId="[VeFt!3!rIfU$B.I(^(^"/>
+                                                        <field name="name">stopSLD</field>
+                                                        <data>[VeFt!3!rIfU$B.I(^(^</data>
+                                                      </block>
+                                                    </next>
+                                                  </block>
+                                                </next>
                                               </block>
-                                            </value>
-                                            <value name="qos">
-                                              <shadow type="math_number" id="XROfsH:uPwEr;=?ZA2BH">
-                                                <field name="NUM">2</field>
-                                              </shadow>
-                                            </value>
-                                            <value name="retain">
-                                              <shadow type="logic_boolean" id="60}wRHbBKjeDf|]~O*k`">
-                                                <field name="BOOL">FALSE</field>
-                                              </shadow>
-                                            </value>
+                                            </statement>
                                             <next>
-                                              <block type="mqtt_publish" id="FME^shM?U!h!^!cby}W+">
+                                              <block type="mqtt_publish" id="x,T;`pWHXbo87!Rvm0G`">
                                                 <value name="name">
-                                                  <block type="variables_get" id="SWRJBMR,KRCD#rU;5]k_">
+                                                  <block type="variables_get" id="i{O?M+Ri-ZE?KAY-X*:O">
                                                     <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="LR9uuA$)sP[%^NTy0HFw">
+                                                    <field name="TEXT">gtyp_Setup/w_Actual_ColorValue</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>
+                                                  <shadow type="logic_null" id="yj8b%%[6em;{+Ec*l(IJ"/>
+                                                  <block type="variables_get" id="DK#4,,B,e()PG{h$I8Y0">
+                                                    <field name="VAR" id=")(=M[8QEW5[mGL@9Axsu">gtyp_Setup_w_Actual_ColorValue</field>
                                                   </block>
                                                 </value>
                                                 <value name="qos">
-                                                  <shadow type="math_number" id="SsA_tZ`x^1+}(_zKjKRu">
+                                                  <shadow type="math_number" id="^7R#[u$F*-SU8B**H/@S">
                                                     <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="uk;Mv7J@HAYh#UU(xK4J">
                                                     <field name="BOOL">FALSE</field>
                                                   </shadow>
                                                 </value>
                                                 <next>
-                                                  <block type="mqtt_publish" id="Tr6*L5MmGUw.AvHyamY1">
+                                                  <block type="mqtt_publish" id="C0H}e^9yo]hxUOeBc2*#">
                                                     <value name="name">
-                                                      <block type="variables_get" id="WCtWefm``a=@t.FvV6Ac">
+                                                      <block type="variables_get" id="p0X8sj!EoEpI#(j?rjDK">
                                                         <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="z:c)5vp$ci1uAFGaHp9@">
+                                                        <field name="TEXT">gtyp_Setup/w_Calib_ColorValue_White</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="lists_getIndex" id="l.X3$reE0r0jh;[~pmK?">
+                                                        <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="p!Jl7zNx)|e~9Fftb3Aq">
+                                                            <mutation parentId="cYBcy|]-F?s-:oG+Ch0Q"/>
+                                                            <field name="name">get_calibvalue_list</field>
+                                                            <data>cYBcy|]-F?s-:oG+Ch0Q</data>
+                                                          </block>
+                                                        </value>
+                                                        <value name="AT">
+                                                          <block type="math_number" id=")W:^5ed^eR@S*e*lYCoR">
+                                                            <field name="NUM">1</field>
+                                                          </block>
+                                                        </value>
                                                       </block>
                                                     </value>
                                                     <value name="qos">
-                                                      <shadow type="math_number" id="V-RWpnm?!B]u{GqNJAg$">
+                                                      <shadow type="math_number" id="pJrgZ-rCs|Ad-4CQ5p)|">
                                                         <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="M0DD;M,Hob1i8$@!sGQ^">
                                                         <field name="BOOL">FALSE</field>
                                                       </shadow>
                                                     </value>
                                                     <next>
-                                                      <block type="mqtt_publish" id="E=2htASUa2V7[.Oh1Z~g">
+                                                      <block type="mqtt_publish" id="6(}h+sRHy(m_(J]gH)GR">
                                                         <value name="name">
-                                                          <block type="variables_get" id="E=].S3E:1;mEJj~=9fb+">
+                                                          <block type="variables_get" id="xY;/XLdNbXQ3;tu*QM56">
                                                             <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="rnI=(fq~]rAZ*GJ^Nsbe">
+                                                            <field name="TEXT">gtyp_Setup/w_Calib_ColorValue_Red</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="lists_getIndex" id="B[0R|c2aW8}-ekM%I*R+">
+                                                            <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="n5}84DJyLkX[AcIKKqOG">
+                                                                <mutation parentId="cYBcy|]-F?s-:oG+Ch0Q"/>
+                                                                <field name="name">get_calibvalue_list</field>
+                                                                <data>cYBcy|]-F?s-:oG+Ch0Q</data>
+                                                              </block>
+                                                            </value>
+                                                            <value name="AT">
+                                                              <block type="math_number" id="^0d1L4TeD^3v$Qkg(`G!">
+                                                                <field name="NUM">2</field>
+                                                              </block>
+                                                            </value>
                                                           </block>
                                                         </value>
                                                         <value name="qos">
-                                                          <shadow type="math_number" id="E4b)TY}~jy~SgWRG28:A">
+                                                          <shadow type="math_number" id="jwypWoaA/Ms?!x#.s`W}">
                                                             <field name="NUM">2</field>
                                                           </shadow>
                                                         </value>
                                                         <value name="retain">
-                                                          <shadow type="logic_boolean" id="pQnV]dxl4;W):A3rbTA4">
+                                                          <shadow type="logic_boolean" id="Lkx1trZNK~vbYT|gFqYX">
                                                             <field name="BOOL">FALSE</field>
                                                           </shadow>
                                                         </value>
+                                                        <next>
+                                                          <block type="mqtt_publish" id="1MYf1lFc}Jj5_67cwb(U">
+                                                            <value name="name">
+                                                              <block type="variables_get" id="3HZ3;JzBOh~iIC0^5miG">
+                                                                <field name="VAR" id="d2.J:01W*;j`8R0B1!GX">client</field>
+                                                              </block>
+                                                            </value>
+                                                            <value name="topic">
+                                                              <shadow type="text" id="o2M46gBb@/`+9y).JjYt">
+                                                                <field name="TEXT">gtyp_Setup/w_Calib_ColorValue_Blue</field>
+                                                              </shadow>
+                                                            </value>
+                                                            <value name="value">
+                                                              <shadow type="logic_null"/>
+                                                              <block type="lists_getIndex" id="@LQUgWD|$gN;t$G[,s=T">
+                                                                <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="KGR)MXzy7LpO6Dhskvr;">
+                                                                    <mutation parentId="cYBcy|]-F?s-:oG+Ch0Q"/>
+                                                                    <field name="name">get_calibvalue_list</field>
+                                                                    <data>cYBcy|]-F?s-:oG+Ch0Q</data>
+                                                                  </block>
+                                                                </value>
+                                                                <value name="AT">
+                                                                  <block type="math_number" id="g_4bY$Uhq@X1lktX(%Nl">
+                                                                    <field name="NUM">3</field>
+                                                                  </block>
+                                                                </value>
+                                                              </block>
+                                                            </value>
+                                                            <value name="qos">
+                                                              <shadow type="math_number" id="uZqL9;3W0@^a@,kryyS{">
+                                                                <field name="NUM">2</field>
+                                                              </shadow>
+                                                            </value>
+                                                            <value name="retain">
+                                                              <shadow type="logic_boolean" id="sF:XBpP20BdY^@UwskAj">
+                                                                <field name="BOOL">FALSE</field>
+                                                              </shadow>
+                                                            </value>
+                                                            <next>
+                                                              <block type="mqtt_publish" id="]+EFhfc|)bE:M?s~.ngZ">
+                                                                <value name="name">
+                                                                  <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=";//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="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="XROfsH:uPwEr;=?ZA2BH">
+                                                                    <field name="NUM">2</field>
+                                                                  </shadow>
+                                                                </value>
+                                                                <value name="retain">
+                                                                  <shadow type="logic_boolean" id="60}wRHbBKjeDf|]~O*k`">
+                                                                    <field name="BOOL">FALSE</field>
+                                                                  </shadow>
+                                                                </value>
+                                                                <next>
+                                                                  <block type="mqtt_publish" id="FME^shM?U!h!^!cby}W+">
+                                                                    <value name="name">
+                                                                      <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="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="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="SsA_tZ`x^1+}(_zKjKRu">
+                                                                        <field name="NUM">2</field>
+                                                                      </shadow>
+                                                                    </value>
+                                                                    <value name="retain">
+                                                                      <shadow type="logic_boolean" id="!*}`Y.znZ+z.oXK--9c-">
+                                                                        <field name="BOOL">FALSE</field>
+                                                                      </shadow>
+                                                                    </value>
+                                                                    <next>
+                                                                      <block type="mqtt_publish" id="Tr6*L5MmGUw.AvHyamY1">
+                                                                        <value name="name">
+                                                                          <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="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="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="V-RWpnm?!B]u{GqNJAg$">
+                                                                            <field name="NUM">2</field>
+                                                                          </shadow>
+                                                                        </value>
+                                                                        <value name="retain">
+                                                                          <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="E=2htASUa2V7[.Oh1Z~g">
+                                                                            <value name="name">
+                                                                              <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="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="~}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="E4b)TY}~jy~SgWRG28:A">
+                                                                                <field name="NUM">2</field>
+                                                                              </shadow>
+                                                                            </value>
+                                                                            <value name="retain">
+                                                                              <shadow type="logic_boolean" id="pQnV]dxl4;W):A3rbTA4">
+                                                                                <field name="BOOL">FALSE</field>
+                                                                              </shadow>
+                                                                            </value>
+                                                                          </block>
+                                                                        </next>
+                                                                      </block>
+                                                                    </next>
+                                                                  </block>
+                                                                </next>
+                                                              </block>
+                                                            </next>
+                                                          </block>
+                                                        </next>
                                                       </block>
                                                     </next>
                                                   </block>
@@ -2704,7 +2746,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="$jNNx1Oeez9#x~eQYP}z" x="0" y="7747">
+  <block type="procedures_defnoreturn" id="$jNNx1Oeez9#x~eQYP}z" x="0" y="8280">
     <field name="NAME">initMQTTLocal</field>
     <statement name="STACK">
       <block type="variables_set" id="_C*fQdBXqrGb1uUWi?_1">
@@ -2800,7 +2842,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="R4vMowGJ0I?IYs_!-IwU" x="0" y="8259">
+  <block type="procedures_defnoreturn" id="R4vMowGJ0I?IYs_!-IwU" x="0" y="8808">
     <field name="NAME">thread_MQTTLocal</field>
     <statement name="STACK">
       <block type="util_python" id="IiRVsU4_~OPjE]@(VC;/" inline="true">
@@ -2816,7 +2858,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="8u`{W^33E#gAnZ}n#.-h" x="0" y="8519">
+  <block type="procedures_defnoreturn" id="8u`{W^33E#gAnZ}n#.-h" x="0" y="9074">
     <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"/>
@@ -3054,7 +3096,7 @@
       </block>
     </statement>
   </block>
-  <block type="procedures_defnoreturn" id="a]0!I}Zd7AawL:mU%,P1" x="0" y="9313">
+  <block type="procedures_defnoreturn" id="a]0!I}Zd7AawL:mU%,P1" x="0" y="9893">
     <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"/>
diff --git a/lib/NodeRED.py b/lib/NodeRED.py
index df9c30bb3ca1ea1782b2b595839f593fa65f4618..4804d3470854ba7d7c9a80862fdd7112e88cf4c2 100644
--- a/lib/NodeRED.py
+++ b/lib/NodeRED.py
@@ -38,17 +38,17 @@ gtyp_Setup_w_Threshold_White_Red = None
 gtyp_Setup_w_Threshold_Red_Blue = None
 gtyp_Setup_di_Pos_Rotate = None
 gtyp_SSC_w_Threshold_White_Red = None
-gtyp_SLD_w_Threshold_White_Red = None
 gtyp_SSC_w_Threshold_Red_Blue = None
-gtyp_SLD_w_Threshold_Red_Blue = None
 gtyp_Setup_di_Pos_Vertical = None
+gtyp_SLD_w_Threshold_White_Red = None
+gtyp_SLD_w_Threshold_Red_Blue = None
 ts = None
 controller_name = None
 gtyp_Setup_di_Pos_Horizontal = None
 
 
 def thread_updateColorValue():
-    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, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, 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, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, gtyp_SLD_w_Threshold_White_Red, gtyp_SLD_w_Threshold_Red_Blue, ts, controller_name, gtyp_Setup_di_Pos_Horizontal
     while True:
         if gtyp_Setup_i_Color_Sensor_Selection == 1:
             logging.debug('1')
@@ -62,7 +62,7 @@ def thread_updateColorValue():
 
 
 def processReceivedMessage(topic, m_decode):
-    global client, userdata, flags, rc, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, 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, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, gtyp_SLD_w_Threshold_White_Red, gtyp_SLD_w_Threshold_Red_Blue, 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')
@@ -173,15 +173,17 @@ def processReceivedMessage(topic, m_decode):
             set_calib_data_DPS([gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue])
             gtyp_SSC_w_Threshold_White_Red = (get_calib_data_DPS())[0]
             gtyp_SSC_w_Threshold_Red_Blue = (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)
+            if 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)
         elif gtyp_Setup_i_Color_Sensor_Selection == 2:
             logging.debug('2')
             set_calib_data_SLD([gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue])
             gtyp_SLD_w_Threshold_White_Red = (get_calib_data_SLD())[0]
             gtyp_SLD_w_Threshold_Red_Blue = (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)
+            if 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)
         else:
             pass
         stopSLD()
@@ -204,6 +206,11 @@ def processReceivedMessage(topic, m_decode):
     elif topic == 'gtyp_Setup/i_Color_Sensor_Selection':
         logging.debug('sensor selection')
         gtyp_Setup_i_Color_Sensor_Selection = int(m_decode, 10)
+        set_calibvalue_white(0)
+        set_calibvalue_red(0)
+        set_calibvalue_blue(0)
+        set_thresh_white_red(0)
+        set_thresh_red_blue(0)
         if gtyp_Setup_i_Color_Sensor_Selection == 1:
             logging.debug('1')
             gtyp_Setup_w_Actual_ColorValue = readDPSColorValue()
@@ -219,9 +226,6 @@ def processReceivedMessage(topic, m_decode):
         else:
             logging.debug('none')
             gtyp_Setup_w_Actual_ColorValue = 0
-            set_calibvalue_white(0)
-            set_calibvalue_red(0)
-            set_calibvalue_blue(0)
             stopSLD()
         client.publish(topic='gtyp_Setup/w_Actual_ColorValue', payload=gtyp_Setup_w_Actual_ColorValue, qos=2, retain=False)
         client.publish(topic='gtyp_Setup/w_Calib_ColorValue_White', payload=(get_calibvalue_list())[0], qos=2, retain=False)
@@ -251,7 +255,7 @@ def processReceivedMessage(topic, m_decode):
 
 
 def initMQTTLocal():
-    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, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, 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, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, gtyp_SLD_w_Threshold_White_Red, gtyp_SLD_w_Threshold_Red_Blue, 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
@@ -269,7 +273,7 @@ def initMQTTLocal():
 
 
 def thread_MQTTLocal():
-    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, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, 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, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, gtyp_SLD_w_Threshold_White_Red, gtyp_SLD_w_Threshold_Red_Blue, ts, controller_name, gtyp_Setup_di_Pos_Horizontal
     logging.debug('-')
     #client.loop_forever()
     client.loop_start()
@@ -278,7 +282,7 @@ def thread_MQTTLocal():
 
 
 def on_connect(client, userdata, flags, rc):
-    global topic, m_decode, msg, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, 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, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, gtyp_SLD_w_Threshold_White_Red, gtyp_SLD_w_Threshold_Red_Blue, ts, controller_name, gtyp_Setup_di_Pos_Horizontal
     print("Connection returned result: "+mqtt.connack_string(rc))
     client.subscribe("#")
     #client.subscribe("$SYS/#")
@@ -295,7 +299,7 @@ def on_connect(client, userdata, flags, rc):
 
 
 def on_message(client, userdata, msg):
-    global topic, m_decode, flags, rc, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SLD_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_SLD_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, ts, controller_name, gtyp_Setup_di_Pos_Horizontal
+    global topic, m_decode, flags, rc, gtyp_Setup_x_Set_Pos_Activ, gtyp_Setup_i_Pos_Selection, payload, gtyp_Setup_x_Color_Sensor_Calibration, gtyp_Setup_i_Color_Sensor_Selection, gtyp_Setup_w_Actual_ColorValue, state_positioning, gtyp_Setup_w_Threshold_White_Red, gtyp_Setup_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Rotate, gtyp_SSC_w_Threshold_White_Red, gtyp_SSC_w_Threshold_Red_Blue, gtyp_Setup_di_Pos_Vertical, gtyp_SLD_w_Threshold_White_Red, gtyp_SLD_w_Threshold_Red_Blue, 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