Kameraaufzeichnung in Synology per Webhook aus IP-Symcon aktivieren

Liebe Forumsleser

ich möchte eine Kameraaufzeichnung in Synology Surveillance Center per Aktionsregel starten wenn ein Bewegungsmelder aktiv wird. Alles läuft auf einem Windows 10 Rechner. Regel ist im Center definiert und wenn ich den dort angegeben Befehl (siehe unten) in einen Browser kopiere und starte wird die Kamera auch aktiviert. Ich schaffe es aber nicht das in IP-Symcon abzubilden.

Ich habe es über „Ausgelöstes Ereignis“ versucht und den Befehl dort unter "Führe PHP-Code aus reinkopiert. Das Ereignis wird auch aktiviert wenn der Bewegungsmelder ausgelöst wird. Aber leider nicht die Kamera.

Ich habe es dann mit IPSStudio versucht und hier ein Script erstellt was den Befehl absenden soll wenn der Bewegungsmelder ausgelöst wird. Dies funktioniert leider auch nicht.

Richtig PHP-programmieren kann ich nicht. Ich mache sicher einen blöden Fehler. Hat jemand eine Idee?

http://192.168.0.94:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method=„Incoming“&version=1&token=S5QxwGZV2oFAmYBw36HVup2kSyD2AvMV6RFNtOCVuPk2MgfYXXXXXXXXXX

Zeig doch was du bisher als Script versucht hast.
Michael

Hallo Michael,

hier ist das Script was IPSStudio produziert hat. Ich habe ja wenig Ahnung, aber kommt mir für das einfache Ziele die Kamera zu aktivieren wenn der Bewegungsmelder anspricht ziemlich viel Code vor.

Carsten

<?php

/* =====================================================================================================
*

  • IPSWorkflow Script

  • Dieses Skript wurde von einem Workflow des IPSStudio erzeugt, bitte nehmen Sie keine Änderungen

  • an dem Skript vor, da dieses beim nächsten Speichervorgang ansonsten wieder überschrieben werden.

  • Generiert

  • um: 20.11.2019 21:00:42

  • von: IPSStudio

  • ID: 27592

  • Benutzte Objekte:

  • 20805 - Bewegungsmelder.Westen

  • Generierte Ereignisse:

  • 36516 - Skripte.Aktivierung Kamera Westen.38366 Event

  • ===================================================================================================== */

    $executionID = round(microtime(true)*1000)-(IPS_GetKernelStartTime()*1000);
    SendDebug($_IPS[‚SELF‘], ‚S||||‘.$executionID, ‚‘, 0);

    $M1 = new IPSEntityInstance($_IPS, 20805);
    $M2 = new IPSEntityModuleIf($_IPS);
    $M3 = new IPSEntityModuleActionCustM3($_IPS, true,false,false,false,false,false,false,false);

    if ($M1->Evaluate()) {
    SendDebug($_IPS[‚SELF‘], ‚M1|Motion|M2|SetCondition|‘.$executionID,$M1->GetValue(‚Motion‘),0);
    $M2->SetCondition($M1->GetValue(‚Motion‘));
    }
    if ($M2->Evaluate()===true) {
    SendDebug($_IPS[‚SELF‘], ‚M2|GetTrue|M3|SetValue1|‘.$executionID,$M2->GetTrue(),0);
    $M3->SetValue1($M2->GetTrue());
    } else if ($M2->Evaluate()===false) {
    } else {}
    $M3->Evaluate();

    /* -----------------------------------------------------------------------*/
    function SendDebug($id, $message, $data, $format) {
    if (is_numeric($data)) {
    $data = (string)round($data, 2);
    } else if (is_string($data)) {
    $data = ‚"‘.$data.’"’;
    } else {}
    IPS_SendDebug($id, $message, $data, $format);
    }

    /* -----------------------------------------------------------------------*/
    function GetTypeConvertedValue($variableID, $value) {
    $variableType = IPS_GetVariable($variableID)[‚VariableType‘];
    if ($variableType == 0) return (bool)$value;
    else if ($variableType == 1) return (int)$value;
    else if ($variableType == 2) return (float)$value;
    else return $value;
    }

    /* -----------------------------------------------------------------------*/
    class IPSEntityInstance {
    private $ips;
    private $id;

    public function __construct($ips, $id) {
    $this->ips = $ips;
    $this->id = $id;
    }

    private function GetTypeConvertedValue($ident, $value) {
    return GetTypeConvertedValue(IPS_GetObjectIDByIdent($ident, $this->id), $value);
    }

    public function SetValue($ident, $value) {
    IPS_RequestAction($this->id, $ident, $this->GetTypeConvertedValue($ident, $value));
    }

    public function GetValue($ident) {
    return GetValue(IPS_GetObjectIDByIdent($ident, $this->id));
    }

    public function Evaluate() {
    return true;
    }
    }

    /* -----------------------------------------------------------------------*/
    class IPSEntityModuleIf {
    private $ips;
    private $value = false;
    private $input = false;

    public function __construct($ips) {
    $this->ips = $ips;
    }

    public function SetCondition($value) {
    $this->value = $value;
    $this->input = true;
    }

    public function GetTrue() {
    return $this->value==true;
    }

    public function GetFalse() {
    return $this->value==false;
    }

    public function Evaluate() {
    return $this->input ? $this->value : null;
    }
    }

    /* -----------------------------------------------------------------------*/
    class IPSEntityModuleActionCustM3 {
    private $ips;
    private $result = 0;
    private $evaluation = 0;
    private $value = array();
    private $input = array();
    private $linked = array();

    public function __construct($ips, $linked1, $linked2, $linked3, $linked4, $linked5, $linked6, $linked7, $linked8) {
    $this->ips = $ips;
    $this->linked[0] = $linked1;
    $this->linked[1] = $linked2;
    $this->linked[2] = $linked3;
    $this->linked[3] = $linked4;
    $this->linked[4] = $linked5;
    $this->linked[5] = $linked6;
    $this->linked[6] = $linked7;
    $this->linked[7] = $linked8;
    for ($idx = 0;$idx < 8;$idx++) {
    $this->value[$idx] = -1;
    $this->input[$idx] = false;
    }
    }

    private function SetValue($idx, $value) {
    $this->value[$idx] = $value;
    $this->input[$idx] = true;
    }

    public function SetValue1($value) {
    $this->SetValue(0, $value);
    }

    public function SetValue2($value) {
    $this->SetValue(1, $value);
    }

    public function SetValue3($value) {
    $this->SetValue(2, $value);
    }

    public function SetValue4($value) {
    $this->SetValue(3, $value);
    }

    public function SetValue5($value) {
    $this->SetValue(4, $value);
    }

    public function SetValue6($value) {
    $this->SetValue(5, $value);
    }

    public function SetValue7($value) {
    $this->SetValue(6, $value);
    }

    public function SetValue8($value) {
    $this->SetValue(7, $value);
    }

    public function GetResult() {
    return $this->result;
    }

    public function Evaluate() {
    $value1 = $this->value[0];
    $value2 = $this->value[1];
    $value3 = $this->value[2];
    $value4 = $this->value[3];
    $value5 = $this->value[4];
    $value6 = $this->value[5];
    $value7 = $this->value[6];
    $value8 = $this->value[7];

        $this-&gt;evaluation = true; 
         for ($idx = 0 ; $idx &lt; 8 ; $idx++)
            $this-&gt;evaluation = $this-&gt;evaluation && ($this-&gt;input[$idx]==$this-&gt;linked[$idx]);
    
         if ($this-&gt;evaluation) {
           http://192.168.0.94:5000/webapi/entry.cgi?api=SYNO.SurveillanceStation.Webhook&method="Incoming"&version=1&token=S5QxwGZV2oFAmYBw36HVup2kSyD2AvMV6RFNtOCVuPkXXXXXXXXXXXXXX
    
         }
    
    
         return $this-&gt;evaluation;
    

    }
    }

    SendDebug($_IPS[‚SELF‘], ‚F||||‘.$executionID, ‚‘, 0);

?>

Ich meinte auch nicht den IPSView Workflow.
Michael