2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 14:16:42 +00:00

70_ZoneMinder:trying to fix disconnect

git-svn-id: https://svn.fhem.de/fhem/trunk@17534 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
delmar 2018-10-14 23:49:09 +00:00
parent dbf557f2cc
commit f82c6a44a1

View File

@ -91,6 +91,8 @@ sub ZoneMinder_Define {
$hash->{helper}{ZM_PASSWORD} = $a[4];
}
# Log3 $name, 3, "ZoneMinder ($name) - Define done ... module=$module, zmHost=$zmHost";
DevIo_CloseDev($hash) if (DevIo_IsOpen($hash));
DevIo_OpenDev($hash, 0, undef);
@ -116,13 +118,13 @@ sub ZoneMinder_getZmWebUrl {
#use private or public LAN for Web access?
my $publicAddress = ZoneMinder_getPublicAddress($hash);
my $zmHost = '';
# Log3 $name, 0, "ZoneMinder ($name) - publicAddress: $publicAddress, usePublic: $usePublic";
if ($publicAddress and $usePublic) {
$zmHost = $publicAddress;
} else {
$zmHost = $hash->{helper}{ZM_HOST};
$zmHost = "http://$zmHost";
}
$zmHost = "http://$zmHost";
$zmHost .= '/' if (not $zmHost =~ m/\/$/);
my $zmWebContext = $attr{$name}{webConsoleContext};
@ -634,14 +636,7 @@ sub ZoneMinder_Ready {
my $name = $hash->{NAME};
if ( $hash->{STATE} eq "disconnected" ) {
my $err = DevIo_OpenDev($hash, 1, undef ); #if success, $err is undef
if (not $err) {
Log3 $name, 3, "ZoneMinder ($name) - reconnect to ZoneMinder successful";
return 1;
} else {
Log3 $name, 0, "ZoneMinder ($name) - reconnect to ZoneMinder failed: $err";
return $err;
}
return DevIo_OpenDev($hash, 1, undef ); #if success, $err is undef
}
# This is relevant for Windows/USB only