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

49_IPCAM: introduced attribute 'blocking'

git-svn-id: https://svn.fhem.de/fhem/trunk@24924 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
delmar 2021-09-06 08:47:51 +00:00
parent ae5f21ae0d
commit d906647fa3
2 changed files with 14 additions and 7 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_IPCAM: introduced attribute 'blocking'
- bugfix: 47_OBIS: Support Holley-smartmeters with negative metering - bugfix: 47_OBIS: Support Holley-smartmeters with negative metering
- change: 10_KNX: major rewrite of the module. pls. check forum #122582 - change: 10_KNX: major rewrite of the module. pls. check forum #122582
before shutdown/restart! fixed crash using Attr KNX_toggle before shutdown/restart! fixed crash using Attr KNX_toggle

View File

@ -47,7 +47,7 @@ IPCAM_Initialize($$)
"cmd01data cmd02data cmd03data cmd04data cmd05data cmd06data cmd07data ". "cmd01data cmd02data cmd03data cmd04data cmd05data cmd06data cmd07data ".
"cmd08data cmd09data cmd10data cmd11data cmd12data cmd13data cmd14data cmd15data ". "cmd08data cmd09data cmd10data cmd11data cmd12data cmd13data cmd14data cmd15data ".
"model do_not_notify:1,0 showtime:1,0 scheme:http,https ". "model do_not_notify:1,0 showtime:1,0 scheme:http,https ".
"disable:0,1 unknownFormatRetryDelay handleAnyXmlAsSvg:0,1 unknownFormatRetryCount ". "disable:0,1 unknownFormatRetryDelay handleAnyXmlAsSvg:0,1 unknownFormatRetryCount blocking:0,1 ".
$readingFnAttributes; $readingFnAttributes;
} }
@ -90,6 +90,7 @@ BEGIN {
attr attr
TimeNow TimeNow
HttpUtils_NonblockingGet HttpUtils_NonblockingGet
GetFileFromURLQuiet
SetExtensions SetExtensions
AttrTemplate_Set AttrTemplate_Set
urlEncode urlEncode
@ -483,8 +484,9 @@ sub ExecuteSnapshotRequest {
my ($hash, $callbackCommand) = @_; my ($hash, $callbackCommand) = @_;
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $blocking = AttrVal($name, 'blocking', 0);
my $camUrl = createSnapshotUrl($hash); my $camUrl = createSnapshotUrl($hash);
Log3 $name, 3, "IPCAM ($name) - ExecuteSnapshotRequest camUrl: $camUrl"; Log3 $name, 3, "IPCAM ($name) - ExecuteSnapshotRequest blocking: $blocking, camUrl: $camUrl";
my $apiParam = { my $apiParam = {
url => $camUrl, url => $camUrl,
@ -496,12 +498,11 @@ sub ExecuteSnapshotRequest {
callbackCommand => $callbackCommand callbackCommand => $callbackCommand
}; };
# trying to fix timeouts by wrapping this in internalTimer if ($blocking == 1) {
if (defined $callbackCommand) { my $camret = GetFileFromURLQuiet($camUrl);
InternalTimer(gettimeofday(), "main::HttpUtils_NonblockingGet", $apiParam); RequestSnapshot_Callback($apiParam, '', $camret);
} else { } else {
# without callback command, the internal timer has been set before already. HttpUtils_NonblockingGet($apiParam);
HttpUtils_NonblockingGet($apiParam);
} }
return undef; return undef;
@ -880,6 +881,11 @@ DetailFn {
These placeholders will be replaced with the values from the credentials file.<br> These placeholders will be replaced with the values from the credentials file.<br>
Example:<br> <code>attr ipcam3 basicauth {USERNAME}:{PASSWORD}</code> Example:<br> <code>attr ipcam3 basicauth {USERNAME}:{PASSWORD}</code>
</li> </li>
<li>
blocking<br>
If set to 1, FHEM will make a blocking call to the camera. Try this if getting snapshot runs into timeouts regularly.<br>
Per default, this is set to 0.
</li>
<li> <li>
cmd01, cmd02, cmd03, .. cmd13, cdm14, cdm15<br> cmd01, cmd02, cmd03, .. cmd13, cdm14, cdm15<br>
It is possible to define up to 15 custom commands.<br> It is possible to define up to 15 custom commands.<br>