mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
70_ZoneMinder: Trigger-Port state fixed
git-svn-id: https://svn.fhem.de/fhem/trunk@24925 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d906647fa3
commit
a03762bbfe
@ -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.
|
||||||
|
- bugfix: 70_ZoneMinder: Trigger-Port state fixed
|
||||||
- feature: 49_IPCAM: introduced attribute 'blocking'
|
- 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
|
||||||
|
@ -93,10 +93,9 @@ sub ZoneMinder_Define {
|
|||||||
# Log3 $name, 3, "ZoneMinder ($name) - Define done ... module=$module, zmHost=$zmHost";
|
# 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, 'ZoneMinder_Trigger_init', 'ZoneMinder_Trigger_callback');
|
||||||
|
|
||||||
my $triggerPortState = $hash->{STATE};
|
my $triggerPortState = $hash->{STATE};
|
||||||
ZoneMinder_updateState( $hash, $triggerPortState, 'n/a' );
|
|
||||||
|
|
||||||
if (!$init_done) {
|
if (!$init_done) {
|
||||||
InternalTimer(gettimeofday()+5, "ZoneMinder_afterInitialized", $hash, 0);
|
InternalTimer(gettimeofday()+5, "ZoneMinder_afterInitialized", $hash, 0);
|
||||||
@ -108,6 +107,28 @@ sub ZoneMinder_Define {
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub ZoneMinder_Trigger_init {
|
||||||
|
my ( $hash ) = @_;
|
||||||
|
|
||||||
|
ZoneMinder_updateState( $hash, 'opened', undef );
|
||||||
|
|
||||||
|
return 0; #0 means successful connection
|
||||||
|
}
|
||||||
|
|
||||||
|
sub ZoneMinder_Trigger_callback {
|
||||||
|
my ( $hash, $error ) = @_;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
if ( defined ($error) ) {
|
||||||
|
Log3 $name, 0, "ZoneMinder ($name) - Error while connecting to trigger port: $error";
|
||||||
|
ZoneMinder_updateState( $hash, 'error', undef );
|
||||||
|
} else {
|
||||||
|
Log3 $name, 3, "ZoneMinder ($name) - Trigger port connected";
|
||||||
|
ZoneMinder_updateState( $hash, 'opened', undef );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
sub ZoneMinder_updateState {
|
sub ZoneMinder_updateState {
|
||||||
my ( $hash, $triggerPortState, $apiState ) = @_;
|
my ( $hash, $triggerPortState, $apiState ) = @_;
|
||||||
|
|
||||||
@ -817,7 +838,7 @@ sub ZoneMinder_Ready {
|
|||||||
|
|
||||||
ZoneMinder_updateState( $hash, 'disappeared', undef );
|
ZoneMinder_updateState( $hash, 'disappeared', undef );
|
||||||
|
|
||||||
return DevIo_OpenDev($hash, 1, undef ); #if success, $err is undef
|
return DevIo_OpenDev($hash, 1, 'ZoneMinder_Trigger_init', 'ZoneMinder_Trigger_callback' ); #if success, $err is undef
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user