NEWS
Kamera Steuerung (PTZ) mit Bewegungsmelder htp
-
@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: trueZwischen beiden BWM ist nur 1 ms Abstand ! Wie kann das sein ?
-
@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 -
@kasperfunsurfer
Dann versuche es mal mit getrennten Triggernconst 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); });
-
@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); });
-
@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); });
-
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 -
@kasperfunsurfer
Damit ich ich die Zeilennummern in den Warnungen zuordnen kann, muss ich das Skript so sehen, wie es bei Dir läuft. -
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.....
-
@kasperfunsurfe:
const idAbwesend = 'hm-rega.950';
Fehlt da nicht die Instanz-Nummer ?
const idAbwesend = 'hm-rega.0.950';
-
@paul53 ja logisch Sorry mein Fehler. Jetzt passt es. Noch mal vielen vielen DANK...….