diff --git a/fhem/FHEM/73_DoorBird.pm b/fhem/FHEM/73_DoorBird.pm
index 630d940b6..63fe37159 100644
--- a/fhem/FHEM/73_DoorBird.pm
+++ b/fhem/FHEM/73_DoorBird.pm
@@ -37,7 +37,6 @@
# Check problems with error message after startup: "PERL WARNING: Prototype mismatch: sub main::memcmp: none vs ($$;$) at /usr/local/share/perl/5.24.1/Sub/Exporter.pm line 445."
#
#
-#
########################################################################################################################
package main;
@@ -161,7 +160,7 @@ sub DoorBird_Define($$)
###START###### Writing values to global hash ###############################################################START####
$hash->{NAME} = $name;
- $hash->{RevisonAPI} = "0.25";
+ $hash->{RevisonAPI} = "0.26";
$hash->{helper}{SOX} = "/usr/bin/sox"; #On Windows systems use "C:\Programme\sox\sox.exe"
$hash->{helper}{URL} = $url;
$hash->{helper}{SipDevice} = AttrVal($name,"SipDevice","");
@@ -176,6 +175,7 @@ sub DoorBird_Define($$)
$hash->{helper}{ImageFileDir} = AttrVal($name, "ImageFileDir", 0);
$hash->{helper}{EventReset} = AttrVal($name, "EventReset", 5);
$hash->{helper}{WaitForHistory} = AttrVal($name, "WaitForHistory", 7);
+ $hash->{helper}{CameraInstalled} = false;
$hash->{helper}{SessionId} = 0;
$hash->{helper}{UdpMessageId} = 0;
$hash->{helper}{UdpMotionId} = 0;
@@ -391,22 +391,34 @@ sub DoorBird_Attr(@)
elsif ($a[2] eq "SessionIdSec") {
### Remove Timer for LostConn
RemoveInternalTimer($hash, "DoorBird_RenewSessionID");
+
+ ### If the attribute has not been deleted entirely
+ if (defined $a[3]) {
- ### Check whether SessionIdSec is 0 = disabled
- if ($a[3] == int($a[3]) && ($a[3] == 0)) {
- ### Save attribute as internal
- $hash->{helper}{SessionIdSec} = 0;
- }
- ### If KeepAliveTimeout is numeric and greater than 9s
- elsif ($a[3] == int($a[3]) && ($a[3] > 9)) {
+ ### Check whether SessionIdSec is 0 = disabled
+ if ($a[3] == int($a[3]) && ($a[3] == 0)) {
+ ### Save attribute as internal
+ $hash->{helper}{SessionIdSec} = 0;
+ }
+ ### If KeepAliveTimeout is numeric and greater than 9s
+ elsif ($a[3] == int($a[3]) && ($a[3] > 9)) {
- ### Save attribute as internal
- $hash->{helper}{SessionIdSec} = $a[3];
+ ### Save attribute as internal
+ $hash->{helper}{SessionIdSec} = $a[3];
- ### Re-Initiate the timer
- InternalTimer(gettimeofday()+$hash->{helper}{SessionIdSec}, "DoorBird_RenewSessionID", $hash, 0);
+ ### Re-Initiate the timer
+ InternalTimer(gettimeofday()+$hash->{helper}{SessionIdSec}, "DoorBird_RenewSessionID", $hash, 0);
+ }
+ ### If KeepAliveTimeout is NOT numeric or smaller than 10
+ else{
+ ### Save standard interval as internal
+ $hash->{helper}{SessionIdSec} = 540;
+
+ ### Re-Initiate the timer
+ InternalTimer(gettimeofday()+$hash->{helper}{SessionIdSec}, "DoorBird_RenewSessionID", $hash, 0);
+ }
}
- ### If KeepAliveTimeout is NOT numeric or smaller than 10
+ ### If the attribute has been deleted entirely
else{
### Save standard interval as internal
$hash->{helper}{SessionIdSec} = 540;
@@ -497,19 +509,18 @@ sub DoorBird_Get($@)
### Define "get" menu
my $usage = "Unknown argument, choose one of ";
- $usage .= "Image_Request:noArg History_Request:noArg ";
+ $usage .= "Info_Request:noArg List_Favorites:noArg List_Schedules:noArg ";
-
- ### If debug modus is enabled and allows JSON extract
- if ($hash->{helper}{debug} == 1) {
- $usage .= " Info_Request:,JSON List_Favorites:,JSON List_Schedules:,JSON";
+ ### If DoorBird has a Camera installed
+ if ($hash->{helper}{CameraInstalled} == true) {
+ $usage .= "Image_Request:noArg History_Request:noArg "
}
- ### If debug modus is NOT enabled
+ ### If DoorBird has NO Camera installed
else {
- $usage .= " Info_Request:noArg List_Favorites:noArg List_Schedules:noArg";
+ # Do not add anything
}
+ ### Return values
return $usage if $command eq '?';
-
### Log Entry for debugging purposes
Log3 $name, 5, $name. " : DoorBird_Get - usage : " . $usage;
@@ -588,11 +599,20 @@ sub DoorBird_Set($@)
Log3 $name, 5, $name. " : DoorBird_Set - RelayAdresses : " . join(",", @RelayAdresses);
### Define "set" menu
- my $usage = 'Unknown argument, choose one of ';
-
- ### Create Selection List
- $usage .= "Live_Video:on,off Open_Door:" . join(",", @RelayAdresses) . " Light_On:noArg Restart:noArg Live_Audio:on,off Transmit_Audio";
+ my $usage = "Unknown argument, choose one of ";
+ $usage .= "Open_Door:" . join(",", @RelayAdresses) . " Restart:noArg Transmit_Audio ";
+ ### If DoorBird has a Camera installed
+ if ($hash->{helper}{CameraInstalled} == true) {
+ ### Create Selection List for camera
+ $usage .= "Live_Video:on,off Light_On:noArg Live_Audio:on,off ";
+ }
+ ### If DoorBird has NO Camera installed
+ else {
+ # Do not add anything
+ }
+
+ ### Return values
return $usage if $command eq '?';
### Log Entry for debugging purposes
@@ -1349,196 +1369,201 @@ sub DoorBird_FW_detailFn($$$$) {
my $VideoURL = ReadingsVal($name, ".VideoURL", "");
my $ImageURL = ReadingsVal($name, ".ImageURL", "");
my $AudioURL = ReadingsVal($name, ".AudioURL", "");
+ my $htmlCode;
my $VideoHtmlCode;
my $ImageHtmlCode;
my $ImageHtmlCodeBig;
my $AudioHtmlCode;
my @HistoryDoorbell;
my @HistoryMotion;
-
- ### Log Entry for debugging purposes
- if (defined $hash->{helper}{Images}{History}{doorbell}) {
- @HistoryDoorbell = @{$hash->{helper}{Images}{History}{doorbell}};
- Log3 $name, 5, $name. " : DoorBird_FW_detailFn - Size ImageData doorbell : " . @HistoryDoorbell;
- }
- ### Log Entry for debugging purposes
- if (defined $hash->{helper}{Images}{History}{motionsensor}) {
- @HistoryMotion = @{$hash->{helper}{Images}{History}{motionsensor}};
- Log3 $name, 5, $name. " : DoorBird_FW_detailFn - Size ImageData motion : " . @HistoryMotion;
- }
-
- ### If VideoURL is empty
- if ($VideoURL eq "") {
- ### Create Standard Response
- $VideoHtmlCode = "Video Stream deactivated";
- }
- ### If VideoURL is NOT empty
- else {
- ### Create proper html code including popup
- my $ImageHtmlCodeBig = "";
- my $PopupfunctionCode = "onclick=\"FW_okDialog(\'" . $ImageHtmlCodeBig . "\') \" ";
- $VideoHtmlCode = '
';
- ### Create proper html link
- #$VideoHtmlCode = '
';
- }
-
- ### If ImageData is empty
- if ($ImageData eq "") {
- ### Create Standard Response
- $ImageHtmlCode = "Image not available";
- }
- ### If ImageData is NOT empty
- else {
- ### Create proper html code including popup
- my $ImageHtmlCodeBig = "
Image from ' . $ImageTimeStamp . ' | -Live Stream | -
- ' . $ImageHtmlCode . ' - | + ### Only if DoorBird has a Camera installed view the Image and History Part + if ($hash->{helper}{CameraInstalled} == true) { + + ### Log Entry for debugging purposes + if (defined $hash->{helper}{Images}{History}{doorbell}) { + @HistoryDoorbell = @{$hash->{helper}{Images}{History}{doorbell}}; + Log3 $name, 5, $name. " : DoorBird_FW_detailFn - Size ImageData doorbell : " . @HistoryDoorbell; + } + ### Log Entry for debugging purposes + if (defined $hash->{helper}{Images}{History}{motionsensor}) { + @HistoryMotion = @{$hash->{helper}{Images}{History}{motionsensor}}; + Log3 $name, 5, $name. " : DoorBird_FW_detailFn - Size ImageData motion : " . @HistoryMotion; + } + + ### If VideoURL is empty + if ($VideoURL eq "") { + ### Create Standard Response + $VideoHtmlCode = "Video Stream deactivated"; + } + ### If VideoURL is NOT empty + else { -
- ' . $VideoHtmlCode . ' - |
-
- | ' . $AudioHtmlCode . ' | -
History of events - Last download: ' . $hash->{helper}{HistoryTime} . ' | +Image from ' . $ImageTimeStamp . ' | +Live Stream | ||||
+ ' . $ImageHtmlCode . ' + | -||||||
Doorbell | -- | Motion-Sensor | +
+ ' . $VideoHtmlCode . ' + |
|||
Picture | -Timestamp | -# | -Picture | -Timestamp | -+ | ' . $AudioHtmlCode . ' | + + +
History of events - Last download: ' . $hash->{helper}{HistoryTime} . ' | +||||
Doorbell | ++ | Motion-Sensor | +||
Picture | +Timestamp | +# | +Picture | +Timestamp | +
' . $ImageHtmlCodeDoorbell . ' | +' . $HistoryDoorbell[$i]{timestamp} . ' | +' . ($i + 1) . ' | +' . $ImageHtmlCodeMotion . ' | +' . $HistoryMotion[$i]{timestamp} . ' | +
' . $ImageHtmlCodeDoorbell . ' | -' . $HistoryDoorbell[$i]{timestamp} . ' | -' . ($i + 1) . ' | -' . $ImageHtmlCodeMotion . ' | -' . $HistoryMotion[$i]{timestamp} . ' | -