From d4bd3e2e7066b8e181b84d37e0ac9b34e7d93d7f Mon Sep 17 00:00:00 2001 From: nasseeder1 Date: Wed, 9 Jan 2019 23:27:33 +0000 Subject: [PATCH] 49_SSCam: contrib 8.4.2 git-svn-id: https://svn.fhem.de/fhem/trunk@18201 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/DS_Starter/49_SSCam.pm | 31 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/fhem/contrib/DS_Starter/49_SSCam.pm b/fhem/contrib/DS_Starter/49_SSCam.pm index 6e1ba3c19..1ccc29ca2 100644 --- a/fhem/contrib/DS_Starter/49_SSCam.pm +++ b/fhem/contrib/DS_Starter/49_SSCam.pm @@ -47,6 +47,7 @@ use Encode; # Versions History intern our %SSCam_vNotesIntern = ( + "8.4.1" => "10.01.2019 snapEmailTxt can use placeholders \$DATE, \$TIME ", "8.4.1" => "09.01.2019 Transaction of snap and getsnapinfo implemented, debugactive token verbose level changed ", "8.4.0" => "07.01.2019 command snap extended to \"snap [number] [lag] [snapEmailTxt:\"subject => , body => ". "\"]\", SID-hash is deleted if attr \"session\" is set ", @@ -7190,7 +7191,10 @@ sub SSCam_prepareSendEmail ($$;$) { my $snapnum = 1; my $sp = AttrVal($name, "smtpPort", 25); - my $nousessl = AttrVal($name, "smtpNoUseSSL", 0); + my $nousessl = AttrVal($name, "smtpNoUseSSL", 0); + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; + my $date = sprintf "%02d.%02d.%04d" , $mday , $mon+=1 ,$year+=1900; + my $time = sprintf "%02d:%02d:%02d" , $hour , $min , $sec; # Extraktion EMail-Texte # Attribut snapEmailTxt kann übersteuert werden mit: $hash->{HELPER}{SMTPMSG} @@ -7199,15 +7203,19 @@ sub SSCam_prepareSendEmail ($$;$) { my $mt = $mth?$mth:AttrVal($name, "snapEmailTxt", ""); $mt =~ s/['"]//g; - my($subj,$body) = split(",", $mt); + my($subj,$body) = split(",", $mt, 2); my($subjk,$subjt) = split("=>", $subj); my($bodyk,$bodyt) = split("=>", $body); $subjk = SSCam_trim($subjk); $subjt = SSCam_trim($subjt); $subjt =~ s/\$NAME/$calias/g; + $subjt =~ s/\$DATE/$date/g; + $subjt =~ s/\$TIME/$time/g; $bodyk = SSCam_trim($bodyk); $bodyt = SSCam_trim($bodyt); $bodyt =~ s/\$NAME/$calias/g; + $bodyt =~ s/\$DATE/$date/g; + $bodyt =~ s/\$TIME/$time/g; my %smtpmsg = (); $smtpmsg{$subjk} = "$subjt"; $smtpmsg{$bodyk} = "$bodyt"; @@ -8499,6 +8507,7 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay> above.

Email shipping preparation

+ The snapshots can be sent by Email alltogether after creation. For this purpose the module contains its own Email client. Before you can use this function you have to install the Perl-module MIME::Lite. On debian systems it can be installed with command:

@@ -8520,9 +8529,9 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay> snapEmailTxt - Activates the Email shipping. Has the form:
subject => <subject text>, body => <message text>
- The placeholder variable $NAME can be used. $NAME is + The placeholder variables $NAME, $DATE and $TIME can be used. $NAME is replaced by the device alias or the name of camera in SVS if alias is not - defined. + defined. $DATE and $TIME are replaced with the current date and time. smtpHost - Hostname of outgoing Email server (e.g. securesmtp.t-online.de) smtpFrom - Return address (<name>@<domain>) smtpTo - Receiving address(es) (<name>@<domain>) @@ -9071,8 +9080,9 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay>
  • snapEmailTxt subject => <subject text>, body => <message text>
    Activates the Email shipping of snapshots after its creation.
    - The attribute has to be definied in the form as described. You can use the placeholder variable $NAME. - The variable $NAME is replaced by the device alias or the name of the camera in SVS if the device alias isn't available. + The attribute has to be definied in the form as described. You can use the placeholder variables $NAME, $DATE and $TIME. + The variable $NAME is replaced by the device alias or the name of the camera in SVS if the device alias isn't available. + $DATE and $TIME are replaced with the current date and time.

      @@ -10068,9 +10078,10 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay> snapEmailTxt - Aktiviert den Email-Versand. Die Eingabe hat die Form:
      subject => <Betreff-Text>, body => <Mitteilung-Text>
      - Es kann der Platzhalter $NAME verwendet werden. $NAME wird + Es können die Platzhalter $NAME, $DATE und $TIME verwendet werden. $NAME wird durch den Device-Alias bzw. den Namen der Kamera in der SVS - ersetzt falls der Device-Alias nicht gesetzt ist. + ersetzt falls der Device-Alias nicht gesetzt ist. + $DATE und $TIME werden durch das aktuelle Datum und Zeit ersetzt. smtpHost - Hostname oder IP-Adresse des Postausgangsservers (z.B. securesmtp.t-online.de) smtpFrom - Absenderadresse (<name>@<domain>) smtpTo - Empfängeradresse(n) (<name>@<domain>) @@ -10642,9 +10653,9 @@ attr <name> genericStrmHtmlTag <video $HTMLATTR controls autoplay>
    • snapEmailTxt subject => <Betreff-Text>, body => <Mitteilung-Text>
      Aktiviert den Emailversand von Schnappschüssen nach deren Erstellung.
      - Das Attribut muß in der angegebenen Form definiert werden. Es kann der Platzhalter $NAME verwendet werden. + Das Attribut muß in der angegebenen Form definiert werden. Es können die Platzhalter $NAME, $DATE und $TIME verwendet werden. $NAME wird durch den Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden - ist.

      + ist. $DATE und $TIME werden durch das aktuelle Datum und Zeit ersetzt.

        Beispiel: