mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
49_SSCam: new get command saveLastSnap
git-svn-id: https://svn.fhem.de/fhem/trunk@24484 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c38d3858a9
commit
28bae950e5
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- feature: 49_SSCam: new get command saveLastSnap
|
||||||
- bugfix: 89_AndroidDB: Connection handling improved
|
- bugfix: 89_AndroidDB: Connection handling improved
|
||||||
- feature: 73_AutoShuttersControl: add abort rain unprotection waiting time
|
- feature: 73_AutoShuttersControl: add abort rain unprotection waiting time
|
||||||
- bugfix: lib/FHEM/Core/Authentication/Passwords.pm
|
- bugfix: lib/FHEM/Core/Authentication/Passwords.pm
|
||||||
|
@ -184,6 +184,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern
|
# Versions History intern
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"9.9.0" => "21.05.2021 new get command saveLastSnap ",
|
||||||
"9.8.5" => "22.02.2021 remove sscam_tooltip.js, substitute /fhem by \$FW_ME ",
|
"9.8.5" => "22.02.2021 remove sscam_tooltip.js, substitute /fhem by \$FW_ME ",
|
||||||
"9.8.4" => "20.02.2021 sub Define minor fix ",
|
"9.8.4" => "20.02.2021 sub Define minor fix ",
|
||||||
"9.8.3" => "29.11.2020 fix cannot send snaps/recs if snapTelegramTxt + snapChatTxt and no cacheType (cacheType=internal) is set ",
|
"9.8.3" => "29.11.2020 fix cannot send snaps/recs if snapTelegramTxt + snapChatTxt and no cacheType (cacheType=internal) is set ",
|
||||||
@ -276,6 +277,7 @@ my %vNotesIntern = (
|
|||||||
|
|
||||||
# Versions History extern
|
# Versions History extern
|
||||||
my %vNotesExtern = (
|
my %vNotesExtern = (
|
||||||
|
"9.9.0" => "21.05.2021 The new get command 'saveLastSnap' to save the last snapshot locally is now available. ",
|
||||||
"9.8.0" => "27.09.2020 New get command 'apiInfo' retrieves the API information and opens a popup window to show it. ",
|
"9.8.0" => "27.09.2020 New get command 'apiInfo' retrieves the API information and opens a popup window to show it. ",
|
||||||
"9.6.0" => "12.08.2020 The new attribute 'ptzNoCapPrePat' is available. It's helpful if your PTZ camera doesn't have the capability ".
|
"9.6.0" => "12.08.2020 The new attribute 'ptzNoCapPrePat' is available. It's helpful if your PTZ camera doesn't have the capability ".
|
||||||
"to deliver Presets and Patrols. Setting the attribute avoid error log messages in that case. ",
|
"to deliver Presets and Patrols. Setting the attribute avoid error log messages in that case. ",
|
||||||
@ -493,6 +495,7 @@ my %hget = ( # Ha
|
|||||||
listLog => { fn => "_getlistLog", needcred => 1 },
|
listLog => { fn => "_getlistLog", needcred => 1 },
|
||||||
listPresets => { fn => "_getlistPresets", needcred => 1 },
|
listPresets => { fn => "_getlistPresets", needcred => 1 },
|
||||||
saveRecording => { fn => "_getsaveRecording", needcred => 1 },
|
saveRecording => { fn => "_getsaveRecording", needcred => 1 },
|
||||||
|
saveLastSnap => { fn => "_getsaveLastSnap", needcred => 0 },
|
||||||
svsinfo => { fn => "_getsvsinfo", needcred => 1 },
|
svsinfo => { fn => "_getsvsinfo", needcred => 1 },
|
||||||
storedCredentials => { fn => "_getstoredCredentials", needcred => 1 },
|
storedCredentials => { fn => "_getstoredCredentials", needcred => 1 },
|
||||||
snapGallery => { fn => "_getsnapGallery", needcred => 1 },
|
snapGallery => { fn => "_getsnapGallery", needcred => 1 },
|
||||||
@ -4094,6 +4097,7 @@ sub Get {
|
|||||||
(IsCapPTZPan($hash) ? "listPresets:noArg " : "").
|
(IsCapPTZPan($hash) ? "listPresets:noArg " : "").
|
||||||
"snapinfo:noArg ".
|
"snapinfo:noArg ".
|
||||||
"saveRecording ".
|
"saveRecording ".
|
||||||
|
"saveLastSnap ".
|
||||||
"snapfileinfo:noArg ".
|
"snapfileinfo:noArg ".
|
||||||
"eventlist:noArg ".
|
"eventlist:noArg ".
|
||||||
"stmUrlPath:noArg "
|
"stmUrlPath:noArg "
|
||||||
@ -4246,6 +4250,57 @@ sub _getsaveRecording { ## no critic "not used"
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
################################################################
|
||||||
|
# Getter saveLastSnap
|
||||||
|
# Letzten Snap in File speichern
|
||||||
|
################################################################
|
||||||
|
sub _getsaveLastSnap { ## no critic 'not used'
|
||||||
|
my $paref = shift;
|
||||||
|
my $hash = $paref->{hash};
|
||||||
|
my $name = $paref->{name};
|
||||||
|
my $path = $paref->{arg} // $attr{global}{modpath};
|
||||||
|
|
||||||
|
return if(!IsModelCam($hash));
|
||||||
|
|
||||||
|
my ($imgdata,$err);
|
||||||
|
|
||||||
|
my $cache = cache($name, "c_init"); # Cache initialisieren
|
||||||
|
Log3($name, 1, "$name - Fall back to internal Cache due to preceding failure") if(!$cache);
|
||||||
|
|
||||||
|
if(!$cache || $cache eq "internal" ) {
|
||||||
|
$imgdata = $data{SSCam}{$name}{LASTSNAP};
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$imgdata = cache($name, "c_read", "{LASTSNAP}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$imgdata) {
|
||||||
|
Log3($name, 2, "$name - No image data available to save locally")
|
||||||
|
}
|
||||||
|
|
||||||
|
my $fname = ReadingsVal($name, "LastSnapFilename", "");
|
||||||
|
my $file = $path."/$fname";
|
||||||
|
|
||||||
|
open my $fh, '>', $file or do { $err = qq{Can't open file "$file": $!};
|
||||||
|
Log3($name, 2, "$name - $err");
|
||||||
|
};
|
||||||
|
|
||||||
|
if(!$err) {
|
||||||
|
$err = "none";
|
||||||
|
binmode $fh;
|
||||||
|
print $fh MIME::Base64::decode_base64($imgdata);
|
||||||
|
close($fh);
|
||||||
|
Log3($name, 3, qq{$name - Last Snapshot was saved to local file "$file"});
|
||||||
|
}
|
||||||
|
|
||||||
|
readingsBeginUpdate ($hash);
|
||||||
|
readingsBulkUpdate ($hash, "Errorcode", "none");
|
||||||
|
readingsBulkUpdate ($hash, "Error", $err );
|
||||||
|
readingsEndUpdate ($hash, 1);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Getter svsinfo
|
# Getter svsinfo
|
||||||
################################################################
|
################################################################
|
||||||
@ -6172,7 +6227,7 @@ sub _parseSaveRec { ## no critic "not used"
|
|||||||
|
|
||||||
my $err;
|
my $err;
|
||||||
|
|
||||||
my $lrec = ReadingsVal("$name", "CamLastRec", "");
|
my $lrec = ReadingsVal($name, "CamLastRec", "");
|
||||||
$lrec = (split("/",$lrec))[1];
|
$lrec = (split("/",$lrec))[1];
|
||||||
my $sp = $hash->{HELPER}{RECSAVEPATH} // $attr{global}{modpath};
|
my $sp = $hash->{HELPER}{RECSAVEPATH} // $attr{global}{modpath};
|
||||||
my $file = $sp."/$lrec";
|
my $file = $sp."/$lrec";
|
||||||
@ -7017,13 +7072,13 @@ sub _parsegetsnapinfo { ## no critic "not used"
|
|||||||
|
|
||||||
Log3($name, $verbose, "$name - Snapinfos of camera $camname retrieved");
|
Log3($name, $verbose, "$name - Snapinfos of camera $camname retrieved");
|
||||||
|
|
||||||
__saveLastSnap ($paref); # aktuellsten Snap in Cache zur Anzeige durch streamDev "lastsnap" speichern
|
__saveLastSnapToCache ($paref); # aktuellsten Snap in Cache zur Anzeige durch streamDev "lastsnap" speichern
|
||||||
__doSnapRotation ($paref); # Rotationsfeature
|
__doSnapRotation ($paref); # Rotationsfeature
|
||||||
|
|
||||||
setReadingErrorNone($hash, 1);
|
setReadingErrorNone ($hash, 1);
|
||||||
|
|
||||||
closeTrans ($hash); # Transaktion beenden falls gestartet
|
closeTrans ($hash); # Transaktion beenden falls gestartet
|
||||||
__refreshAfterSnap ($hash); # fallabhängige Eventgenerierung
|
__refreshAfterSnap ($hash); # fallabhängige Eventgenerierung
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7047,9 +7102,9 @@ sub _parsegetsnapgallery { ## no critic "not used"
|
|||||||
|
|
||||||
Log3($name, $verbose, "$name - Snapinfos of camera $camname retrieved");
|
Log3($name, $verbose, "$name - Snapinfos of camera $camname retrieved");
|
||||||
|
|
||||||
__saveLastSnap ($paref); # aktuellsten Snap in Cache zur Anzeige durch streamDev "lastsnap" speichern
|
__saveLastSnapToCache ($paref); # aktuellsten Snap in Cache zur Anzeige durch streamDev "lastsnap" speichern
|
||||||
__doSnapRotation ($paref); # Rotationsfeature
|
__doSnapRotation ($paref); # Rotationsfeature
|
||||||
__moveSnapCacheToOld($paref); # bestehende Schnappschußdaten aus SNAPHASH Cache auf SNAPOLDHASH schreiben und in SNAPHASH löschen
|
__moveSnapCacheToOld ($paref); # bestehende Schnappschußdaten aus SNAPHASH Cache auf SNAPOLDHASH schreiben und in SNAPHASH löschen
|
||||||
|
|
||||||
|
|
||||||
##### transaktionaler Versand der erzeugten Schnappschüsse #####
|
##### transaktionaler Versand der erzeugten Schnappschüsse #####
|
||||||
@ -7117,12 +7172,12 @@ return;
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
# aktuellsten Snap in Cache zur Anzeige durch streamDev "lastsnap" speichern
|
# aktuellsten Snap in Cache zur Anzeige durch streamDev "lastsnap" speichern
|
||||||
###############################################################################
|
###############################################################################
|
||||||
sub __saveLastSnap {
|
sub __saveLastSnapToCache {
|
||||||
my $paref = shift;
|
my $paref = shift;
|
||||||
my $name = $paref->{name};
|
my $name = $paref->{name};
|
||||||
my $data = $paref->{data}; # decodierte JSON Daten
|
my $data = $paref->{data}; # decodierte JSON Daten
|
||||||
|
|
||||||
my $cache = cache($name, "c_init"); # Cache initialisieren
|
my $cache = cache($name, "c_init"); # Cache initialisieren
|
||||||
|
|
||||||
Log3($name, 1, "$name - Fall back to internal Cache due to preceding failure.") if(!$cache);
|
Log3($name, 1, "$name - Fall back to internal Cache due to preceding failure.") if(!$cache);
|
||||||
|
|
||||||
@ -11779,7 +11834,7 @@ return;
|
|||||||
<li>Activation / Deactivation of a camera integrated PIR sensor </li>
|
<li>Activation / Deactivation of a camera integrated PIR sensor </li>
|
||||||
<li>Creation of a readingsGroup device to display an overview of all defined SSCam devices (createReadingsGroup) </li>
|
<li>Creation of a readingsGroup device to display an overview of all defined SSCam devices (createReadingsGroup) </li>
|
||||||
<li>automatized definition of all in SVS available cameras in FHEM (autocreateCams) </li>
|
<li>automatized definition of all in SVS available cameras in FHEM (autocreateCams) </li>
|
||||||
<li>save the last recording of camera locally </li>
|
<li>save the last recording or the last snapshot of camera locally </li>
|
||||||
<li>Selection of several cache types for image data storage (attribute cacheType) </li>
|
<li>Selection of several cache types for image data storage (attribute cacheType) </li>
|
||||||
<li>execute Zoom actions (only if PTZ camera supports Zoom) </li>
|
<li>execute Zoom actions (only if PTZ camera supports Zoom) </li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -12795,6 +12850,24 @@ attr <name> genericStrmHtmlTag <img $HTMLATTR
|
|||||||
Get a popup with a lists of presets saved for the camera.
|
Get a popup with a lists of presets saved for the camera.
|
||||||
</ul>
|
</ul>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><b> saveLastSnap [<Pfad>] </b> (gilt für CAM)</li> <br>
|
||||||
|
|
||||||
|
The (last) snapshot currently specified in the reading "LastSnapId" is saved locally as a jpg file.
|
||||||
|
Optionally, the path to save the file can be specified in the command (default: modpath in global Device). <br>
|
||||||
|
The file is locally given the same name as contained in the reading "LastSnapFilename". <br>
|
||||||
|
The resolution of the snapshot is determined by the attribute "snapGallerySize".
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<b>Example:</b> <br><br>
|
||||||
|
get <name> saveLastSnap /opt/fhem/log
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><b> saveRecording [<path>] </b> (valid for CAM)</li> <br>
|
<li><b> saveRecording [<path>] </b> (valid for CAM)</li> <br>
|
||||||
@ -12804,7 +12877,7 @@ attr <name> genericStrmHtmlTag <img $HTMLATTR
|
|||||||
The name of the saved local file is the same as displayed in Reading "CamLastRec". <br><br>
|
The name of the saved local file is the same as displayed in Reading "CamLastRec". <br><br>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<b>Beispiel:</b> <br><br>
|
<b>Example:</b> <br><br>
|
||||||
get <name> saveRecording /opt/fhem/log
|
get <name> saveRecording /opt/fhem/log
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -13731,7 +13804,7 @@ attr <name> genericStrmHtmlTag <img $HTMLATTR
|
|||||||
<li>Aktivierung / Deaktivierung eines kamerainternen PIR-Sensors </li>
|
<li>Aktivierung / Deaktivierung eines kamerainternen PIR-Sensors </li>
|
||||||
<li>Erzeugung einer readingsGroup zur Anzeige aller definierten SSCam-Devices (createReadingsGroup) </li>
|
<li>Erzeugung einer readingsGroup zur Anzeige aller definierten SSCam-Devices (createReadingsGroup) </li>
|
||||||
<li>Automatisiertes Anlegen aller in der SVS vorhandenen Kameras in FHEM (autocreateCams) </li>
|
<li>Automatisiertes Anlegen aller in der SVS vorhandenen Kameras in FHEM (autocreateCams) </li>
|
||||||
<li>lokales Abspeichern der letzten Kamera-Aufnahme </li>
|
<li>lokales Abspeichern der letzten Kamera-Aufnahme bzw. des letzten Schnappschusses </li>
|
||||||
<li>Auswahl unterschiedlicher Cache-Typen zur Bilddatenspeicherung (Attribut cacheType) </li>
|
<li>Auswahl unterschiedlicher Cache-Typen zur Bilddatenspeicherung (Attribut cacheType) </li>
|
||||||
<li>ausführen von Zoom-Aktionen (bei PTZ-Kameras die Zoom unterstützen) </li>
|
<li>ausführen von Zoom-Aktionen (bei PTZ-Kameras die Zoom unterstützen) </li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -14782,6 +14855,24 @@ attr <name> genericStrmHtmlTag <img $HTMLATTR
|
|||||||
</ul>
|
</ul>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<li><b> saveLastSnap [<Pfad>] </b> (gilt für CAM)</li> <br>
|
||||||
|
|
||||||
|
Der aktuell im Reading "LastSnapId" angegebene (letzte) Schnappschuß wird lokal als jpg-File gespeichert.
|
||||||
|
Optional kann der Pfad zur Speicherung des Files im Befehl angegeben werden (default: modpath im global Device). <br>
|
||||||
|
Das File erhält lokal den gleichen Namen wie im Reading "LastSnapFilename" enthalten. <br>
|
||||||
|
Die Auflösung des Schnappschusses wird durch das Attribut "snapGallerySize" bestimmt.
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<b>Beispiel:</b> <br><br>
|
||||||
|
get <name> saveLastSnap /opt/fhem/log
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><b> saveRecording [<Pfad>] </b> (gilt für CAM)</li> <br>
|
<li><b> saveRecording [<Pfad>] </b> (gilt für CAM)</li> <br>
|
||||||
|
|
||||||
@ -14795,7 +14886,7 @@ attr <name> genericStrmHtmlTag <img $HTMLATTR
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><b> scanVirgin </b> (gilt für CAM/SVS)</li> <br>
|
<li><b> scanVirgin </b> (gilt für CAM/SVS)</li> <br>
|
||||||
|
Loading…
Reference in New Issue
Block a user