Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. JavaScript
    5. [Vorlage] Automatischer View-Wechsel u. Slideshow

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [Vorlage] Automatischer View-Wechsel u. Slideshow

    This topic has been deleted. Only users with topic management privileges can see it.
    • Chaot
      Chaot last edited by

      Bitte fragt mich nicht was das für ein Effekt war.
      Ich habe mich wegen Erkrankung meiner Mutter für ein paar Tage nicht mit dem Script beschäftigen können und es erst heute nochmals probiert.
      Und was soll ich sagen: Es läuft alles einwandfrei.
      Wechsel funktioniert ohne das die Views übereinandergelegt werden und auch der Timer läuft plötzlich.
      Vielleicht war ja irgendwas am System gestört. Da der Admin jeden Tag neu gestartet wird kann es das eventuell schon gewesen sein.

      Peoples 1 Reply Last reply Reply Quote 0
      • Peoples
        Peoples @Chaot last edited by

        @Chaot
        Na dann passts ja 👍

        1 Reply Last reply Reply Quote 0
        • S
          Saschag last edited by

          Hallo

          wenn ich das Script wie folgt ausführe schmiert die JavaScript Instanz ab ☹

          // *******************************************************************************************************
          //
          // Seitenwechsel-Script
          // Autor: Peoples
          //
          //
          // Funktionen:  1. Bei Viewwechsel wird geprüft ob eine andere View als Home gewählt ist
          //                 wenn das der Fall ist wird ein Timer gesetzt nach dessen Ablauf wieder zurück
          //                 auf Home gewechselt wird.
          //              2. Wenn die Alarmanlage eingeschalten ist wird die PinEingabeView angezeigt.
          //              3. Bei SystemView läuft kein Timer
          //
          //
          // v2.0.0 - 30.09.2018  Neue Version - Grundaufbau geändert
          // v2.0.1 - 09.03.2019  Slideshow aller gewünschen Views integriert
          // v2.0.2 - 23.03.2019  Zusatzfunktion zum steuern der Sonderdatenpunkte eingebaut
          // v2.0.3 - 28.03.2019  Zahlenwerte durch parseInt konvertiert
          // *******************************************************************************************************
           
          // -----------------------------------------------------------------------------
          // allgemeine Variablen
          // -----------------------------------------------------------------------------
          var logging = true;                                        // Logging on/off
          var instanz = 'javascript.0';   instanz = instanz + '.';    // 
                                                                      //
          var pfad0 =   'vis-Scripte';      pfad0 = pfad0 + '.';  // Pfad innerhalb der Instanz 
          var timerTout;
          var timerAutoSV;
          var DefaultView = 'pageStart';                                   // Standard-View
           
          // Aus Datenpunkt vis.0.control.data entnehmen 
          // der Teil vor dem Slash ist der Projektname:
          // "Wandtablet/Home"
          var project = "main";     project = project + '/';    // Name des Vis-Projekts
           
          var DisplayTime = '60';    // Darstellungszeit der Views bei Autowechsel
          var startView = 1;  // Startview bei Autowechsel
           
          //Alle vorhandenen Views
          var VisViews = [
              
                  /* View Name */                  /* Anzeigezeit */   /* In Slideshow anzeigen? */
           
              {'view':'page1',                        'SWSec':120,            'ShowIAV':'no'},
              {'view':'page3',                        'SWSec':120,            'ShowIAV':'no'},
              {'view':'page4',                        'SWSec':120,            'ShowIAV':'no'},
              {'view':'page5',                        'SWSec':120,            'ShowIAV':'no'},
              {'view':'page6',                        'SWSec':120,            'ShowIAV':'no'},
              {'view':'page7',                        'SWSec':120,            'ShowIAV':'no'},
              {'view':'page8',                        'SWSec':120,            'ShowIAV':'no'},
              {'view':'page9',                        'SWSec':120,            'ShowIAV':'no'},
              {'view':'page10',                       'SWSec':120,            'ShowIAV':'no'},
          ];
          // -----------------------------------------------------------------------------
          // Objekte
          // -----------------------------------------------------------------------------
          // Objekt für Alle Automatischen Abläufe
          createState(pfad0 + 'Timer_View_Switch',  {def: '0',type: 'number',name: 'Timer für Wechsel auf DefaultView'});
          createState(pfad0 + 'Auto_Switch_View',  {def: 'false',type: 'boolean',name: 'Alle Views durchlaufen lassen'});
           
           
          if(logging)log("Total "+Object.keys(VisViews).length+" entries");
           
          // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
          // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
          // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
          // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
           
          // #############################################################################
          // #                                                                           #
          // #  Funktion zum automatischen Viewwechsel nach Timerablauf                  #
          // #                                                                           #
          // #############################################################################
           
          function switchToHomeView() {
                  timerTout = setTimeout(function () {
                      var timer = parseInt(getState(pfad0 + 'Timer_View_Switch').val, 10);
                      if (timer > 1) {
                          setState(pfad0 + 'Timer_View_Switch',timer - 1);
                          switchToHomeView();
                      }
                      else{
                          setState(pfad0 + 'Timer_View_Switch', 0);
                          setState('vis.0.control.instance', 'FFFFFFFF'); //getState("vis.0.control.instance").val/*Control vis*/);
                          setState('vis.0.control.data', project + DefaultView);
                          setState('vis.0.control.command', 'changeView');
                      }
                  }, 1000);
          }
           
          // #############################################################################
          // #                                                                           #
          // #  Funktion zum automatisch umlaufenden Viewwechsel                         #
          // #                                                                           #
          // #############################################################################
           
          function autoSwitchView(dspTime,i) {
                  if(i === '') i = 0;
                  log(i);
                  if(i < Object.keys(VisViews).length){
                      if(VisViews[i].ShowIAV == 'yes'){
                          timerAutoSV = setTimeout(function () {
                              var timer = parseInt(getState(pfad0 + 'Timer_View_Switch').val, 10);
                              if (timer > 1) {
                                  setState(pfad0 + 'Timer_View_Switch', timer - 1);
                                  autoSwitchView(dspTime, i);
                              }
                              else{
                                      setState(pfad0 + 'Timer_View_Switch', 0);
                                      if(getState(pfad0 + 'Auto_Switch_View').val === true) switchView(project+VisViews[i].view);
                                      startAutoSwitchView(dspTime,(i+1));
                              }
                          }, 1000);
                      }
                      else{
                          startAutoSwitchView(dspTime,(i+1));
                      }
                  }
                  else{
                     startAutoSwitchView(dspTime,startView); 
                  }
          }
           
          // #############################################################################
          // #                                                                           #
          // #  Funktion zum Starten und Stoppen des automatischen Viewwechsel           #
          // #                                                                           #
          // #############################################################################
          function startAutoSwitchView(dspTime,i){
              if(getState(pfad0 + 'Auto_Switch_View').val === true){
                  if(dspTime !== ''){
                      setState(pfad0 + 'Timer_View_Switch',parseInt(dspTime, 10));
                  }
                  else{
                      setState(pfad0 + 'Timer_View_Switch',15);
                  }
                  autoSwitchView(dspTime,i);
              } 
              else{
                  if(timerTout) clearTimeout(timerTout);
                  switchView(project + DefaultView);
                  setStateDelayed(pfad0 + 'Timer_View_Switch',0,2000);
              }
          }
          //
          // Beobachten des View Datenpunktes
          on({id:"javascript.0.vis-Scripte.Auto_Switch_View", change: "ne"}, function (dp) {
              startAutoSwitchView(DisplayTime,startView);
          });
           
          // #############################################################################
          // #                                                                           #
          // #  Funktion zum Scriptbasierten Viewwechsel                                 #
          // #                                                                           #
          // #############################################################################
           
          function switchView(view){
              setState('vis.0.control.instance', 'FFFFFFFF');
              setState('vis.0.control.data', view);
              setState('vis.0.control.command', 'changeView');
          }
           
          // #############################################################################
          // #                                                                           #
          // #  Funktion zum Prüfen der Wunsch View und zum auslesen der Darstellzeit    #
          // #                                                                           #
          // #############################################################################
           
          function checkView(wishView){
              if(logging) log('View to check:'+wishView);
              if(getState(pfad0 + 'Auto_Switch_View').val === false ){
                  for(var i = 0; i < Object.keys(VisViews).length; i++) {  
                      if(project+VisViews[i].view == wishView) {
                          if(logging) log('View found in:' + i);
                          if(timerTout) clearTimeout(timerTout);
                          setState(pfad0 + 'Timer_View_Switch', 0);
                          if(VisViews[i].SWSec !== 0){
                              setState(pfad0 + 'Timer_View_Switch', VisViews[i].SWSec);
                              switchToHomeView();
                          }
                      }
                  }
              }
          }
           
          // Beobachten des View Datenpunktes für Auswertung
          on({id:"vis.0.control.data", change: "ne"}, function (dp) {
              checkView(dp.state.val);
          });
           
           
           
           
          //Bei Bewegung auf Kamerabild umschalten
          on({id:"hm-rpc.0.xxxxxxxxx.1.MOTION"/*Bewegungsmelder.xxxxxxxxxx:1.MOTION*/, change: 'any'}, function (dp) {
               if(getState("javascript.0.Alarmanlage.Status.Status").val != 2 || getState("javascript.0.Alarmanlage.Status.Status").val != '2'){
                  checkView('Kamera_Garage');
               }
               else{
                  checkView('Alarmanlage_code');
              }
          });
           
           
          

          sieht jemand einen Fehler oder eine Idee??? Hilfe 😓

          Log:

          javascript.0	2019-03-29 23:05:18.490	info	received all objects
          javascript.0	2019-03-29 23:05:10.384	info	received all states
          javascript.0	2019-03-29 23:05:06.206	info	requesting all objects
          javascript.0	2019-03-29 23:05:06.194	info	requesting all states
          javascript.0	2019-03-29 23:05:06.172	info	starting. Version 4.1.12 in /opt/iobroker/node_modules/iobroker.javascript, node: v8.15.0
          javascript.0	2019-03-29 23:05:05.929	info	States connected to redis: 127.0.0.1:6379
          host.ioBroker-RasPi	2019-03-29 23:05:04.814	info	instance system.adapter.dwd.0 terminated with code 0 (OK)
          hm-rpc.1	2019-03-29 23:05:04.643	info	new CUxD devices/channels after filter: 0
          hm-rpc.1	2019-03-29 23:05:04.622	info	Connected
          hm-rpc.1	2019-03-29 23:05:04.589	info	binrpc -> listDevices 61
          hm-rpc.1	2019-03-29 23:05:03.852	info	binrpc client is trying to connect to 192.168.0.129:8701/ with ["xmlrpc_bin://192.168.0.144:18701","hm-rpc.1"]
          hm-rpc.1	2019-03-29 23:05:03.851	info	binrpc server is trying to listen on 192.168.0.144:18701
          dwd.0	2019-03-29 23:05:03.830	info	starting. Version 2.4.3 in /opt/iobroker/node_modules/iobroker.dwd, node: v8.15.0
          dwd.0	2019-03-29 23:05:03.710	info	States connected to redis: 127.0.0.1:6379
          hm-rpc.1	2019-03-29 23:05:03.294	info	starting. Version 1.9.9 in /opt/iobroker/node_modules/iobroker.hm-rpc, node: v8.15.0
          hm-rpc.1	2019-03-29 23:05:03.079	info	States connected to redis: 127.0.0.1:6379
          host.ioBroker-RasPi	2019-03-29 23:05:00.099	info	instance system.adapter.dwd.0 started with pid 1085
          host.ioBroker-RasPi	2019-03-29 23:05:00.061	info	instance system.adapter.javascript.0 started with pid 1084
          host.ioBroker-RasPi	2019-03-29 23:04:59.988	info	instance system.adapter.hm-rpc.1 started with pid 1083
          history.0	2019-03-29 23:04:31.020	warn	Reconnection to DB.
          socketio.0	2019-03-29 23:04:31.030	warn	Reconnection to DB.
          backitup.0	2019-03-29 23:04:31.003	warn	Reconnection to DB.
          socketio.0	2019-03-29 23:04:31.009	warn	Reconnection to DB.
          backitup.0	2019-03-29 23:04:30.998	warn	Reconnection to DB.
          history.0	2019-03-29 23:04:30.982	warn	Reconnection to DB.
          hm-rega.1	2019-03-29 23:04:30.909	warn	Reconnection to DB.
          hm-rega.1	2019-03-29 23:04:30.902	warn	Reconnection to DB.
          bring.0	2019-03-29 23:04:30.859	warn	Reconnection to DB.
          bring.0	2019-03-29 23:04:30.856	warn	Reconnection to DB.
          web.0	2019-03-29 23:04:30.839	warn	Reconnection to DB.
          web.0	2019-03-29 23:04:30.834	warn	Reconnection to DB.
          cloud.0	2019-03-29 23:04:30.502	warn	Reconnection to DB.
          cloud.0	2019-03-29 23:04:30.496	warn	Reconnection to DB.
          hm-rpc.2	2019-03-29 23:04:30.459	warn	Reconnection to DB.
          hm-rpc.2	2019-03-29 23:04:30.453	warn	Reconnection to DB.
          host.ioBroker-RasPi	2019-03-29 23:04:29.966	info	Restart adapter system.adapter.javascript.0 because enabled
          host.ioBroker-RasPi	2019-03-29 23:04:29.966	error	instance system.adapter.javascript.0 terminated with code null ()
          host.ioBroker-RasPi	2019-03-29 23:04:29.966	warn	instance system.adapter.javascript.0 terminated due to SIGABRT
          Caught	2019-03-29 23:04:29.966	error	by controller[0]: FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
          host.ioBroker-RasPi	2019-03-29 23:04:29.940	info	Restart adapter system.adapter.hm-rpc.1 because enabled
          host.ioBroker-RasPi	2019-03-29 23:04:29.940	error	instance system.adapter.hm-rpc.1 terminated with code null ()
          host.ioBroker-RasPi	2019-03-29 23:04:29.939	warn	instance system.adapter.hm-rpc.1 terminated due to SIGABRT
          Caught	2019-03-29 23:04:29.928	error	by controller[0]: FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
          javascript.0	2019-03-29 23:04:05.343	info	received all states
          javascript.0	2019-03-29 23:04:01.906	info	requesting all objects
          javascript.0	2019-03-29 23:04:01.901	info	requesting all states
          javascript.0	2019-03-29 23:04:01.879	info	starting. Version 4.1.12 in /opt/iobroker/node_modules/iobroker.javascript, node: v8.15.0
          javascript.0	2019-03-29 23:04:01.811	info	States connected to redis: 127.0.0.1:6379
          host.ioBroker-RasPi	2019-03-29 23:03:56.076	info	instance system.adapter.javascript.0 started with pid 1073
          host.ioBroker-RasPi	2019-03-29 23:03:26.011	info	Restart adapter system.adapter.javascript.0 because enabled
          host.ioBroker-RasPi	2019-03-29 23:03:26.011	error	instance system.adapter.javascript.0 terminated with code null ()
          host.ioBroker-RasPi	2019-03-29 23:03:26.010	warn	instance system.adapter.javascript.0 terminated due to SIGABRT
          Caught	2019-03-29 23:03:25.997	error	by controller[0]: FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
          javascript.0	2019-03-29 23:03:23.660	info	received all states
          javascript.0	2019-03-29 23:03:19.271	info	requesting all objects
          javascript.0	2019-03-29 23:03:19.268	info	requesting all states
          javascript.0	2019-03-29 23:03:19.229	info	starting. Version 4.1.12 in /opt/iobroker/node_modules/iobroker.javascript, node: v8.15.0
          javascript.0	2019-03-29 23:03:19.101	info	States connected to redis: 127.0.0.1:6379
          backitup.0	2019-03-29 23:03:12.547	debug	system.adapter.admin.0: logging true
          backitup.0	2019-03-29 23:03:12.547	debug	redis pmessage io.*.logging io.system.adapter.admin.0.logging {"val":true,"ack":true,"ts":1553896992542,"q":0,"from":"system.adapter.admin.0","lc":1553896992542}
          host.ioBroker-RasPi	2019-03-29 23:03:11.118	info	instance system.adapter.javascript.0 started with pid 1063
          admin.0	2019-03-29 23:02:47.570	info	Repository received successfully.
          admin.0	2019-03-29 23:02:43.880	info	Use link "http://localhost:8081" to configure.
          admin.0	2019-03-29 23:02:43.880	info	http server listening on port 8081
          host.ioBroker-RasPi	2019-03-29 23:02:44.136	info	Update repository "default" under "http://download.iobroker.net/sources-dist.json"
          admin.0	2019-03-29 23:02:42.967	info	received all objects
          web.0	2019-03-29 23:02:42.647	info	==>Connected system.user.admin from ::ffff:192.168.0.206
          web.0	2019-03-29 23:02:42.500	info	==>Connected system.user.admin from ::ffff:192.168.0.206
          host.ioBroker-RasPi	2019-03-29 23:02:40.894	info	Restart adapter system.adapter.javascript.0 because enabled
          host.ioBroker-RasPi	2019-03-29 23:02:40.894	error	instance system.adapter.javascript.0 terminated with code null ()
          host.ioBroker-RasPi	2019-03-29 23:02:40.894	warn	instance system.adapter.javascript.0 terminated due to SIGABRT
          Caught	2019-03-29 23:02:40.880	error	by controller[0]: FATAL ERROR: Committing semi space failed. Allocation failed - process out of memory
          javascript.0	2019-03-29 23:02:31.990	info	received all states
          admin.0	2019-03-29 23:02:29.045	info	received all states
          javascript.0	2019-03-29 23:02:28.405	info	requesting all objects
          javascript.0	2019-03-29 23:02:28.401	info	requesting all states
          javascript.0	2019-03-29 23:02:28.375	info	starting. Version 4.1.12 in /opt/iobroker/node_modules/iobroker.javascript, node: v8.15.0
          javascript.0	2019-03-29 23:02:27.636	info	States connected to redis: 127.0.0.1:6379
          admin.0	2019-03-29 23:02:25.305	info	Request actual repository...
          admin.0	2019-03-29 23:02:25.303	info	requesting all objects
          admin.0	2019-03-29 23:02:25.299	info	requesting all states
          admin.0	2019-03-29 23:02:25.267	info	starting. Version 3.6.0 in /opt/iobroker/node_modules/iobroker.admin, node: v8.15.0
          admin.0	2019-03-29 23:02:25.255	error	setObject id missing!!
          admin.0	2019-03-29 23:02:25.072	info	States connected to redis: 127.0.0.1:6379
          host.ioBroker-RasPi	2019-03-29 23:02:20.457	info	instance system.adapter.javascript.0 started with pid 1009
          host.ioBroker-RasPi	2019-03-29 23:02:20.409	info	instance system.adapter.admin.0 started with pid 1008
          web.0	2019-03-29 23:01:54.244	info	<==Disconnect system.user.admin from ::ffff:192.168.0.206
          hm-rpc.1	2019-03-29 23:01:51.203	warn	Reconnection to DB.
          bring.0	2019-03-29 23:01:51.175	warn	Reconnection to DB.
          hm-rpc.1	2019-03-29 23:01:51.195	warn	Reconnection to DB.
          web.0	2019-03-29 23:01:51.166	warn	Reconnection to DB.
          bring.0	2019-03-29 23:01:51.159	warn	Reconnection to DB.
          web.0	2019-03-29 23:01:51.149	warn	Reconnection to DB.
          host.ioBroker-RasPi	2019-03-29 23:01:50.386	info	Restart adapter system.adapter.javascript.0 because enabled
          host.ioBroker-RasPi	2019-03-29 23:01:50.386	error	instance system.adapter.javascript.0 terminated with code null ()
          host.ioBroker-RasPi	2019-03-29 23:01:50.385	warn	instance system.adapter.javascript.0 terminated due to SIGABRT
          Caught	2019-03-29 23:01:50.385	error	by controller[0]: FATAL ERROR: NewSpace::Rebalance Allocation failed - process out of memory
          host.ioBroker-RasPi	2019-03-29 23:01:50.366	info	Restart adapter system.adapter.admin.0 because enabled
          host.ioBroker-RasPi	2019-03-29 23:01:50.365	error	instance system.adapter.admin.0 terminated with code null ()
          backitup.0	2019-03-29 23:01:50.393	debug	system.adapter.admin.0: logging false
          backitup.0	2019-03-29 23:01:50.392	debug	redis pmessage io.*.logging io.system.adapter.admin.0.logging {"val":false,"ack":true,"ts":1553896910390,"q":0,"from":"system.host.ioBroker-RasPi","lc":1553896879617}
          host.ioBroker-RasPi	2019-03-29 23:01:50.358	warn	instance system.adapter.admin.0 terminated due to SIGABRT
          javascript.0	2019-03-29 23:01:29.673	info	received all states
          javascript.0	2019-03-29 23:01:26.236	info	requesting all objects
          javascript.0	2019-03-29 23:01:26.222	info	requesting all states
          javascript.0	2019-03-29 23:01:26.201	info	starting. Version 4.1.12 in /opt/iobroker/node_modules/iobroker.javascript, node: v8.15.0
          javascript.0	2019-03-29 23:01:26.146	info	States connected to redis: 127.0.0.1:6379
          host.ioBroker-RasPi	2019-03-29 23:01:21.897	info	instance system.adapter.javascript.0 started with pid 998
          
          Peoples 1 Reply Last reply Reply Quote 0
          • Peoples
            Peoples @Saschag last edited by

            @Saschag
            Was hast du für eine Javascript-Adapter Version?
            Poste auch mal dein Script inkl. deiner Angaben die du gemacht hast, vielleicht hat sich dort ein Fehler eingeschlichen

            S 1 Reply Last reply Reply Quote 0
            • S
              Saschag @Peoples last edited by

              @Peoples

              JS 4.1.12

              Script siehe oben

              Peoples 1 Reply Last reply Reply Quote 0
              • Peoples
                Peoples @Saschag last edited by

                @Saschag
                Deine Startseite stimmt oder also die Großschreibung?
                Ich benutze den Js-Adapter in der Version 3.6.4 weil ich den Editor der 4er schrecklich finde. Daher kann ich nicht sagen ob das evtl. Noch ein Bug ist.

                Was haben denn die anderen für Versionen?

                S 1 Reply Last reply Reply Quote 0
                • S
                  Saschag @Peoples last edited by

                  @Peoples

                  Ja die Startseite ist „pageStart“

                  1 Reply Last reply Reply Quote 0
                  • M
                    MyMeyer last edited by MyMeyer

                    Hallo, das Script läuft prima bei mir nur stört es mich das es ständig LOG schreibt.
                    Ich habe logging auf "false" aber sobald die Automatik an ist schreibt es ständig.

                    Script:


                    // -----------------------------------------------------------------------------
                    // allgemeine Variablen
                    // -----------------------------------------------------------------------------
                    var logging = false; // Logging on/off
                    var instanz = 'javascript.0'; instanz = instanz + '.'; //
                    //
                    var pfad0 = 'Tablet.Wechsel'; pfad0 = pfad0 + '.'; // Pfad innerhalb der Instanz
                    var timerTout;
                    var timerAutoSV;
                    var DefaultView = 'Uhr';

                    Log:

                    javascript.0 2019-05-05 21:27:13.711 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:12.711 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:11.710 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:10.709 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:09.708 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:08.708 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:07.707 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:06.707 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:05.706 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:04.705 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:03.704 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:02.703 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:01.702 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:27:00.702 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:59.701 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:58.700 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:57.699 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:56.698 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:55.697 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:54.696 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:53.696 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:52.694 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:51.693 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:50.693 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:49.692 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:48.692 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:47.691 info script.js.Allgemein.VIS-Wechsel: 2
                    javascript.0 2019-05-05 21:26:46.690 info script.js.Allgemein.VIS-Wechsel: 1

                    Gruß
                    MyMeyer

                    Peoples 1 Reply Last reply Reply Quote 0
                    • Peoples
                      Peoples @MyMeyer last edited by

                      @MyMeyer sagte in [Vorlage] Automatischer View-Wechsel u. Slideshow:

                      Tablet.Wechsel'; pfad0 = pfad0 + '.'; // Pfad innerhalb der Instanz
                      var timerTout;
                      var timerAutoS

                      Hi,
                      ersetze mal in Zeile 117 (bei mir) das:
                      log(i);

                      gegen:
                      if(logging) log(i);

                      und gib Bescheid ob das funktioniert hat.

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        MyMeyer @Peoples last edited by

                        @Peoples sagte in [Vorlage] Automatischer View-Wechsel u. Slideshow:

                        @MyMeyer sagte in [Vorlage] Automatischer View-Wechsel u. Slideshow:

                        Tablet.Wechsel'; pfad0 = pfad0 + '.'; // Pfad innerhalb der Instanz
                        var timerTout;
                        var timerAutoS

                        Hi,
                        ersetze mal in Zeile 117 (bei mir) das:
                        log(i);

                        gegen:
                        if(logging) log(i);

                        und gib Bescheid ob das funktioniert hat.

                        @Peoples ,Ja prima jetzt läuft korrekt .
                        Danke.

                        1 Reply Last reply Reply Quote 0
                        • A
                          Andre R. last edited by

                          var pfad0 = Pfad innerhalb der Instanz

                          was ist damit gemeint steh grad völlig auf dem Schlauch

                          Glasfaser 1 Reply Last reply Reply Quote 0
                          • Glasfaser
                            Glasfaser @Andre R. last edited by Glasfaser

                            @Andre-R

                            Da kannst Du den Namen des Ordners selber bestimmen .

                            Beispiel : Order als " Pfandname " beschriftet

                            88888888888888.JPG

                            6666666666666666666666.JPG

                            1 Reply Last reply Reply Quote 0
                            • A
                              Andre R. last edited by

                              hmmm bekomme es nicht zum laufen

                              Chaot Peoples 2 Replies Last reply Reply Quote 0
                              • Chaot
                                Chaot @Andre R. last edited by

                                @Andre-R
                                Was hast du denn als Pfadname drin?
                                Oder anders gesagt hast du den korrekt drin?
                                Beispiel:
                                VIS Adresse lautet: http://192.168.xx.xx:8082/vis/index.html?Neu#Info
                                dann lautet der Pfadname hier "Neu"
                                Der default View in dem Fall "Info" und die restlichen Views entsprechend der Namen die vergeben sind.

                                ...// allgemeine Variablen
                                // -----------------------------------------------------------------------------
                                var logging = true;                                        // Logging on/off
                                var instanz = 'javascript.0';   instanz = instanz + '.';    // 
                                                                                            //
                                var pfad0 =   'System.Iobroker';      pfad0 = pfad0 + '.';  // Pfad innerhalb der Instanz 
                                var timerTout;
                                var timerAutoSV;
                                var DefaultView = 'Info';                                   // Standard-View
                                 
                                // Aus Datenpunkt vis.0.control.data entnehmen 
                                // der Teil vor dem Slash ist der Projektname:
                                // "Wandtablet/Home"
                                var project = "Neu";     project = project + '/';    // Name des Vis-Projekts
                                 
                                var DisplayTime = '25';    // Darstellungszeit der Views bei Autowechsel
                                var startView = 1;  // Startview bei Autowechsel
                                 
                                //Alle vorhandenen Views
                                var VisViews = [
                                    
                                        /* View Name */              /* Anzeigezeit in Sek. */   /* In Slideshow anzeigen? */
                                       /* ohne Projekt */          /* 0 = kein Auto Wechsel */   /* In Slideshow anzeigen? */
                                 
                                    {'view':'Alexa',                        'SWSec':60,             'ShowIAV':'no'},
                                    {'view':'Aquarium',                     'SWSec':60,             'ShowIAV':'no'},
                                    {'view':'Ausgang',                      'SWSec':60,             'ShowIAV':'no'},
                                    {'view':'BadHeiz',                      'SWSec':60,             'ShowIAV':'no'},
                                ....
                                
                                1 Reply Last reply Reply Quote 0
                                • Peoples
                                  Peoples @Andre R. last edited by Peoples

                                  @Andre-R
                                  Wie Chaot schon geschrieben hat, gib uns doch mal die genaue Adresse unter der du dein Vis-Projekt anzeigen lässt am Tablet oder PC oder so.

                                  Vielleicht bastel ich da doch mal einen Adapter mit Drop-Down Feldern. Muss ich mir mal anschauen

                                  1 Reply Last reply Reply Quote 0
                                  • A
                                    Andre R. last edited by

                                    http://192.168.xxx.xx:8082/vis/index.html#Home

                                    und so schaut das Script aus

                                    // *******************************************************************************************************
                                    
                                    //
                                    
                                    // Seitenwechsel-Script
                                    
                                    // Autor: Peoples
                                    
                                    //
                                    
                                    //
                                    
                                    // Funktionen:  1. Bei Viewwechsel wird geprüft ob eine andere View als Home gewählt ist
                                    
                                    //                 wenn das der Fall ist wird ein Timer gesetzt nach dessen Ablauf wieder zurück
                                    
                                    //                 auf Home gewechselt wird.
                                    
                                    //              2. Wenn die Alarmanlage eingeschalten ist wird die PinEingabeView angezeigt.
                                    
                                    //              3. Bei SystemView läuft kein Timer
                                    
                                    //
                                    
                                    //
                                    
                                    // v2.0.0 - 30.09.2018  Neue Version - Grundaufbau geändert
                                    
                                    // v2.0.1 - 09.03.2019  Slideshow aller gewünschen Views integriert
                                    
                                    // v2.0.2 - 23.03.2019  Zusatzfunktion zum steuern der Sonderdatenpunkte eingebaut
                                    
                                    // v2.0.3 - 28.03.2019  Zahlenwerte durch parseInt konvertiert
                                    
                                    // *******************************************************************************************************
                                    
                                     
                                    
                                    // -----------------------------------------------------------------------------
                                    
                                    // allgemeine Variablen
                                    
                                    // -----------------------------------------------------------------------------
                                    
                                    var logging = true;                                        // Logging on/off
                                    
                                    var instanz = 'javascript.0';   instanz = instanz + '.';    // 
                                    
                                                                                                //
                                    
                                    var pfad0 =   'javascript.0.System.Iobroker';      pfad0 = pfad0 + '.';  // Pfad innerhalb der Instanz 
                                    
                                    var timerTout;
                                    
                                    var timerAutoSV;
                                    
                                    var DefaultView = 'Home';                                   // Standard-View
                                    
                                     
                                    // Aus Datenpunkt vis.0.control.data entnehmen 
                                    
                                    // der Teil vor dem Slash ist der Projektname:
                                    
                                    // "Wandtablet/Home"
                                    
                                    var project = "main";     project = project + '/';    // Name des Vis-Projekts
                                    
                                     
                                    
                                    var DisplayTime = '10';    // Darstellungszeit der Views bei Autowechsel
                                    
                                    var startView = 1;  // Startview bei Autowechsel
                                    
                                     
                                    
                                    //Alle vorhandenen Views
                                    
                                    var VisViews = [
                                    
                                        
                                    
                                            /* View Name */                  /* Anzeigezeit */   /* In Slideshow anzeigen? */
                                    
                                     
                                    
                                        {'view':'Netzwerk',                     'SWSec':60,             'ShowIAV':'yes'},
                                    
                                        {'view':'Multimedia',                   'SWSec':60,             'ShowIAV':'yes'},
                                    
                                        {'view':'Kamera',                       'SWSec':60,             'ShowIAV':'yes'},
                                    
                                        {'view':'Musik',                        'SWSec':60,             'ShowIAV':'yes'},
                                    
                                        {'view':'Spotify',                      'SWSec':60,             'ShowIAV':'yes'},
                                    
                                        {'view':'1_Proxmox_stats',               'SWSec':60,             'ShowIAV':'no'},
                                    
                                        {'view':'2_IObroker_stats',              'SWSec':40,             'ShowIAV':'no'},
                                    
                                        {'view':'3_NAS_stats',                   'SWSec':180,            'ShowIAV':'no'},
                                    
                                        {'view':'3D_Drucker',                    'SWSec':180,            'ShowIAV':'yes'},
                                    
                                        {'view':'4_Fritzbox4040_stats',          'SWSec':90,             'ShowIAV':'no'},
                                    
                                        {'view':'Home',                          'SWSec':60,              'ShowIAV':'yes'},
                                    
                                        {'view':'Kameras',                       'SWSec':90,             'ShowIAV':'yes'},
                                    
                                        {'view':'5_MotionEye_stats',              'SWSec':60,             'ShowIAV':'no'},
                                    
                                        {'view':'6_Fritzbox4020_stats',           'SWSec':60,             'ShowIAV':'no'},
                                    
                                        {'view':'Energie',                        'SWSec':60,            'ShowIAV':'yes'},
                                    
                                        {'view':'Multimedia',                     'SWSec':60,            'ShowIAV':'yes'},
                                    
                                        {'view':'Netzwerk',                       'SWSec':60,             'ShowIAV':'yes'},
                                    
                                        {'view':'Pflanzen',                       'SWSec':60,            'ShowIAV':'yes'},
                                    
                                        {'view':'Saugi',                          'SWSec':60,            'ShowIAV':'yes'},
                                    
                                        {'view':'Sonos_Bad',                      'SWSec':60,              'ShowIAV':'no'},
                                    
                                        {'view':'Sonos_Schlaf',                   'SWSec':60,            'ShowIAV':'no'},
                                    
                                        {'view':'Sonos_Wohn',                     'SWSec':60,            'ShowIAV':'yes'},
                                    
                                        {'view':'Statistik',                      'SWSec':60,             'ShowIAV':'yes'},
                                    
                                        {'view':'Spotify',                        'SWSec':60,            'ShowIAV':'yes'},
                                    
                                         {'view':'test',                           'SWSec':0,            'ShowIAV':'no'}
                                    
                                    ];
                                    
                                    // -----------------------------------------------------------------------------
                                    
                                    // Objekte
                                    
                                    // -----------------------------------------------------------------------------
                                    
                                    // Objekt für Alle Automatischen Abläufe
                                    
                                    createState(pfad0 + 'Timer_View_Switch',  {def: '0',type: 'number',name: 'Timer für Wechsel auf DefaultView'});
                                    
                                    createState(pfad0 + 'Auto_Switch_View',  {def: 'true',type: 'boolean',name: 'Alle Views durchlaufen lassen'});
                                    
                                     
                                    
                                     
                                    
                                    if(logging)log("Total "+Object.keys(VisViews).length+" entries");
                                    
                                     
                                    
                                    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
                                    
                                    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
                                    
                                    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
                                    
                                    // $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
                                    
                                     
                                    
                                    // #############################################################################
                                    
                                    // #                                                                           #
                                    
                                    // #  Funktion zum automatischen Viewwechsel nach Timerablauf                  #
                                    
                                    // #                                                                           #
                                    
                                    // #############################################################################
                                    
                                     
                                    
                                    function switchToHomeView() {
                                    
                                            timerTout = setTimeout(function () {
                                    
                                                var timer = parseInt(getState(pfad0 + 'Timer_View_Switch').val, 10);
                                    
                                                if (timer > 1) {
                                    
                                                    setState(pfad0 + 'Timer_View_Switch',timer - 1);
                                    
                                                    switchToHomeView();
                                    
                                                }
                                    
                                                else{
                                    
                                                    setState(pfad0 + 'Timer_View_Switch', 0);
                                    
                                                    setState('vis.0.control.instance', 'FFFFFFFF'); //getState("vis.0.control.instance").val/*Control vis*/);
                                    
                                                    setState('vis.0.control.data', project + DefaultView);
                                    
                                                    setState('vis.0.control.command', 'changeView');
                                    
                                                }
                                    
                                            }, 1000);
                                    
                                    }
                                    
                                     
                                    
                                    // #############################################################################
                                    
                                    // #                                                                           #
                                    
                                    // #  Funktion zum automatisch umlaufenden Viewwechsel                         #
                                    
                                    // #                                                                           #
                                    
                                    // #############################################################################
                                    
                                     
                                    
                                    function autoSwitchView(dspTime,i) {
                                    
                                            if(i === '') i = 0;
                                    
                                            log(i);
                                    
                                            if(i < Object.keys(VisViews).length){
                                    
                                                if(VisViews[i].ShowIAV == 'yes'){
                                    
                                                    timerAutoSV = setTimeout(function () {
                                    
                                                        var timer = parseInt(getState(pfad0 + 'Timer_View_Switch').val, 10);
                                    
                                                        if (timer > 1) {
                                    
                                                            setState(pfad0 + 'Timer_View_Switch', timer - 1);
                                    
                                                            autoSwitchView(dspTime, i);
                                    
                                                        }
                                    
                                                        else{
                                    
                                                                setState(pfad0 + 'Timer_View_Switch', 0);
                                    
                                                                if(getState(pfad0 + 'Auto_Switch_View').val === true) switchView(project+VisViews[i].view);
                                    
                                                                startAutoSwitchView(dspTime,(i+1));
                                    
                                                        }
                                    
                                                    }, 1000);
                                    
                                                }
                                    
                                                else{
                                    
                                                    startAutoSwitchView(dspTime,(i+1));
                                    
                                                }
                                    
                                            }
                                    
                                            else{
                                    
                                               startAutoSwitchView(dspTime,startView); 
                                    
                                            }
                                    
                                    }
                                    
                                     
                                    
                                    // #############################################################################
                                    
                                    // #                                                                           #
                                    
                                    // #  Funktion zum Starten und Stoppen des automatischen Viewwechsel           #
                                    
                                    // #                                                                           #
                                    
                                    // #############################################################################
                                    
                                    function startAutoSwitchView(dspTime,i){
                                    
                                        if(getState(pfad0 + 'Auto_Switch_View').val === true){
                                    
                                            if(dspTime !== ''){
                                    
                                                setState(pfad0 + 'Timer_View_Switch',parseInt(dspTime, 10));
                                    
                                            }
                                    
                                            else{
                                    
                                                setState(pfad0 + 'Timer_View_Switch',15);
                                    
                                            }
                                    
                                            autoSwitchView(dspTime,i);
                                    
                                        } 
                                    
                                        else{
                                    
                                            if(timerTout) clearTimeout(timerTout);
                                    
                                            switchView(project + DefaultView);
                                    
                                            setStateDelayed(pfad0 + 'Timer_View_Switch',0,2000);
                                    
                                        }
                                    
                                    }
                                    
                                    //
                                    
                                    // Beobachten des View Datenpunktes
                                    
                                    on({id:"javascript.0.System.Iobroker.Auto_Switch_View", change: "ne"}, function (dp) {
                                    
                                        startAutoSwitchView(DisplayTime,startView);
                                    
                                    });
                                    
                                     
                                    
                                    // #############################################################################
                                    
                                    // #                                                                           #
                                    
                                    // #  Funktion zum Scriptbasierten Viewwechsel                                 #
                                    
                                    // #                                                                           #
                                    
                                    // #############################################################################
                                    
                                     
                                    
                                    function switchView(view){
                                    
                                        setState('vis.0.control.instance', 'FFFFFFFF');
                                    
                                        setState('vis.0.control.data', view);
                                    
                                        setState('vis.0.control.command', 'changeView');
                                    
                                    }
                                    
                                     
                                    
                                    // #############################################################################
                                    
                                    // #                                                                           #
                                    
                                    // #  Funktion zum Prüfen der Wunsch View und zum auslesen der Darstellzeit    #
                                    
                                    // #                                                                           #
                                    
                                    // #############################################################################
                                    
                                     
                                    
                                    function checkView(wishView){
                                    
                                        if(logging) log('View to check:'+wishView);
                                    
                                        if(getState(pfad0 + 'Auto_Switch_View').val === false ){
                                    
                                            for(var i = 0; i < Object.keys(VisViews).length; i++) {  
                                    
                                                if(project+VisViews[i].view == wishView) {
                                    
                                                    if(logging) log('View found in:' + i);
                                    
                                                    if(timerTout) clearTimeout(timerTout);
                                    
                                                    setState(pfad0 + 'Timer_View_Switch', 0);
                                    
                                                    if(VisViews[i].SWSec !== 0){
                                    
                                                        setState(pfad0 + 'Timer_View_Switch', VisViews[i].SWSec);
                                    
                                                        switchToHomeView();
                                    
                                                    }
                                    
                                                }
                                    
                                            }
                                    
                                        }
                                    
                                    }
                                    
                                     
                                    
                                    // Beobachten des View Datenpunktes für Auswertung
                                    
                                    on({id:"vis.0.control.data", change: "ne"}, function (dp) {
                                    
                                        checkView(dp.state.val);
                                    
                                    });
                                    
                                     
                                    
                                     
                                    
                                     
                                    
                                     
                                    
                                    //Bei Bewegung auf Kamerabild umschalten
                                    
                                    on({id:"hm-rpc.0.xxxxxxxxx.1.MOTION"/*Bewegungsmelder.xxxxxxxxxx:1.MOTION*/, change: 'any'}, function (dp) {
                                    
                                         if(getState("javascript.0.Alarmanlage.Status.Status").val != 2 || getState("javascript.0.Alarmanlage.Status.Status").val != '2'){
                                    
                                            checkView('Kamera_Garage');
                                    
                                         }
                                    
                                         else{
                                    
                                            checkView('Alarmanlage_code');
                                    
                                        }
                                    
                                    });
                                    
                                     
                                    
                                     
                                    
                                    Glasfaser 1 Reply Last reply Reply Quote 0
                                    • Glasfaser
                                      Glasfaser @Andre R. last edited by Glasfaser

                                      @Andre-R sagte in [Vorlage] Automatischer View-Wechsel u. Slideshow:

                                      http://192.168.xxx.xx:8082/vis/index.html#Home

                                      und so schaut das Script aus

                                      > var pfad0 =   'javascript.0.System.Iobroker';      pfad0 = pfad0 + '.';  // Pfad innerhalb der >  
                                      

                                      lösche den Eintrag : javascript.0.

                                      So muss es aussehen : var pfad0 = 'System.Iobroker';

                                      A 1 Reply Last reply Reply Quote 0
                                      • A
                                        Andre R. @Glasfaser last edited by

                                        @Glasfaser sagte in [Vorlage] Automatischer View-Wechsel u. Slideshow:

                                        @Andre-R sagte in [Vorlage] Automatischer View-Wechsel u. Slideshow:

                                        http://192.168.xxx.xx:8082/vis/index.html#Home

                                        und so schaut das Script aus

                                        > var pfad0 =   'javascript.0.System.Iobroker';      pfad0 = pfad0 + '.';  // Pfad innerhalb der >  
                                        

                                        lösche den Eintrag : javascript.0.

                                        So muss es aussehen : var pfad0 = 'System.Iobroker';

                                        Hab ih auch schon probiert funktioniert trotzdem nicht.
                                        Muss das Script eigentlich in den glabal Ordner?

                                        Glasfaser 1 Reply Last reply Reply Quote 0
                                        • Glasfaser
                                          Glasfaser @Andre R. last edited by

                                          @Andre-R

                                          Nein bloß nicht in den Globale Ordner !!!!!!!!!

                                          A 1 Reply Last reply Reply Quote 0
                                          • A
                                            Andre R. @Glasfaser last edited by

                                            @Glasfaser sagte in [Vorlage] Automatischer View-Wechsel u. Slideshow:

                                            @Andre-R

                                            Nein bloß nicht in den Globale Ordner !!!!!!!!!

                                            Ok hab ich eh nicht

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

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate

                                            664
                                            Online

                                            31.9k
                                            Users

                                            80.1k
                                            Topics

                                            1.3m
                                            Posts

                                            22
                                            143
                                            18429
                                            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