Skip to content
  • Home
  • Recent
  • Tags
  • 0 Unread 0
  • Categories
  • Unreplied
  • Popular
  • GitHub
  • Docu
  • Hilfe
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
ioBroker Logo

Community Forum

donate donate
  1. ioBroker Community Home
  2. Deutsch
  3. Skripten / Logik
  4. JavaScript
  5. Kamera Steuerung (PTZ) mit Bewegungsmelder htp

NEWS

  • Neuer ioBroker-Blog online: Monatsrückblick März/April 2026
    BluefoxB
    Bluefox
    6
    1
    221

  • Verwendung von KI bitte immer deutlich kennzeichnen
    HomoranH
    Homoran
    8
    1
    217

  • Monatsrückblick Januar/Februar 2026 ist online!
    BluefoxB
    Bluefox
    18
    1
    891

Kamera Steuerung (PTZ) mit Bewegungsmelder htp

Scheduled Pinned Locked Moved JavaScript
45 Posts 3 Posters 3.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K kasperfunsurfer

    Servus,

    nee das ist es leider auch nicht. Die Kamera fährt keine Position mehr an sowie die Bewegungsmelder werden nicht zurück gesetzt. 😢

    Die Änderung hat doch was gebracht. Kamera fährt aber immer nur in eine Position nicht in die andere.
    Bewegungsmelder mihome.0.devices.sensor_motion_aq2_158d0002e30682.state Funktioniert mit 15sec. die anderen leider nicht.

    17:51:21.182 info javascript.0 Stop script script.js.Skript_57_enu
    17:51:22.034 info javascript.0 Start javascript script.js.Skript_57_enu
    17:51:22.035 info javascript.0 script.js.Skript_57_enu: registered 3 subscriptions and 0 schedules
    17:51:30.992 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true
    17:51:45.998 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: false
    17:51:59.304 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state: true
    17:51:59.305 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true
    17:53:59.129 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state: false

    paul53P Offline
    paul53P Offline
    paul53
    wrote on last edited by
    #36

    @kasperfunsurfer sagte:

    17:51:59.304 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state: true
    17:51:59.305 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true

    Zwischen beiden BWM ist nur 1 ms Abstand ! Wie kann das sein ?

    Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
    Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

    K 1 Reply Last reply
    0
    • paul53P paul53

      @kasperfunsurfer sagte:

      17:51:59.304 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state: true
      17:51:59.305 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true

      Zwischen beiden BWM ist nur 1 ms Abstand ! Wie kann das sein ?

      K Offline
      K Offline
      kasperfunsurfer
      wrote on last edited by kasperfunsurfer
      #37

      @paul53 hier nochmal das Script.

      const idMotion = ["mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state","mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state","mihome.0.devices.sensor_motion_aq2_158d0002e30682.state"];
      const url = 'http://******@192.168.2.110:81'; 
      var timer = null;
      
       
      
      on(idMotion, function(dp) {
      
      log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
         
         if(dp.state.val && !timer) { // Bewegung erkannt
      
         var pos = 0;
      
            if(dp.id = 'mihome.0.devices.sensor_motion_aq2_158d0002e30682.state') pos = 1;
      
            request(url + '/param.cgi?cmd=preset&-act=goto&-number=' + pos);
      
            
            timer = setTimeout(function() {
      
               request(url + '/CGI-COMMAND/param.cgi?cmd=pushhostalarm');
      
               setState(dp.id, false);  
      
               timer = null;
      
            }, 15000); // nach 15 s
      
         }
      
      });
      

      Wenn ich den denn mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state auf True setzte oder den den mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state: true kommt der andere Automatisch mit ?? Aber nur in dem Script in echt unter Objekte passiert das nicht da bleibt der mihome.0.devices.sensor_motion_aq2_158d0002e30682.state auf flase

      18:08:55.661 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state: true
      18:08:55.662 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true
      18:10:55.475 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state: false
      18:11:01.966 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state: true
      18:11:01.969 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true
      18:13:01.779 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state: false

      paul53P 1 Reply Last reply
      0
      • K kasperfunsurfer

        @paul53 hier nochmal das Script.

        const idMotion = ["mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state","mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state","mihome.0.devices.sensor_motion_aq2_158d0002e30682.state"];
        const url = 'http://******@192.168.2.110:81'; 
        var timer = null;
        
         
        
        on(idMotion, function(dp) {
        
        log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
           
           if(dp.state.val && !timer) { // Bewegung erkannt
        
           var pos = 0;
        
              if(dp.id = 'mihome.0.devices.sensor_motion_aq2_158d0002e30682.state') pos = 1;
        
              request(url + '/param.cgi?cmd=preset&-act=goto&-number=' + pos);
        
              
              timer = setTimeout(function() {
        
                 request(url + '/CGI-COMMAND/param.cgi?cmd=pushhostalarm');
        
                 setState(dp.id, false);  
        
                 timer = null;
        
              }, 15000); // nach 15 s
        
           }
        
        });
        

        Wenn ich den denn mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state auf True setzte oder den den mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state: true kommt der andere Automatisch mit ?? Aber nur in dem Script in echt unter Objekte passiert das nicht da bleibt der mihome.0.devices.sensor_motion_aq2_158d0002e30682.state auf flase

        18:08:55.661 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state: true
        18:08:55.662 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true
        18:10:55.475 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state: false
        18:11:01.966 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state: true
        18:11:01.969 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true
        18:13:01.779 info javascript.0 script.js.Skript_57_enu: mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state: false

        paul53P Offline
        paul53P Offline
        paul53
        wrote on last edited by
        #38

        @kasperfunsurfer
        Dann versuche es mal mit getrennten Triggern

        const idMotion1 = "mihome.0.devices.sensor_motion_aq2_158d000236b7e6.state";
        const idMotion2 = "mihome.0.devices.sensor_motion_aq2_158d0002e922d3.state";
        const idMotion3 = "mihome.0.devices.sensor_motion_aq2_158d0002e30682.state";
        const url = 'http://******@192.168.2.110:81'; 
        
        var timer = null;
        
        function kamera(id, pos) {
           request(url + '/param.cgi?cmd=preset&-act=goto&-number=' + pos);
           timer = setTimeout(function() {
              request(url + '/CGI-COMMAND/param.cgi?cmd=pushhostalarm');
              setState(id, false);  
              timer = null;
              log('Verzögert: ' + id);
           }, 15000); // nach 15 s
        }
        
        on(idMotion1, function(dp) {
           log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
           if(dp.state.val && !timer) kamera(dp.id, 0);
        });
        
        on(idMotion2, function(dp) {
           log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
           if(dp.state.val && !timer) kamera(dp.id, 0);
        });
        
        on(idMotion3, function(dp) {
           log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
           if(dp.state.val && !timer) kamera(dp.id, 1);
        });
        

        Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
        Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kasperfunsurfer
          wrote on last edited by
          #39

          @paul53 mal wieder sauber. So klappt es 👍 👍

          Wie war das jetzt mit der Funktion Abwesend ? Ist das so richtig ?

          const idAbwesend = 'hm-rega.950';
          
          on(idMotion1, function(dp) {
          
             log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
          
             if(dp.state.val && !timer && getState(idAbwesend).val) kamera(dp.id, 0);
          
          });
          
           
          
          on(idMotion2, function(dp) {
          
             log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
          
             if(dp.state.val && !timer  && getState(idAbwesend).val) kamera(dp.id, 0);
          
          });
          
           
          
          on(idMotion3, function(dp) {
          
             log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
          
             if(dp.state.val && !timer && getState(idAbwesend).val) kamera(dp.id, 1);
          
          });
          
          paul53P 1 Reply Last reply
          0
          • K kasperfunsurfer

            @paul53 mal wieder sauber. So klappt es 👍 👍

            Wie war das jetzt mit der Funktion Abwesend ? Ist das so richtig ?

            const idAbwesend = 'hm-rega.950';
            
            on(idMotion1, function(dp) {
            
               log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
            
               if(dp.state.val && !timer && getState(idAbwesend).val) kamera(dp.id, 0);
            
            });
            
             
            
            on(idMotion2, function(dp) {
            
               log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
            
               if(dp.state.val && !timer  && getState(idAbwesend).val) kamera(dp.id, 0);
            
            });
            
             
            
            on(idMotion3, function(dp) {
            
               log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
            
               if(dp.state.val && !timer && getState(idAbwesend).val) kamera(dp.id, 1);
            
            });
            
            paul53P Offline
            paul53P Offline
            paul53
            wrote on last edited by paul53
            #40

            @kasperfunsurfer sagte:

            Ist das so richtig ?

            Ja.
            Besser nur einmal in der Funktion abfragen.

            const url = 'http://******@192.168.2.110:81'; 
            const idMotion  = "mihome.0.devices.sensor_motion_aq2_158d000";
            const idMotion1 = idMotion + "236b7e6.state";
            const idMotion2 = idMotion + "2e922d3.state";
            const idMotion3 = idMotion + "2e30682.state";
            const idAbwesend = 'hm-rega.950';
            
            var timer = null;
            
            function kamera(id, pos) {
               if(getState(idAbwesend).val && !timer) {	
                  request(url + '/param.cgi?cmd=preset&-act=goto&-number=' + pos);
                  timer = setTimeout(function() {
                     request(url + '/CGI-COMMAND/param.cgi?cmd=pushhostalarm');
                     setState(id, false);  
                     timer = null;
                     log('Verzögert: ' + id);
                  }, 15000); // nach 15 s
               }
            }
            
            on(idMotion1, function(dp) {
               log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
               if(dp.state.val) kamera(dp.id, 0);
            });
            
            on(idMotion2, function(dp) {
               log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
               if(dp.state.val) kamera(dp.id, 0);
            });
            
            on(idMotion3, function(dp) {
               log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
               if(dp.state.val) kamera(dp.id, 1);
            });
            

            Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
            Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kasperfunsurfer
              wrote on last edited by kasperfunsurfer
              #41

              Hmm das gibt es schon wieder kleine Probleme

              19:44:14.373 info javascript.0 Stop script script.js.Skript_158_neuer
              19:44:14.415 info javascript.0 Start javascript script.js.Skript_158_neuer
              19:44:14.416 info javascript.0 script.js.Skript_158_neuer: registered 3 subscriptions and 0 schedules
              19:45:00.948 info javascript.0 script.js.Skript_158_neuer: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true
              19:45:00.951 warn javascript.0 at kamera (script.js.Skript_158_neuer:11:7)
              19:45:00.952 warn javascript.0 at Object.<anonymous> (script.js.Skript_158_neuer:34:21)
              19:47:00.758 info javascript.0 script.js.Skript_158_neuer: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: false

              paul53P 1 Reply Last reply
              0
              • K kasperfunsurfer

                Hmm das gibt es schon wieder kleine Probleme

                19:44:14.373 info javascript.0 Stop script script.js.Skript_158_neuer
                19:44:14.415 info javascript.0 Start javascript script.js.Skript_158_neuer
                19:44:14.416 info javascript.0 script.js.Skript_158_neuer: registered 3 subscriptions and 0 schedules
                19:45:00.948 info javascript.0 script.js.Skript_158_neuer: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: true
                19:45:00.951 warn javascript.0 at kamera (script.js.Skript_158_neuer:11:7)
                19:45:00.952 warn javascript.0 at Object.<anonymous> (script.js.Skript_158_neuer:34:21)
                19:47:00.758 info javascript.0 script.js.Skript_158_neuer: mihome.0.devices.sensor_motion_aq2_158d0002e30682.state: false

                paul53P Offline
                paul53P Offline
                paul53
                wrote on last edited by
                #42

                @kasperfunsurfer
                Damit ich ich die Zeilennummern in den Warnungen zuordnen kann, muss ich das Skript so sehen, wie es bei Dir läuft.

                Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
                Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kasperfunsurfer
                  wrote on last edited by kasperfunsurfer
                  #43
                  const url = 'http://+++++@192.168.2.110:81'; 
                  const idMotion  = "mihome.0.devices.sensor_motion_aq2_158d000";
                  const idMotion1 = idMotion + "236b7e6.state";
                  const idMotion2 = idMotion + "2e922d3.state";
                  const idMotion3 = idMotion + "2e30682.state";
                  const idAbwesend = 'hm-rega.950';
                  
                   var timer = null;
                  
                     function kamera(id, pos) {
                     if(getState(idAbwesend).val && !timer) {	
                        request(url + '/param.cgi?cmd=preset&-act=goto&-number=' + pos);
                        timer = setTimeout(function() {
                        request(url + '/CGI-COMMAND/param.cgi?cmd=pushhostalarm');
                        setState(id, false);  
                        timer = null;
                          log('Verzögert: ' + id);
                        }, 10000); // nach 10 s
                   }
                  }
                  
                   on(idMotion1, function(dp) {
                     log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
                     if(dp.state.val) kamera(dp.id, 0);
                  });
                  
                   on(idMotion2, function(dp) {
                     log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
                     if(dp.state.val) kamera(dp.id, 0);
                  });
                  
                   on(idMotion3, function(dp) {
                     log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
                     if(dp.state.val) kamera(dp.id, 1);
                  });
                  

                  Der Bewegungsmelder setzt sich auch wieder nicht zurück.....

                  paul53P 1 Reply Last reply
                  0
                  • K kasperfunsurfer
                    const url = 'http://+++++@192.168.2.110:81'; 
                    const idMotion  = "mihome.0.devices.sensor_motion_aq2_158d000";
                    const idMotion1 = idMotion + "236b7e6.state";
                    const idMotion2 = idMotion + "2e922d3.state";
                    const idMotion3 = idMotion + "2e30682.state";
                    const idAbwesend = 'hm-rega.950';
                    
                     var timer = null;
                    
                       function kamera(id, pos) {
                       if(getState(idAbwesend).val && !timer) {	
                          request(url + '/param.cgi?cmd=preset&-act=goto&-number=' + pos);
                          timer = setTimeout(function() {
                          request(url + '/CGI-COMMAND/param.cgi?cmd=pushhostalarm');
                          setState(id, false);  
                          timer = null;
                            log('Verzögert: ' + id);
                          }, 10000); // nach 10 s
                     }
                    }
                    
                     on(idMotion1, function(dp) {
                       log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
                       if(dp.state.val) kamera(dp.id, 0);
                    });
                    
                     on(idMotion2, function(dp) {
                       log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
                       if(dp.state.val) kamera(dp.id, 0);
                    });
                    
                     on(idMotion3, function(dp) {
                       log(dp.id + ': ' + dp.state.val); // eingefügte Log-Zeile
                       if(dp.state.val) kamera(dp.id, 1);
                    });
                    

                    Der Bewegungsmelder setzt sich auch wieder nicht zurück.....

                    paul53P Offline
                    paul53P Offline
                    paul53
                    wrote on last edited by
                    #44

                    @kasperfunsurfe:

                    const idAbwesend = 'hm-rega.950';

                    Fehlt da nicht die Instanz-Nummer ?

                    const idAbwesend = 'hm-rega.0.950';
                    

                    Bitte verzichtet auf Chat-Nachrichten, denn die Handhabung ist grauenhaft !
                    Produktiv: RPi 2 mit S.USV, HM-MOD-RPI und SLC-USB-Stick mit root fs

                    K 1 Reply Last reply
                    0
                    • paul53P paul53

                      @kasperfunsurfe:

                      const idAbwesend = 'hm-rega.950';

                      Fehlt da nicht die Instanz-Nummer ?

                      const idAbwesend = 'hm-rega.0.950';
                      
                      K Offline
                      K Offline
                      kasperfunsurfer
                      wrote on last edited by
                      #45

                      @paul53 ja logisch Sorry mein Fehler. Jetzt passt es. Noch mal vielen vielen DANK...….

                      1 Reply Last reply
                      0

                      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                      With your input, this post could be even better 💗

                      Register Login
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      Support us

                      ioBroker
                      Community Adapters
                      Donate

                      234

                      Online

                      32.8k

                      Users

                      82.8k

                      Topics

                      1.3m

                      Posts
                      Community
                      Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen | Einwilligungseinstellungen
                      ioBroker Community 2014-2025
                      logo
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Home
                      • Recent
                      • Tags
                      • Unread 0
                      • Categories
                      • Unreplied
                      • Popular
                      • GitHub
                      • Docu
                      • Hilfe