[Prowl] IQLNotification

Hi Dave,

vielleicht wäre es sinnvoll, wenn diese Variable standartmäßig auf „An“ gestellt wird, nach der ersten Installation?
Bin nach dem ersten Test auch über das gleiche „Problem“ gestolpert :wink:

Gruß
Benjamin

Gute Idee,
Mache ich mit dem Update der Doku …

Grüße
Dave

Mal ein Lob zwischendurch.

Ein Großes Danke für dieses Modul.
Einfach. Simpel. Funktioniert.
Danke.

Dirk

vielen dank das hört man gerne :smiley:

Läuft seit heute auch bei mir im Betrieb. Vielen Dank!

Hi Dave,

danke für das Modul.

Habe es unter Modules eingerichtet - allerdings wird mir ansonsten nichts angezeigt - wo finde ich z.B. das Konfigurationsformular? :confused:

Vielen Dank und Grüße

Götz

Hi,

wenn du die Instanz öffnest wird dort nichts angezeigt ?

grüße
Dave

Mir wird leider nicht einmal eine Instanz angezeigt. Nur unter den Modulen ist IQLProwlNotification ausgewiesen…

Hi,

dann erstelle doch einfach mal eine instanz…

grüße
Dave

Ach Du sch… :banghead:

Sorry, dass ich Dich damit belästigt habe…:rolleyes:

Vielen Dank!

Hehe,

kein problem …

grüße
Dave

Funktioniert prima - vielen Dank noch einmal für Deine Arbeit und dass Du sie teilst!!!

Grüße, Götz

PS: Die vorstehenden Posts sollte man löschen können…:wink:

Hallo,

bei mir werden die Moduleinträge rot angezeigt.
Wenn ich das Modul öffne wird als Hinweis angezeigt, „Der API Key ist bei Prowl nicht bekannt!“

Die Module funktionieren jedoch einwandfrei.

Hat Prowl hier eventuell die Abfrage des Keys geändert?

Gruß
Christian

Hallo,

das Modul funktioniert bei mir unter IPS 5.0 nicht mehr, ich bekomme einen Fatal error

Fatal error: Uncaught TypeError: Argument 3 passed to IQLProwlNotifications::Send() must be an instance of integer, integer given, called in C:\IP-Symcon\scripts__generated.inc.php on line 895 and defined in C:\IP-Symcon\modules\IQLProwlNofitication\IQLProwlNotifications\module.php:48

Hallo,

ich habe Prowl installiert, auf meinem iphone die App und mit der App bei prowl angemeldet. Dann habe ich versucht, eine Test Push zu schicken

<?php
//    IQLPN_Send( interger $InstanceID, string $subject, string $message, integer $priority );

IQLPN_Send(36633 /*[Test\IQLProwlNotifications]*/, "Test", "Das ist ein Test", 1);  

?>

kommt aber nichts. Hat einer Beispiele, wie der PHP code aussehen „müsste“?

Danke

Oliver

Sorry,

habs gefunden, Status Prowl war aus.

Gruß

Oliver

Hallo zusammen,

bei mir kommt immer dieser Fehler.

Fatal error: Uncaught TypeError: Argument 3 passed to IQLProwlNotifications::Send() must be an instance of integer, integer given, called in /var/lib/symcon/scripts/__generated.inc.php on line 1159 and defined in /var/lib/symcon/modules/IQLProwlNofitication/IQLProwlNotifications/module.php:48
Stack trace:
#0 /var/lib/symcon/scripts/__generated.inc.php(1159): IQLProwlNotifications->Send(‚TEST‘, ‚TEST MESSAGE2‘, 0)
#1 /var/lib/symcon/scripts/12371.ips.php(3): IQLPN_Send(53692, ‚TEST‘, ‚TEST MESSAGE2‘, 0)
#2 {main}
thrown in /var/lib/symcon/modules/IQLProwlNofitication/IQLProwlNotifications/module.php on line 48

Vor 5.0 lief alles noch, hat jemand eine Idee?

VG
Ralf

Das Problem hatte ich auch:

versuch mal die module.php hiermit zu tauschen, hab da was geändert kann mich aber nicht mehr erinnern was

<?
class IQLProwlNotifications extends IPSModule {

    public function Create() {
        //Never delete this line!
        parent::Create();
        //These lines are parsed on Symcon Startup or Instance creation
        //You cannot use variables here. Just static values.
        $this->RegisterPropertyString("apikey","");
        $this->RegisterPropertyString("applicationname","Symcon Prowl Notification");
        $this->RegisterPropertyString("username","");
    }

    public function ApplyChanges() {
        //Never delete this line!
        parent::ApplyChanges();

        $this->RegisterVariableBoolean("STATE","Status","~Switch",1);

        // EnableAction
        $this->EnableAction("STATE");

        $this->SetStatus(102);
        $iqlpnguid = "{F7A35269-066E-4AF2-BBDB-758D23BDB89A}";
        $iqlpninstanzen = IPS_GetInstanceListByModuleID($iqlpnguid);
        foreach($iqlpninstanzen as $modulentry) {
            if($modulentry != $this->InstanceID) {
                if (IPS_GetProperty($modulentry, "apikey") == $this->ReadPropertyString("apikey")) {
                    $this->SetStatus(201);
                    break;
                }
                if (IPS_GetProperty($modulentry, "username") == $this->ReadPropertyString("username")) {
                    $this->SetStatus(202);
                    break;
                }
            }
        }
        if(preg_match('/,/',$this->ReadPropertyString("username"))) {
            $this->SetStatus(204);
        }
        if($this->ReadPropertyString("apikey") != "") {
            if($this->VerifyApiKey($this->ReadPropertyString("apikey")) == false) {
                $this->SetStatus(203);
            }
        }
    }

    public function Send(string $subject, string $message, int $priority ) {
        if(strlen($subject) > 1024) {
            return "Subject zu lang";
        }
        elseif(strlen($message) > 10000) {
            return "Message zu lang";
        }
        elseif($priority < -2 or $priority > 2) {
            return "Priorität ausserhalb des zulässigen Bereichs";
        }
        // Build Request
        if(GetValue($this->GetIDForIdent("STATE")) == true) {
            $this->ProwlRequest("add", $this->ReadPropertyString("apikey"), $subject, $message, $priority);
            return true;
        }
        return false;
    }

    public function SendEx(string $username, string $subject, string $message, int $priority ) {
        $newapikey = "";
        if(strlen($subject) > 1024) {
            return "Subject zu lang";
        }
        elseif(strlen($message) > 10000) {
            return "Message zu lang";
        }
        elseif($priority < -2 or $priority > 2) {
            return "Priorität ausserhalb des zulässigen Bereichs";
        }
        if(preg_match('/,/',$username)) {
            $apikeyarray = array();
            $userarray = explode(",",$username);
            $iqlpnguid = "{F7A35269-066E-4AF2-BBDB-758D23BDB89A}";
            $iqlpninstanzen = IPS_GetInstanceListByModuleID($iqlpnguid);
            foreach($iqlpninstanzen as $moduleid) {
                foreach($userarray as $userentry) {
                    if(IPS_GetProperty($moduleid, "username") == $userentry) {
                        $apikeyarray[] = IPS_GetProperty($moduleid,"apikey");
                    }
                }
            }
            foreach($apikeyarray as $apikeyentry) {
                if($newapikey == "") {
                    $newapikey = $apikeyentry;
                }
                else {
                    $newapikey = $newapikey ."," .$apikeyentry;
                }
            }
        }
        // Build Request
        if(GetValue($this->GetIDForIdent("STATE")) == true) {
            if($newapikey != "") {
                $this->ProwlRequest("add", $newapikey, $subject, $message, $priority);
                return true;
            }
            else {
                return false;
            }
        }
        return false;
    }
    private function VerifyApiKey( string $apikey) {
        $url = 'https://api.prowlapp.com/publicapi/verify?apikey=';
        $request = $url . $apikey;
        $curl_connection = curl_init($request);
        curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
        curl_setopt($curl_connection, CURLOPT_HTTPHEADER, array("Expect:"));
        curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
        $result = curl_exec($curl_connection);
        curl_close($curl_connection);

        $xmlResult = new SimpleXMLElement($result);
        if(isset($xmlResult->{'error'})) {
            return false;
        }
        else {
            return true;
        }
    }

    private function ProwlRequest( string $command, string $apikey, string $subject, string $message, int $priority ) {
        $post_data['apikey'] = $apikey;
        $post_data['event'] = $subject;
        $post_data['description'] = $message;
        $post_data['priority'] = $priority;
        $post_data['application'] = $this->ReadPropertyString("applicationname");

        foreach ( $post_data as $key => $value) {
            $post_items[] = $key . '=' . $value;
        }

        if(isset($post_items)) {
            $post_string = implode('&', $post_items);
        }
        if(isset($post_string)) {
            $curl_connection = curl_init('https://api.prowlapp.com/publicapi/' .$command);
            curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
            curl_setopt($curl_connection, CURLOPT_HTTPHEADER, array("Expect:"));
            curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);
            curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
            $result = curl_exec($curl_connection);
            curl_close($curl_connection);
        }
        if(isset($result)) {
            return $result;
        }
        else {
            return false;
        }
    }

    public function RequestAction($Ident, $Value){
        switch($Ident) {
            case "STATE":
                SetValue($this->GetIDForIdent($Ident),$Value);
                break;
            default:
                throw new Exception("Invalid ident");
        }
    }
}

Super !!!

Vielen Dank hat funktioniert.

VG
Ralf

Nach Update auf 5.0 hatte ich genau das gleiche Problem und das Update der module.php hat das Problem bei mir ebenfalls geholfen.

Kann der Ersteller das Update bitte pushen, damit das Modul wieder korrekt über die Module geladen werden kann und funktioniert?

Gruß
Benjamin