2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 20:24:36 +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]; $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_CloseDev($hash) if (DevIo_IsOpen($hash));
DevIo_OpenDev($hash, 0, undef); DevIo_OpenDev($hash, 0, undef);
@ -116,13 +118,13 @@ sub ZoneMinder_getZmWebUrl {
#use private or public LAN for Web access? #use private or public LAN for Web access?
my $publicAddress = ZoneMinder_getPublicAddress($hash); my $publicAddress = ZoneMinder_getPublicAddress($hash);
my $zmHost = ''; my $zmHost = '';
# Log3 $name, 0, "ZoneMinder ($name) - publicAddress: $publicAddress, usePublic: $usePublic";
if ($publicAddress and $usePublic) { if ($publicAddress and $usePublic) {
$zmHost = $publicAddress; $zmHost = $publicAddress;
} else { } else {
$zmHost = $hash->{helper}{ZM_HOST}; $zmHost = $hash->{helper}{ZM_HOST};
$zmHost = "http://$zmHost";
} }
$zmHost = "http://$zmHost";
$zmHost .= '/' if (not $zmHost =~ m/\/$/); $zmHost .= '/' if (not $zmHost =~ m/\/$/);
my $zmWebContext = $attr{$name}{webConsoleContext}; my $zmWebContext = $attr{$name}{webConsoleContext};
@ -634,14 +636,7 @@ sub ZoneMinder_Ready {
my $name = $hash->{NAME}; my $name = $hash->{NAME};
if ( $hash->{STATE} eq "disconnected" ) { if ( $hash->{STATE} eq "disconnected" ) {
my $err = DevIo_OpenDev($hash, 1, undef ); #if success, $err is undef return 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;
}
} }
# This is relevant for Windows/USB only # This is relevant for Windows/USB only