FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: noanda am 26 Mai 2016, 13:24:21

Titel: IPCAM Senden sendSnapshot senden nur Müll
Beitrag von: noanda am 26 Mai 2016, 13:24:21
Beschäftige mich nach langer Zeit mal wieder mit IPCAM und habe da immer noch ein Problem.
ZitatMOTION.not.01
holt ganz brav die Bilder über
ZitatMelderBFLUEGHM:motion get ipcam image

Diese werden auch ganz ordentlich in das Verzeichniss
Zitat./www/snapshots
abgelegt.

MOTION.not.02 ist so defineirt

define MOTION.not.02 notify ipcam:.*snapshots.* {DebianMail('xx@xx.com','Test bild', '{sendSnapshot("%NAME","%EVTPART1")}')}

jetzt meine Problem ich erhalte Mails mit folgendem inhalt:

Zitat{sendSnapshot("%NAME","%EVTPART1")}

die sendSnapshot ist bei mir wie folgt definiert:

sub
sendSnapshot
{
  my ($cam,$snapshots) = @_;
  my $storage = AttrVal($cam,"storage","");
  my $rcpt = 'xxx@123.com';
  my $from = 'xxx@123.de';
  my $subj = "FHEM: Kamera $cam hat eine Bewegung aufgezeichnet";
  my $last = ReadingsTimestamp($cam,"last","");
  my $mess = "Kamera $cam hat eine Bewegung am $last aufgezeichnet:";
  if(!-d $storage) {
    Log 1, "IPCAM $cam storagepath does not exists: $storage";
    return "storagepath for $cam does not exists: $storage";
  }
  if(!$last) {
    Log 1, "IPCAM $cam no snapshots available";
    return "no snapshots available for $cam";
  }
  my $cmd  = "sendemail -f $from -t $rcpt -u $subj -m $mess ";
     $cmd .= "-o message-content-type=text -o message-charset=utf-8 -a";
  for (my $s=1;$s<$snapshots+1;$s++) {
    $cmd .= " $storage/".ReadingsVal($cam,"snapshot$s","");
  }
  my $ret  = `$cmd`;
  $ret =~ s/[\r\n]//g;
  Log 4, "IPCAM sendSnapshot: $ret";
  return undef;
}


die <br> und die bekannte "1" habe ich schon weg genommen.

übrigens auch das "@" bei "sendSnapshot@" da ich mit dem "@" die Fehlermeldung:
ZitatIllegal declaration of subroutine main::sendSnapshot at ./FHEM/99_myUtils.pm line 110

erhalte

Irgendwie komme ich nicht weiter. Fällt jemandem irgendwas auf? oder hat jemand eine Lösung für diese Problem?

Vielen Dank
Titel: Antw:IPCAM Senden sendSnapshot senden nur Müll
Beitrag von: viegener am 27 Mai 2016, 23:03:08
sendSnapshot wird ja gar nicht aufgerufen, denn es steht ja in '
Ich habe jetzt nicht alles überprüft, aber ich würde die ' entfernen und eigentlich ebenfalls die {} direkt um den sendSnapshot-Aufruf
Titel: Antw:IPCAM Senden sendSnapshot senden nur Müll
Beitrag von: dev0 am 28 Mai 2016, 08:24:45
Zitat von: noanda am 26 Mai 2016, 13:24:21
sendSnapshot("%NAME","%EVTPART1")
%NAME, etc gibt es seit Featurelevel 5.7 auch nicht mehr. Siehe: https://forum.fhem.de/index.php/topic,44094.0.html (https://forum.fhem.de/index.php/topic,44094.0.html)