Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Automatischer View Wechsel / zwei unterschiedliche Geräte

    NEWS

    • Wir empfehlen: Node.js 22.x

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker goes Matter ... Matter Adapter in Stable

    Automatischer View Wechsel / zwei unterschiedliche Geräte

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      m0uh @liv-in-sky last edited by

      @liv-in-sky Werde später mal updaten und bisschen testen... melde mich dann morgen wieder

      liv-in-sky 1 Reply Last reply Reply Quote 0
      • liv-in-sky
        liv-in-sky @m0uh last edited by

        @m0uh

        wenn du testest, mache mal unterschedliche zeiten - mit mind 5 sek unterschied - dann schaut es bei mir besser aus !

        M 1 Reply Last reply Reply Quote 0
        • M
          m0uh @liv-in-sky last edited by m0uh

          @liv-in-sky also so leid es mir tut aber ich bekomm es nicht zum laufen.

          So hab ich den Script drin:

           /*SCHALTET ZURÜCK AUF VIEW DES ZIMMERS 1*/
           
          var remindSwitchTab1=false;
          var mySwitchTime1=30000;
          var myTabPort1="8083";
          var myURL1="http://192.168.178.67:8083/vis/index.html#Wohnung"
           
          /*für reload page*/
          if (location.port==myTabPort1) {
             
              setTimeout(function() {
              if (!remindSwitchTab1)  window.location.href = myURL1;
                 console.log("wait");
             }, mySwitchTime1)
          }
           
          /*nach klick wieder reaktiviert*/
          $(window).click(function(e) {
             if (!remindSwitchTab1 && location.port==myTabPort1){
                 remindSwitchTab1=true;
                  console.log("in href change 1 timer "+mySwitchTime1+" sek");
              setTimeout(function() {
                 window.location.href = myURL1;
                 console.log("finished for href change 1");
                 remindSwitchTab1=false;
                 
             }, mySwitchTime1)
             
             }
          });
           
          /*ENDE ----- SCHALTET ZURÜCK AUF VIEW DES ZIMMERS/TABLETS2*/
           
          /*SCHALTET ZURÜCK AUF VIEW DES ZIMMERS 2*/
           
          var remindSwitchTab2=false;
          var mySwitchTime2=10000;
          var myTabPort2="8084";
          var myURL2="http://192.168.178.67:8084/vis/index.html#Dachgeschoss"
           
          /*für reload page*/
          if (location.port==myTabPort2) {
             
              setTimeout(function() {
               if (!remindSwitchTab2)  window.location.href = myURL2;
                 console.log("wait");
             }, mySwitchTime2)
          }
           
          /*nach klick wieder reaktiviert*/
          $(window).click(function(e) {
             if (!remindSwitchTab2 && location.port==myTabPort2){
                 remindSwitchTab2=true;
                 console.log("in href change 2 timer "+mySwitchTime2+" sek");
              setTimeout(function() {
                window.location.href = myURL2;
                 console.log("finished for href change 2");
                 remindSwitchTab2=false;
                 
             }, mySwitchTime2)
           
             }
          });
          

          FullyBrowser beide bei v1.46 & es ist jeweils
          http://192.168.178.67:8083/vis/index.html#Wohnung
          http://192.168.178.67:8084/vis/index.html#Dachgeschoss
          eingetragen

          es wird auf keine anderen Gerät zum selben Zeitpunkt irgendeine VIS Instanz ausgeführt. (auf keinen der 3 Ports)

          Zeit ist auf 30 & 10 Sekunden. OHNE ERFOLG 😞

          WENN ich aber in Chrome im selben Browser 2 Tabs mit den dazugehörigen Ports öffne funktioniert es (auch wenn Sie noch im Fully geöffnet sind).
          Also irgendwas passt nicht... scheint ja irgend eine Einstellung im Fully zu sein.

          liv-in-sky 4 Replies Last reply Reply Quote 0
          • liv-in-sky
            liv-in-sky @m0uh last edited by

            @m0uh

            ich kann es nur zum teil nachstellen - prüfe auch gerade mit 2 pc browser, handy und 2 tablets

            bis auf ein tablet funktioniert es bei den andren 4'ren

            alle haben verschiedene android systeme

            ich kann den fehler auch nicht definieren - entweder webview oder , wie du sagst, ein setting von fully. wobei ich bei den tablets das selbe setting eingespielt habe

            füge mal zum test in zeile 24 und 57 das hier ein: location.reload(true);

            1 Reply Last reply Reply Quote 0
            • liv-in-sky
              liv-in-sky @m0uh last edited by

              @m0uh ich überlege nochmal, ob mir eine andere struktur einfällt, um fully zu überlisten

              1 Reply Last reply Reply Quote 0
              • liv-in-sky
                liv-in-sky @m0uh last edited by liv-in-sky

                @m0uh

                NEUER VERSUCH:

                erstes script wie gehabt im vis script tab:

                
                
                
                
                
                
                /*SCHALTET ZURÜCK AUF VIEW DES ZIMMERS 1*/
                
                
                var myTabPort1="8072";
                var myURL1="http://192.168.178.59:8072/vis/index.html?speedy3#dives"
                
                /*für reload page*/
                if (location.port==myTabPort1) {
                
                   setInterval(function() {
                    	var Self = this;
                Self.servConn.getStates('0_userdata.0.vis.visSchaltenTablet1', (error, states) => {  console.log(states['0_userdata.0.vis.visSchaltenTablet1'].val);
                      if(!states['0_userdata.0.vis.visSchaltenTablet1'].val) window.location.href = myURL1;
                } );
                  
                    
                }, 10000); 
                   
                   
                }
                
                /*nach klick wieder reaktiviert*/
                $(window).click(function(e) {
                    if ( location.port==myTabPort1){
                    vis.setValue('0_userdata.0.vis.visSchaltenTablet1',true);
                    vis.setValue('0_userdata.0.vis.visTablet1Port',location.port);
                    }
                   
                
                });
                
                /*ENDE ----- SCHALTET ZURÜCK AUF VIEW DES ZIMMERS/TABLETS2*/
                
                /*SCHALTET ZURÜCK AUF VIEW DES ZIMMERS 2*/
                
                
                var myTabPort2="8082";
                var myURL2="http://192.168.178.59:8082/vis/index.html?speedy3#111"
                
                /*für reload page*/
                if (location.port==myTabPort2) {
                   
                    setInterval(function() {
                    	var Self = this;
                Self.servConn.getStates('0_userdata.0.vis.visSchaltenTablet2', (error, states) => {  console.log(states['0_userdata.0.vis.visSchaltenTablet2'].val);
                      if(!states['0_userdata.0.vis.visSchaltenTablet2'].val) window.location.href = myURL2;
                } );
                  
                    
                }, 10000);
                }
                
                /*nach klick wieder reaktiviert*/
                $(window).click(function(e) {
                    if ( location.port==myTabPort2){
                   vis.setValue('0_userdata.0.vis.visSchaltenTablet2',true);
                   vis.setValue('0_userdata.0.vis.visTablet2Port',location.port);
                    }
                });
                
                /*ENDE ----- SCHALTET ZURÜCK AUF VIEW DES ZIMMERS/TABLETS2*/
                
                
                

                zweites script ist ein blockly:

                • diesmal ist es wichtig, dass eine seite in nur einem browser läuft !!!! paralleles testen mit pc und tablet ist nicht möglich - also möglich schon, bringt aber das system durcheinander
                • legt dp unter 0_userdata.0.vis... an - beim ersten start gibt es warnungen im log - dann ist's aber ok
                • im blockly stellst du die zeit ein, wie lange es brauchen soll, bis umgeschaltet wird (+/- 10 sekunden (das liegt daran, dass die vis längstens 10 sek braucht, um den dp zu scannen - macht aber nix, da du ja im alltäglichen gebrauch, eine längere zeit hast, bis zurückgeschaltet wird

                <xml xmlns="https://developers.google.com/blockly/xml">
                 <block type="control" id="jiT=5gzt@D{jw:lQ/sRj" x="138" y="62">
                   <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                   <field name="OID">0_userdata.0.vis.visSchaltenTablet1</field>
                   <field name="WITH_DELAY">FALSE</field>
                   <value name="VALUE">
                     <block type="logic_boolean" id="f6V4kE:Sv(lQq6?b/OXY">
                       <field name="BOOL">FALSE</field>
                     </block>
                   </value>
                   <next>
                     <block type="on" id="47Vgt73D7f*NJ?fzqZ)=">
                       <field name="OID">0_userdata.0.vis.visSchaltenTablet1</field>
                       <field name="CONDITION">true</field>
                       <field name="ACK_CONDITION"></field>
                       <statement name="STATEMENT">
                         <block type="control" id="r=v=$LZ_)hp*[k2~.E?+">
                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                           <field name="OID">0_userdata.0.vis.visSchaltenTablet1</field>
                           <field name="WITH_DELAY">TRUE</field>
                           <field name="DELAY_MS">20</field>
                           <field name="UNIT">sec</field>
                           <field name="CLEAR_RUNNING">TRUE</field>
                           <value name="VALUE">
                             <block type="logic_boolean" id="60cF{d0.+g+1R-it_}b7">
                               <field name="BOOL">FALSE</field>
                             </block>
                           </value>
                         </block>
                       </statement>
                     </block>
                   </next>
                 </block>
                 <block type="control" id="$%;Pi^,ag:.sGy?9Y_*u" x="863" y="63">
                   <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="false"></mutation>
                   <field name="OID">0_userdata.0.vis.visSchaltenTablet2</field>
                   <field name="WITH_DELAY">FALSE</field>
                   <value name="VALUE">
                     <block type="logic_boolean" id="Tf}*u!bzB$c5x)cj,gE/">
                       <field name="BOOL">FALSE</field>
                     </block>
                   </value>
                   <next>
                     <block type="on" id="XK~S*oR`-3UsKv8}:.gO">
                       <field name="OID">0_userdata.0.vis.visSchaltenTablet2</field>
                       <field name="CONDITION">true</field>
                       <field name="ACK_CONDITION"></field>
                       <statement name="STATEMENT">
                         <block type="control" id="Yb3L,,bJRIk:~%63O3b2">
                           <mutation xmlns="http://www.w3.org/1999/xhtml" delay_input="true"></mutation>
                           <field name="OID">0_userdata.0.vis.visSchaltenTablet2</field>
                           <field name="WITH_DELAY">TRUE</field>
                           <field name="DELAY_MS">15</field>
                           <field name="UNIT">sec</field>
                           <field name="CLEAR_RUNNING">TRUE</field>
                           <value name="VALUE">
                             <block type="logic_boolean" id="rpb$-Bot}hJhz3dF~53u">
                               <field name="BOOL">FALSE</field>
                             </block>
                           </value>
                         </block>
                       </statement>
                     </block>
                   </next>
                 </block>
                 <block type="create" id="HgG4/Uci^Q[F7JzyWH2r" x="112" y="388">
                   <field name="NAME">0_userdata.0.vis.visSchaltenTablet1</field>
                   <value name="VALUE">
                     <block type="logic_boolean" id="Q=U*Oe.0!2h5.$/_z`d(">
                       <field name="BOOL">FALSE</field>
                     </block>
                   </value>
                   <value name="COMMON">
                     <block type="text" id="5xS7/sF`Eu`$+05,%xs~">
                       <field name="TEXT">{     "name": "visSchaltenTablet1",     "role": "",     "type": "boolean",     "desc": "Manuell erzeugt",     "read": true,     "write": true,     "def": false   }</field>
                     </block>
                   </value>
                   <next>
                     <block type="create" id="k,#JlL_@Nk5.mCKE_1]d">
                       <field name="NAME">0_userdata.0.vis.visTablet1Port</field>
                       <value name="VALUE">
                         <block type="text" id="Z?^1C.(4OIS`#cK3Xyhl">
                           <field name="TEXT"></field>
                         </block>
                       </value>
                       <value name="COMMON">
                         <block type="text" id="b/AWg*F,.u3QRJ0VV{vO">
                           <field name="TEXT">{     "name": "visTablet1Port",     "role": "",     "type": "string",     "read": true,     "write": true,     "desc": "Manuell erzeugt",     "def": ""   }</field>
                         </block>
                       </value>
                     </block>
                   </next>
                 </block>
                 <block type="create" id=".RM4[Jv28cn@Pbq1|9@H" x="837" y="363">
                   <field name="NAME">0_userdata.0.vis.visSchaltenTablet2</field>
                   <value name="VALUE">
                     <block type="logic_boolean" id="o7kvz#@SSDlT2q463d|r">
                       <field name="BOOL">FALSE</field>
                     </block>
                   </value>
                   <value name="COMMON">
                     <block type="text" id="ptK02b+_x56Z=%kPz1h/">
                       <field name="TEXT">{     "name": "visSchaltenTablet2",     "role": "",     "type": "boolean",     "desc": "Manuell erzeugt",     "read": true,     "write": true,     "def": false   }</field>
                     </block>
                   </value>
                   <next>
                     <block type="create" id="by8cqSkHx~yLSS=MZ)z8">
                       <field name="NAME">0_userdata.0.vis.visTablet2Port</field>
                       <value name="VALUE">
                         <block type="text" id="cQG;Lj`1x1-rGM`Io%*}">
                           <field name="TEXT"></field>
                         </block>
                       </value>
                       <value name="COMMON">
                         <block type="text" id="3atbKpSXAs6tM+s=or!S">
                           <field name="TEXT">{     "name": "visTablet2Port",     "role": "",     "type": "string",     "read": true,     "write": true,     "desc": "Manuell erzeugt",     "def": ""   }</field>
                         </block>
                       </value>
                     </block>
                   </next>
                 </block>
                </xml>
                

                1 Reply Last reply Reply Quote 0
                • liv-in-sky
                  liv-in-sky @m0uh last edited by

                  @m0uh läuft bei mir bis jetzt stabil

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    m0uh @liv-in-sky last edited by

                    @liv-in-sky Sorry war leider bisschen beschäftigt... werde das ganze die Woche mal testen und mich bei dir melden!

                    DANKE schon mal!

                    liv-in-sky 1 Reply Last reply Reply Quote 0
                    • liv-in-sky
                      liv-in-sky @m0uh last edited by

                      @m0uh dachte schon, du hast keine lust mehr 🙂

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        m0uh @liv-in-sky last edited by

                        @liv-in-sky ganz im Gegenteil aber bin derzeit geschäftlich unterwegs und das wird sich jetzt die nächsten 7 Wochen nicht ändern.... ich hoffe du gibst mich bis dahin nicht auf 😛 ich melde mich definitiv wenn ich das ganze mal in Ruhe getestet habe!

                        liv-in-sky 1 Reply Last reply Reply Quote 0
                        • liv-in-sky
                          liv-in-sky @m0uh last edited by

                          @m0uh hoffentlich vergesse ich bis dahin nicht alles 🙂

                          bei mir funktioniert es mit dem beiden neuen scripten - du meldest dicheinfach , wenn du wieder zeit hast

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          458
                          Online

                          32.0k
                          Users

                          80.4k
                          Topics

                          1.3m
                          Posts

                          3
                          26
                          1442
                          Loading More Posts
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes
                          Reply
                          • Reply as topic
                          Log in to reply
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                          The ioBroker Community 2014-2023
                          logo