49_SSCam: new attribute ptzNoCapPrePat

git-svn-id: https://svn.fhem.de/fhem/trunk@22592 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2020-08-12 21:28:56 +00:00
parent cc87d28985
commit 0b5523c7ad
2 changed files with 90 additions and 63 deletions

View File

@ -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 attribute ptzNoCapPrePat
- feature: 60_Watches: control buttons,new attr hideButtons, controlButtonSize - feature: 60_Watches: control buttons,new attr hideButtons, controlButtonSize
some more changes according PBP some more changes according PBP
- bugfix: 73_AutoShuttersControl: change from %k to %H for better compability - bugfix: 73_AutoShuttersControl: change from %k to %H for better compability

View File

@ -159,6 +159,7 @@ BEGIN {
# Versions History intern # Versions History intern
my %vNotesIntern = ( my %vNotesIntern = (
"9.6.0" => "12.08.2020 new attribute ptzNoCapPrePat ",
"9.5.3" => "27.07.2020 fix warning: Use of uninitialized value in subroutine dereference at ... ", "9.5.3" => "27.07.2020 fix warning: Use of uninitialized value in subroutine dereference at ... ",
"9.5.2" => "26.07.2020 more changes according PBP level 3, minor fixes ", "9.5.2" => "26.07.2020 more changes according PBP level 3, minor fixes ",
"9.5.1" => "24.07.2020 set compatibility to 8.2.8, some changes according PBP level 3 ", "9.5.1" => "24.07.2020 set compatibility to 8.2.8, some changes according PBP level 3 ",
@ -211,6 +212,8 @@ my %vNotesIntern = (
# Versions History extern # Versions History extern
my %vNotesExtern = ( my %vNotesExtern = (
"9.6.0" => "12.08.2020 The new attribute 'ptzNoCapPrePat' is available. It's helpfull if your PTZ camera doesn't have the capability ".
"to deliver Presets and Patrols. Setting the attribute avoid error log messages in that case. ",
"9.5.0" => "15.07.2020 A new type 'master' supplements the possible createStreamDev command options. The streaming type ". "9.5.0" => "15.07.2020 A new type 'master' supplements the possible createStreamDev command options. The streaming type ".
"'master' cannot play back streams itself, but opens up new possibilities by flexibly accepting streams from ". "'master' cannot play back streams itself, but opens up new possibilities by flexibly accepting streams from ".
"other defined streaming devices. ". "other defined streaming devices. ".
@ -631,6 +634,7 @@ sub Initialize {
"livestreamprefix ". "livestreamprefix ".
"loginRetries:1,2,3,4,5,6,7,8,9,10 ". "loginRetries:1,2,3,4,5,6,7,8,9,10 ".
"pollcaminfoall ". "pollcaminfoall ".
"ptzNoCapPrePat:1,0 ".
"recChatTxt ". "recChatTxt ".
"recEmailTxt ". "recEmailTxt ".
"recTelegramTxt ". "recTelegramTxt ".
@ -1126,7 +1130,7 @@ sub Set {
(IsCapPTZPan($hash) ? "delPreset:".ReadingsVal("$name","Presets","")." " : ""). (IsCapPTZPan($hash) ? "delPreset:".ReadingsVal("$name","Presets","")." " : "").
(IsCapPTZPan($hash) ? "runPatrol:".ReadingsVal("$name", "Patrols", "")." " : ""). (IsCapPTZPan($hash) ? "runPatrol:".ReadingsVal("$name", "Patrols", "")." " : "").
(IsCapPTZPan($hash) ? "goPreset:".ReadingsVal("$name", "Presets", "")." " : ""). (IsCapPTZPan($hash) ? "goPreset:".ReadingsVal("$name", "Presets", "")." " : "").
(IsCapPTZPan($hash) ? "createPTZcontrol:noArg " : ""). (IsCapPTZ($hash) ? "createPTZcontrol:noArg " : "").
(IsCapPTZAbs($hash) ? "goAbsPTZ"." " : ""). (IsCapPTZAbs($hash) ? "goAbsPTZ"." " : "").
(IsCapPTZDir($hash) ? "move"." " : ""). (IsCapPTZDir($hash) ? "move"." " : "").
(IsCapPIR($hash) ? "pirSensor:activate,deactivate " : ""). (IsCapPIR($hash) ? "pirSensor:activate,deactivate " : "").
@ -1852,7 +1856,7 @@ sub Get {
"caminfo:noArg ". "caminfo:noArg ".
((AttrVal($name,"snapGalleryNumber",undef) || AttrVal($name,"snapGalleryBoost",0)) ((AttrVal($name,"snapGalleryNumber",undef) || AttrVal($name,"snapGalleryBoost",0))
? "snapGallery:noArg " : "snapGallery:$defSnum "). ? "snapGallery:noArg " : "snapGallery:$defSnum ").
((ReadingsVal("$name", "CapPTZPresetNumber", 0) != 0) ? "listPresets:noArg " : ""). (IsCapPTZPan($hash) ? "listPresets:noArg " : "").
"snapinfo:noArg ". "snapinfo:noArg ".
"svsinfo:noArg ". "svsinfo:noArg ".
"saveRecording ". "saveRecording ".
@ -3176,9 +3180,9 @@ sub getPresets {
$error = expErrors($hash,$errorcode); $error = expErrors($hash,$errorcode);
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"Errorcode",$errorcode); readingsBulkUpdate ($hash, "Errorcode", $errorcode);
readingsBulkUpdate($hash,"Error",$error); readingsBulkUpdate ($hash, "Error", $error);
readingsEndUpdate($hash, 1); readingsEndUpdate ($hash, 1);
Log3($name, 2, "$name - ERROR - Preset list of Camera $camname can't be get - $error"); Log3($name, 2, "$name - ERROR - Preset list of Camera $camname can't be get - $error");
@ -6953,27 +6957,26 @@ sub camOp_Parse {
# Setreading # Setreading
readingsBeginUpdate($hash); readingsBeginUpdate($hash);
readingsBulkUpdate($hash,"CapPTZAutoFocus", $data->{'data'}{'ptzAutoFocus'} ); readingsBulkUpdate ($hash,"CapPTZAutoFocus", $data->{'data'}{'ptzAutoFocus'} );
readingsBulkUpdate($hash,"CapAudioOut", $data->{'data'}{'audioOut'} ); readingsBulkUpdate ($hash,"CapAudioOut", $data->{'data'}{'audioOut'} );
readingsBulkUpdate($hash,"CapChangeSpeed", $data->{'data'}{'ptzSpeed'} ); readingsBulkUpdate ($hash,"CapChangeSpeed", $data->{'data'}{'ptzSpeed'} );
readingsBulkUpdate($hash,"CapPTZHome", $data->{'data'}{'ptzHome'} ); readingsBulkUpdate ($hash,"CapPTZHome", $data->{'data'}{'ptzHome'} );
readingsBulkUpdate($hash,"CapPTZAbs", $data->{'data'}{'ptzAbs'} ); readingsBulkUpdate ($hash,"CapPTZAbs", $data->{'data'}{'ptzAbs'} );
readingsBulkUpdate($hash,"CapPTZDirections", $data->{'data'}{'ptzDirection'} ); readingsBulkUpdate ($hash,"CapPTZDirections", $data->{'data'}{'ptzDirection'} );
readingsBulkUpdate($hash,"CapPTZFocus", $ptzfocus ); readingsBulkUpdate ($hash,"CapPTZFocus", $ptzfocus );
readingsBulkUpdate($hash,"CapPTZIris", $ptziris ); readingsBulkUpdate ($hash,"CapPTZIris", $ptziris );
readingsBulkUpdate($hash,"CapPTZObjTracking", $data->{'data'}{'ptzHasObjTracking'} ); readingsBulkUpdate ($hash,"CapPTZObjTracking", $data->{'data'}{'ptzHasObjTracking'} );
readingsBulkUpdate($hash,"CapPTZPan", $ptzpan ); readingsBulkUpdate ($hash,"CapPTZPan", $ptzpan );
readingsBulkUpdate($hash,"CapPTZPresetNumber", $data->{'data'}{'ptzPresetNumber'} ); readingsBulkUpdate ($hash,"CapPTZPresetNumber", $data->{'data'}{'ptzPresetNumber'} );
readingsBulkUpdate($hash,"CapPTZTilt", $ptztilt ); readingsBulkUpdate ($hash,"CapPTZTilt", $ptztilt );
readingsBulkUpdate($hash,"CapPTZZoom", $ptzzoom ); readingsBulkUpdate ($hash,"CapPTZZoom", $ptzzoom );
readingsBulkUpdate($hash,"Errorcode", "none" ); readingsBulkUpdate ($hash,"Errorcode", "none" );
readingsBulkUpdate($hash,"Error", "none" ); readingsBulkUpdate ($hash,"Error", "none" );
readingsEndUpdate($hash, 1); readingsEndUpdate ($hash, 1);
Log3($name, $verbose, "$name - Capabilities of camera $camname retrieved"); Log3($name, $verbose, "$name - Capabilities of camera $camname retrieved");
} elsif ($OpMode eq "Getptzlistpreset") { } elsif ($OpMode eq "Getptzlistpreset") { # Parse PTZ-ListPresets
# Parse PTZ-ListPresets
my $presetcnt = $data->{'data'}->{'total'}; my $presetcnt = $data->{'data'}->{'total'};
my $cnt = 0; my $cnt = 0;
@ -6981,7 +6984,6 @@ sub camOp_Parse {
delete $hash->{HELPER}{ALLPRESETS}; # besetehende Presets löschen und neu einlesen delete $hash->{HELPER}{ALLPRESETS}; # besetehende Presets löschen und neu einlesen
my $home = "not set"; my $home = "not set";
while ($cnt < $presetcnt) { while ($cnt < $presetcnt) {
# my $presid = $data->{'data'}->{'presets'}->[$cnt]->{'id'};
my $presid = $data->{'data'}->{'presets'}->[$cnt]->{'position'}; my $presid = $data->{'data'}->{'presets'}->[$cnt]->{'position'};
my $presname = $data->{'data'}->{'presets'}->[$cnt]->{'name'}; my $presname = $data->{'data'}->{'presets'}->[$cnt]->{'name'};
$presname =~ s/\s+/_/gx; # Leerzeichen im Namen ersetzen falls vorhanden $presname =~ s/\s+/_/gx; # Leerzeichen im Namen ersetzen falls vorhanden
@ -6996,20 +6998,19 @@ sub camOp_Parse {
my @preskeys = sort(keys(%{$hash->{HELPER}{ALLPRESETS}})); my @preskeys = sort(keys(%{$hash->{HELPER}{ALLPRESETS}}));
my $presetlist = join(",",@preskeys); my $presetlist = join(",",@preskeys);
readingsBeginUpdate($hash); readingsBeginUpdate ($hash);
readingsBulkUpdate($hash,"Presets",$presetlist); readingsBulkUpdate ($hash, "Presets", $presetlist);
readingsBulkUpdate($hash,"PresetHome",$home); readingsBulkUpdate ($hash, "PresetHome", $home );
readingsBulkUpdate($hash,"Errorcode","none"); readingsBulkUpdate ($hash, "Errorcode", "none" );
readingsBulkUpdate($hash,"Error","none"); readingsBulkUpdate ($hash, "Error", "none" );
readingsEndUpdate($hash, 1); readingsEndUpdate ($hash, 1);
# spezifische Attribute für PTZ-Cams verfügbar machen # spezifische Attribute für PTZ-Cams verfügbar machen
addptzattr($name); addptzattr($name);
Log3($name, $verbose, "$name - PTZ Presets of camera $camname retrieved"); Log3($name, $verbose, "$name - PTZ Presets of camera $camname retrieved");
} elsif ($OpMode eq "Getptzlistpatrol") { } elsif ($OpMode eq "Getptzlistpatrol") { # Parse PTZ-ListPatrols
# Parse PTZ-ListPatrols
$patrolcnt = $data->{'data'}->{'total'}; $patrolcnt = $data->{'data'}->{'total'};
my $cnt = 0; my $cnt = 0;
@ -7026,18 +7027,16 @@ sub camOp_Parse {
@patrolkeys = sort(keys(%{$hash->{HELPER}{ALLPATROLS}})); @patrolkeys = sort(keys(%{$hash->{HELPER}{ALLPATROLS}}));
$patrollist = join(",",@patrolkeys); $patrollist = join(",",@patrolkeys);
readingsBeginUpdate($hash); readingsBeginUpdate ($hash);
readingsBulkUpdate($hash,"Patrols",$patrollist); readingsBulkUpdate ($hash, "Patrols", $patrollist);
readingsBulkUpdate($hash,"Errorcode","none"); readingsBulkUpdate ($hash, "Errorcode", "none" );
readingsBulkUpdate($hash,"Error","none"); readingsBulkUpdate ($hash, "Error", "none" );
readingsEndUpdate($hash, 1); readingsEndUpdate ($hash, 1);
Log3($name, $verbose, "$name - PTZ Patrols of camera $camname retrieved"); Log3($name, $verbose, "$name - PTZ Patrols of camera $camname retrieved");
} }
} else { } else { # die API-Operation war fehlerhaft
# die API-Operation war fehlerhaft
# Errorcode aus JSON ermitteln # Errorcode aus JSON ermitteln
$errorcode = $data->{'error'}->{'code'}; $errorcode = $data->{'error'}->{'code'};
@ -7069,7 +7068,6 @@ sub camOp_Parse {
return; return;
} }
############################################################################################################################# #############################################################################################################################
######### Hilfsroutinen ############# ######### Hilfsroutinen #############
############################################################################################################################# #############################################################################################################################
@ -7520,11 +7518,20 @@ sub IsCapZoom { # PTZ
return $cap; return $cap;
} }
sub IsCapPTZ { # PTZ Directions möglich Eigenschaft
my $hash = shift;
my $name = $hash->{NAME};
my $cap = ReadingsVal($name, "DeviceType", "Camera") eq "PTZ" ? 1 : 0;
return $cap;
}
sub IsCapPTZPan { # PTZ Pan Eigenschaft sub IsCapPTZPan { # PTZ Pan Eigenschaft
my $hash = shift; my $hash = shift;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $cap = ReadingsVal($name, "CapPTZPan", "false") ne "false" ? 1 : 0; my $cap = (ReadingsVal($name, "CapPTZPan", "false") ne "false" && !AttrVal($name, "ptzNoCapPrePat", 0)) ? 1 : 0;
return $cap; return $cap;
} }
@ -12902,21 +12909,32 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
<li><b>noQuotesForSID</b><br> <li><b>noQuotesForSID</b><br>
This attribute delete the quotes for SID and for StmKeys. This attribute delete the quotes for SID and for StmKeys.
The attribute may be helpful in some cases to avoid errormessages "402 - permission denied" or "105 - The attribute may be helpful in some cases to avoid errormessages "402 - permission denied" or "105 -
Insufficient user privilege" and makes login possible. </li><br> Insufficient user privilege" and makes login possible.
</li><br>
<a name="pollcaminfoall"></a> <a name="pollcaminfoall"></a>
<li><b>pollcaminfoall</b><br> <li><b>pollcaminfoall</b><br>
Interval of automatic polling the Camera properties (if <= 10: no polling, if &gt; 10: polling with interval) </li><br> Interval of automatic polling the Camera properties (if <= 10: no polling, if &gt; 10: polling with interval)
</li><br>
<a name="pollnologging"></a> <a name="pollnologging"></a>
<li><b>pollnologging</b><br> <li><b>pollnologging</b><br>
"0" resp. not set = Logging device polling active (default), "1" = Logging device polling inactive</li><br> "0" resp. not set = Logging device polling active (default), "1" = Logging device polling inactive
</li><br>
<a name="ptzNoCapPrePat"></a>
<li><b>ptzNoCapPrePat</b><br>
Some PTZ cameras cannot store presets and patrols despite their PTZ capabilities.
To avoid errors and corresponding log messages, the attribute ptzNoCapPrePat can be set in these cases.
The system will be notified of a missing preset / patrol capability.
</li><br>
<a name="ptzPanel_Home"></a> <a name="ptzPanel_Home"></a>
<li><b>ptzPanel_Home</b><br> <li><b>ptzPanel_Home</b><br>
In the PTZ-control panel the Home-Icon (in attribute "ptzPanel_row02") is automatically assigned to the value of In the PTZ-control panel the Home-Icon (in attribute "ptzPanel_row02") is automatically assigned to the value of
Reading "PresetHome". Reading "PresetHome".
With "ptzPanel_Home" you can change the assignment to another preset from the available Preset list. </li><br> With "ptzPanel_Home" you can change the assignment to another preset from the available Preset list.
</li><br>
<a name="ptzPanel_iconPath"></a> <a name="ptzPanel_iconPath"></a>
<li><b>ptzPanel_iconPath</b><br> <li><b>ptzPanel_iconPath</b><br>
@ -14888,11 +14906,19 @@ attr &lt;name&gt; genericStrmHtmlTag &lt;img $HTMLATTR
"0" bzw. nicht gesetzt = Logging Gerätepolling aktiv (default), "1" = Logging "0" bzw. nicht gesetzt = Logging Gerätepolling aktiv (default), "1" = Logging
Gerätepolling inaktiv </li><br> Gerätepolling inaktiv </li><br>
<a name="ptzNoCapPrePat"></a>
<li><b>ptzNoCapPrePat</b><br>
Manche PTZ-Kameras können trotz ihrer PTZ-Fähigkeiten keine Presets und Patrols speichern.
Um Fehler und entsprechende Logmeldungen zu vermeiden, kann in diesen Fällen das Attribut ptzNoCapPrePat gesetzt
werden. Dem System wird eine fehlende Preset / Patrol Fähigkeit mitgeteilt.
</li><br>
<a name="ptzPanel_Home"></a> <a name="ptzPanel_Home"></a>
<li><b>ptzPanel_Home</b><br> <li><b>ptzPanel_Home</b><br>
Im PTZ-Steuerungspaneel wird dem Home-Icon (im Attribut "ptzPanel_row02") automatisch der Wert des Readings Im PTZ-Steuerungspaneel wird dem Home-Icon (im Attribut "ptzPanel_row02") automatisch der Wert des Readings
"PresetHome" zugewiesen. "PresetHome" zugewiesen.
Mit "ptzPanel_Home" kann diese Zuweisung mit einem Preset aus der verfügbaren Preset-Liste geändert werden. </li><br> Mit "ptzPanel_Home" kann diese Zuweisung mit einem Preset aus der verfügbaren Preset-Liste geändert werden.
</li><br>
<a name="ptzPanel_iconPath"></a> <a name="ptzPanel_iconPath"></a>
<li><b>ptzPanel_iconPath</b><br> <li><b>ptzPanel_iconPath</b><br>