mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-19 18:56:03 +00:00
73_DoorBird: Feature: No Picture/video menue for stations without camera
git-svn-id: https://svn.fhem.de/fhem/trunk@20246 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
62aceb7a5c
commit
6fb710f62e
@ -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;
|
||||
@ -392,6 +392,9 @@ sub DoorBird_Attr(@)
|
||||
### 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
|
||||
@ -415,6 +418,15 @@ sub DoorBird_Attr(@)
|
||||
InternalTimer(gettimeofday()+$hash->{helper}{SessionIdSec}, "DoorBird_RenewSessionID", $hash, 0);
|
||||
}
|
||||
}
|
||||
### If the attribute has been deleted entirely
|
||||
else{
|
||||
### Save standard interval as internal
|
||||
$hash->{helper}{SessionIdSec} = 540;
|
||||
|
||||
### Re-Initiate the timer
|
||||
InternalTimer(gettimeofday()+$hash->{helper}{SessionIdSec}, "DoorBird_RenewSessionID", $hash, 0);
|
||||
}
|
||||
}
|
||||
### Check whether ImageFileSave attribute has been provided
|
||||
elsif ($a[2] eq "ImageFileDir") {
|
||||
### Check whether ImageFileSave is defined
|
||||
@ -497,19 +509,18 @@ sub DoorBird_Get($@)
|
||||
|
||||
### Define "get" menu
|
||||
my $usage = "Unknown argument, choose one of ";
|
||||
$usage .= "Image_Request:noArg History_Request: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 debug modus is NOT enabled
|
||||
else {
|
||||
$usage .= "Info_Request:noArg List_Favorites:noArg List_Schedules:noArg ";
|
||||
}
|
||||
return $usage if $command eq '?';
|
||||
|
||||
### If DoorBird has a Camera installed
|
||||
if ($hash->{helper}{CameraInstalled} == true) {
|
||||
$usage .= "Image_Request:noArg History_Request:noArg "
|
||||
}
|
||||
### If DoorBird has NO Camera installed
|
||||
else {
|
||||
# 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 ';
|
||||
my $usage = "Unknown argument, choose one of ";
|
||||
$usage .= "Open_Door:" . join(",", @RelayAdresses) . " Restart:noArg Transmit_Audio ";
|
||||
|
||||
### Create Selection List
|
||||
$usage .= "Live_Video:on,off Open_Door:" . join(",", @RelayAdresses) . " Light_On:noArg Restart:noArg Live_Audio:on,off 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,6 +1369,7 @@ 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;
|
||||
@ -1356,6 +1377,10 @@ sub DoorBird_FW_detailFn($$$$) {
|
||||
my @HistoryDoorbell;
|
||||
my @HistoryMotion;
|
||||
|
||||
|
||||
### 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}};
|
||||
@ -1410,7 +1435,7 @@ sub DoorBird_FW_detailFn($$$$) {
|
||||
#type="audio/wav
|
||||
|
||||
### Create html Code
|
||||
my $htmlCode = '
|
||||
$htmlCode = '
|
||||
<table border="1" style="border-collapse:separate;">
|
||||
<tbody >
|
||||
<tr>
|
||||
@ -1466,7 +1491,6 @@ sub DoorBird_FW_detailFn($$$$) {
|
||||
</tr>
|
||||
';
|
||||
|
||||
|
||||
### Log Entry for debugging purposes
|
||||
Log3 $name, 5, $name. " : DoorBird_FW_detailFn - hash->{helper}{MaxHistory} : " . $hash->{helper}{MaxHistory};
|
||||
|
||||
@ -1534,6 +1558,7 @@ sub DoorBird_FW_detailFn($$$$) {
|
||||
';
|
||||
|
||||
}
|
||||
}
|
||||
### Log Entry for debugging purposes
|
||||
# Log3 $name, 5, $name. " : DoorBird_FW_detailFn - htmlCode : " . $htmlCode;
|
||||
|
||||
@ -1628,6 +1653,21 @@ sub DoorBird_Info_Request($$) {
|
||||
readingsBulkUpdate($hash, "RelayAddr_" . sprintf("%02d", $RelayNumber), $RelayAddress);
|
||||
}
|
||||
}
|
||||
### If the entry has the information about the device type
|
||||
elsif ( $key eq "DEVICE-TYPE") {
|
||||
|
||||
### If the Device Type is not containing type numbers which have no camera installed - Currently only "DoorBird D301A - Door Intercom IP Upgrade"
|
||||
if ($VersionContent -> {$key} !~ m/301/) {
|
||||
### Set Information about Camera installed to true
|
||||
$hash->{helper}{CameraInstalled} = true;
|
||||
}
|
||||
|
||||
### Log Entry for debugging purposes
|
||||
Log3 $name, 5, $name. " : DoorBird_Info_Request - Content of" . sprintf("%15s %-s", $key, ": " . $VersionContent -> {$key});
|
||||
|
||||
### Update Reading
|
||||
readingsBulkUpdate($hash, $key, $VersionContent -> {$key} );
|
||||
}
|
||||
### For all other entries
|
||||
else {
|
||||
|
||||
@ -1641,6 +1681,9 @@ sub DoorBird_Info_Request($$) {
|
||||
### Update Reading for Firmware-Status
|
||||
readingsBulkUpdate($hash, "Firmware-Status", "up-to-date");
|
||||
|
||||
### Update SessionId
|
||||
DoorBird_RenewSessionID($hash);
|
||||
|
||||
### Execute Readings Bulk Update
|
||||
readingsEndUpdate($hash, 1);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user