2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

49_SSCAM: allow placeholders #CAM, #DATE, #TIME, #FILE, #CTIME

git-svn-id: https://svn.fhem.de/fhem/trunk@26279 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2022-08-02 13:21:22 +00:00
parent 19aad7ef21
commit 625bb522e8
2 changed files with 170 additions and 93 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- feature: 49_SSCAM: allow placeholders #CAM, #DATE, #TIME, #FILE, #CTIME
- bugfix: 50_Signalbot: update contacts on startup, signal-cli 0.10.9
- feature: 96_Snapcast: group volume now can be set
- feature: 49_SSCam: text field long for some attributes, the body text

View File

@ -185,6 +185,7 @@ BEGIN {
# Versions History intern
my %vNotesIntern = (
"9.10.7" => "02.08.2022 allow placeholders #CAM, #DATE, #TIME, #FILE, #CTIME (also for Email) ",
"9.10.6" => "18.07.2022 textField-long property set for recChatTxt, recEmailTxt, recTelegramTxt, snapChatTxt, snapEmailTxt, snapTelegramTxt, ".
"set 'part1type' to default => text/html instead of text/plain",
"9.10.5" => "01.07.2022 fix noQuotesForSID using in streaming devices type mjpeg ",
@ -9783,9 +9784,9 @@ sub _prepSendChat {
if($subjt) {
$subjt = trim($subjt);
$subjt =~ s/\$CAM/$calias/gx;
$subjt =~ s/\$DATE/$date/gx;
$subjt =~ s/\$TIME/$time/gx;
$subjt =~ s/[\$#]CAM/$calias/gx;
$subjt =~ s/[\$#]DATE/$date/gx;
$subjt =~ s/[\$#]TIME/$time/gx;
}
my %chatmsg = ();
@ -10072,8 +10073,8 @@ sub __extractForChat {
$fname = $tdir."/".$fname;
}
$subject =~ s/\$FILE/$fname/gx;
$subject =~ s/\$CTIME/$ct/gx;
$subject =~ s/[\$#]FILE/$fname/gx;
$subject =~ s/[\$#]CTIME/$ct/gx;
return ($subject,$fname);
}
@ -10104,9 +10105,9 @@ sub _prepSendTelegram {
if($subjt) {
$subjt = trim($subjt);
$subjt =~ s/\$CAM/$calias/gx;
$subjt =~ s/\$DATE/$date/gx;
$subjt =~ s/\$TIME/$time/gx;
$subjt =~ s/[\$#]CAM/$calias/gx;
$subjt =~ s/[\$#]DATE/$date/gx;
$subjt =~ s/\[\$#]TIME/$time/gx;
}
my %telemsg = ();
@ -10330,8 +10331,8 @@ sub __extractForTelegram {
}
}
$subject =~ s/\$FILE/$fname/gx;
$subject =~ s/\$CTIME/$ct/gx;
$subject =~ s/[\$#]FILE/$fname/gx;
$subject =~ s/[\$#]CTIME/$ct/gx;
return ($data,$subject,$MediaStream,$fname);
}
@ -10663,14 +10664,14 @@ sub _prepSendMail {
my $bodyt = (split "=>", $body)[1];
$subjt = trim($subjt);
$subjt =~ s/\$CAM/$calias/gx;
$subjt =~ s/\$DATE/$date/gx;
$subjt =~ s/\$TIME/$time/gx;
$subjt =~ s/[\$#]CAM/$calias/gx;
$subjt =~ s/[\$#]DATE/$date/gx;
$subjt =~ s/[\$#]TIME/$time/gx;
$bodyt = trim($bodyt);
$bodyt =~ s/\$CAM/$calias/gx;
$bodyt =~ s/\$DATE/$date/gx;
$bodyt =~ s/\$TIME/$time/gx;
$bodyt =~ s/[\$#]CAM/$calias/gx;
$bodyt =~ s/[\$#]DATE/$date/gx;
$bodyt =~ s/[\$#]TIME/$time/gx;
my %smtpmsg = ();
$smtpmsg{subject} = "$subjt";
@ -10843,6 +10844,7 @@ sub __sendEmailblocking { ##
}
$subject = decode_utf8($subject);
my $mailmsg = MIME::Lite->new(
From => $from,
To => $to,
@ -10850,15 +10852,10 @@ sub __sendEmailblocking { ##
Type => 'multipart/mixed', #'multipart/mixed', # was 'text/plain'
);
### Add the text message part:
### (Note that "attach" has same arguments as "new"):
$part1txt = decode_utf8($part1txt);
$mailmsg->attach(
Type => $part1type,
Data => $part1txt,
);
### Add image, Das Image liegt bereits als File vor
####################################################
if($image) {
$mailmsg->attach(
Type => $part2type,
@ -10885,8 +10882,20 @@ sub __sendEmailblocking { ##
Filename => $fname,
Disposition => 'attachment',
);
my $params = {
hash => $hash,
name => $name,
txt => $part1txt,
fname => $fname,
ct => $ct
};
$part1txt = __extractForEmail ($params);
Log3($name, 4, "$name - Image data sequence [$key] decoded from internal Cache for Email attachment") if($decoded);
}
BlockingInformParent("FHEM::SSCam::subaddFromBlocking", [$name, "-", $tac], 0);
}
else {
@ -10913,8 +10922,20 @@ sub __sendEmailblocking { ##
Filename => $fname,
Disposition => 'attachment',
);
my $params = {
hash => $hash,
name => $name,
txt => $part1txt,
fname => $fname,
ct => $ct
};
$part1txt = __extractForEmail ($params);
Log3($name, 4, "$name - Image data sequence [$key] decoded from CHI-Cache for Email attachment");
}
BlockingInformParent("FHEM::SSCam::subaddFromBlocking", [$name, "-", $tac], 0);
}
}
@ -10934,8 +10955,20 @@ sub __sendEmailblocking { ##
Filename => $fname,
Disposition => 'attachment',
);
my $params = {
hash => $hash,
name => $name,
txt => $part1txt,
fname => $fname,
ct => $ct
};
$part1txt = __extractForEmail ($params);
Log3($name, 4, "$name - Video data sequence [$key] decoded from internal Cache for Email attachment");
}
BlockingInformParent("FHEM::SSCam::subaddFromBlocking", [$name, "-", $tac], 0);
}
else {
@ -10962,12 +10995,31 @@ sub __sendEmailblocking { ##
Filename => $fname,
Disposition => 'attachment',
);
my $params = {
hash => $hash,
name => $name,
txt => $part1txt,
fname => $fname,
ct => $ct
};
$part1txt = __extractForEmail ($params);
Log3($name, 4, "$name - Video data sequence [$key] decoded from CHI-Cache for Email attachment");
}
BlockingInformParent("FHEM::SSCam::subaddFromBlocking", [$name, "-", $tac], 0);
}
}
### Add the text message part (Note that "attach" has same arguments as "new")
###############################################################################
$mailmsg->attach(
Type => $part1type,
Data => $part1txt,
);
$mailmsg->attr('content-type.charset' => 'UTF-8');
##### SMTP-Connection #####
@ -11087,6 +11139,22 @@ sub __sendEmailblocking { ##
return "$name|''|$ret";
}
####################################################################################################
# Daten extrahieren für Email Versand
####################################################################################################
sub __extractForEmail {
my $paref = shift;
my $txt = $paref->{txt} // qq{};
my $fname = $paref->{fname} // qq{};
my $ct = $paref->{ct} // qq{};
$txt =~ s/[\$#]FILE/$fname/gx;
$txt =~ s/[\$#]CTIME/$ct/gx;
return $txt;
}
####################################################################################################
# Auswertungsroutine nichtblockierendes Send EMail
####################################################################################################
@ -13389,12 +13457,12 @@ attr <name> genericStrmHtmlTag <img $HTMLATTR
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE </td><td>- current date </td></tr>
<tr><td> $TIME </td><td>- current time </td></tr>
<tr><td> $FILE </td><td>- Name of recording file </td></tr>
<tr><td> $CTIME </td><td>- recording creation time </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE (#DATE) </td><td>- current date </td></tr>
<tr><td> $TIME (#TIME) </td><td>- current time </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Name of recording file </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- recording creation time </td></tr>
</table>
</ul>
<br>
@ -13410,15 +13478,17 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<a name="recEmailTxt"></a>
<li><b>recEmailTxt subject => &lt;subject text&gt;, body => &lt;message text&gt; </b><br>
Activates the Email shipping of recordings after whose creation. <br>
The attribute has to be definied in the form as described. <br>
You can use the following placeholders in "subject" and "body". <br><br>
The attribute must be defined in the specified form. <br>
The following placeholders can be used in the subject or body. <br><br>
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE </td><td>- current date </td></tr>
<tr><td> $TIME </td><td>- aktuelle time </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE (#DATE) </td><td>- current date </td></tr>
<tr><td> $TIME (#TIME) </td><td>- aktuelle time </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Filename of the (last) recording (only usable in body) </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- Creation time of the (last) recording (only usable in body) </td></tr>
</table>
</ul>
<br>
@ -13443,12 +13513,12 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE </td><td>- current date </td></tr>
<tr><td> $TIME </td><td>- current time </td></tr>
<tr><td> $FILE </td><td>- Name of recording file </td></tr>
<tr><td> $CTIME </td><td>- recording creation time </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE (#DATE) </td><td>- current date </td></tr>
<tr><td> $TIME (#TIME) </td><td>- current time </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Name of recording file </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- recording creation time </td></tr>
</table>
</ul>
<br>
@ -13554,12 +13624,12 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE </td><td>- current date </td></tr>
<tr><td> $TIME </td><td>- current time </td></tr>
<tr><td> $FILE </td><td>- Name of snapshot file </td></tr>
<tr><td> $CTIME </td><td>- creation time of the snapshot </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE (#DATE) </td><td>- current date </td></tr>
<tr><td> $TIME (#TIME) </td><td>- current time </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Name of snapshot file </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- creation time of the snapshot </td></tr>
</table>
</ul>
<br>
@ -13575,15 +13645,17 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<a name="snapEmailTxt"></a>
<li><b>snapEmailTxt subject => &lt;subject text&gt;, body => &lt;message text&gt; </b><br>
Activates the Email shipping of snapshots after whose creation. <br>
The attribute has to be defined in the form as described. <br>
You can use the following placeholders in "subject" and "body". <br><br>
The attribute must be defined in the specified form. <br>
The following placeholders can be used in the subject or body. <br><br>
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE </td><td>- current date </td></tr>
<tr><td> $TIME </td><td>- current time </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE (#DATE) </td><td>- current date </td></tr>
<tr><td> $TIME (#TIME) </td><td>- current time </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Filename of the (last) snapshot (only usable in body) </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- Creation time of the (last) snapshot (only usable in body) </td></tr>
</table>
</ul>
<br>
@ -13609,12 +13681,12 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE </td><td>- current date </td></tr>
<tr><td> $TIME </td><td>- current time </td></tr>
<tr><td> $FILE </td><td>- Name of snapshot file </td></tr>
<tr><td> $CTIME </td><td>- creation time of the snapshot </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device alias respectively the name of the camera in SVS if the device alias isn't set </td></tr>
<tr><td> $DATE (#DATE) </td><td>- current date </td></tr>
<tr><td> $TIME (#TIME) </td><td>- current time </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Name of snapshot file </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- creation time of the snapshot </td></tr>
</table>
</ul>
<br>
@ -15417,12 +15489,12 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE </td><td>- Filename </td></tr>
<tr><td> $CTIME </td><td>- Erstellungszeit der Aufnahme </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE (#DATE) </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME (#TIME) </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Filename </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- Erstellungszeit der Aufnahme </td></tr>
</table>
</ul>
<br>
@ -15439,14 +15511,16 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<li><b>recEmailTxt subject => &lt;Betreff-Text&gt;, body => &lt;Mitteilung-Text&gt; </b><br>
Aktiviert den Emailversand von Aufnahmen nach deren Erstellung. <br>
Das Attribut muß in der angegebenen Form definiert werden. <br>
Es können die folgenden Platzhalter im subject und body verwendet werden. <br><br>
Es können die folgenden Platzhalter im subject bzw. body verwendet werden. <br><br>
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device-Alias bzw. der Name der Kamera in der SVS falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME </td><td>- aktuelle Zeit </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device-Alias bzw. der Name der Kamera in der SVS falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE (#DATE) </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME (#TIME) </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Filename der (letzten) Aufnahme (nur in body verwendbar) </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- Erstellungszeit des (letzten) Aufnahme (nur in body verwendbar) </td></tr>
</table>
</ul>
<br>
@ -15471,12 +15545,12 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE </td><td>- Filename </td></tr>
<tr><td> $CTIME </td><td>- Erstellungszeit der Aufnahme </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE (#DATE) </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME (#TIME) </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Filename </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- Erstellungszeit der Aufnahme </td></tr>
</table>
</ul>
<br>
@ -15583,12 +15657,12 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE </td><td>- Filename des Schnappschusses </td></tr>
<tr><td> $CTIME </td><td>- Erstellungszeit des Schnappschusses </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE (#DATE) </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME (#TIME) </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Filename des Schnappschusses </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- Erstellungszeit des Schnappschusses </td></tr>
</table>
</ul>
<br>
@ -15606,14 +15680,16 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
Aktiviert den Emailversand von Schnappschüssen nach deren Erstellung. Wurden mehrere Schnappschüsse ausgelöst,
werden sie gemeinsam in einer Mail versendet. <br>
Das Attribut muß in der angegebenen Form definiert werden. <br>
Es können die folgenden Platzhalter im subject und body verwendet werden. <br><br>
Es können die folgenden Platzhalter im subject bzw. body verwendet werden. <br><br>
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device-Alias bzw. der Name der Kamera in der SVS falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME </td><td>- aktuelle Zeit </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device-Alias bzw. der Name der Kamera in der SVS falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE (#DATE) </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME (#TIME) </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Filename des (letzten) Schnappschusses (nur in body verwendbar) </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- Erstellungszeit des (letzten) Schnappschusses (nur in body verwendbar) </td></tr>
</table>
</ul>
<br>
@ -15639,12 +15715,12 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<ul>
<table>
<colgroup> <col width=10%> <col width=90%> </colgroup>
<tr><td> $CAM </td><td>- Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE </td><td>- Filename des Schnappschusses </td></tr>
<tr><td> $CTIME </td><td>- Erstellungszeit des Schnappschusses </td></tr>
<colgroup> <col width=20%> <col width=80%> </colgroup>
<tr><td> $CAM (#CAM) </td><td>- Device-Alias bzw. den Namen der Kamera in der SVS ersetzt falls der Device-Alias nicht vorhanden ist </td></tr>
<tr><td> $DATE (#DATE) </td><td>- aktuelles Datum </td></tr>
<tr><td> $TIME (#TIME) </td><td>- aktuelle Zeit </td></tr>
<tr><td> $FILE (#FILE) </td><td>- Filename des Schnappschusses </td></tr>
<tr><td> $CTIME (#CTIME) </td><td>- Erstellungszeit des Schnappschusses </td></tr>
</table>
</ul>
<br>