change model and fix problems
This commit is contained in:
parent
de2ecf664f
commit
25a682224b
@ -1,4 +1,4 @@
|
|||||||
UPD 2021-11-27_21:26:06 9224 FHEM/73_NUKIBridge.pm
|
UPD 2021-11-27_21:42:00 9224 FHEM/73_NUKIBridge.pm
|
||||||
UPD 2021-11-27_21:30:28 7569 FHEM/74_NUKIDevice.pm
|
UPD 2021-11-27_21:36:27 7569 FHEM/74_NUKIDevice.pm
|
||||||
UPD 2021-11-27_21:26:06 40444 lib/FHEM/Devices/Nuki/Bridge.pm
|
UPD 2021-11-27_22:32:28 40699 lib/FHEM/Devices/Nuki/Bridge.pm
|
||||||
UPD 2021-11-27_21:32:02 15123 lib/FHEM/Devices/Nuki/Device.pm
|
UPD 2021-11-27_22:49:00 15481 lib/FHEM/Devices/Nuki/Device.pm
|
||||||
|
@ -501,7 +501,14 @@ sub GetCheckBridgeAlive {
|
|||||||
if ( !::IsDisabled($name)
|
if ( !::IsDisabled($name)
|
||||||
&& $hash->{helper}->{iowrite} == 0 )
|
&& $hash->{helper}->{iowrite} == 0 )
|
||||||
{
|
{
|
||||||
|
if ( $hash->{helper}->{runInfo} == 0 ) {
|
||||||
Write( $hash, 'info', undef );
|
Write( $hash, 'info', undef );
|
||||||
|
$hash->{helper}->{runInfo} = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write( $hash, 'list', undef );
|
||||||
|
$hash->{helper}->{runInfo} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
::Log3( $name, 4, "NUKIBridge ($name) - run Write" );
|
::Log3( $name, 4, "NUKIBridge ($name) - run Write" );
|
||||||
}
|
}
|
||||||
@ -521,6 +528,7 @@ sub FirstRun {
|
|||||||
Write( $hash, 'list', undef )
|
Write( $hash, 'list', undef )
|
||||||
if ( !::IsDisabled($name) );
|
if ( !::IsDisabled($name) );
|
||||||
|
|
||||||
|
$hash->{helper}->{runInfo} = 0;
|
||||||
return ::InternalTimer( ::gettimeofday() + 5,
|
return ::InternalTimer( ::gettimeofday() + 5,
|
||||||
\&FHEM::Devices::Nuki::Bridge::GetCheckBridgeAlive, $hash );
|
\&FHEM::Devices::Nuki::Bridge::GetCheckBridgeAlive, $hash );
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,9 @@ my %deviceTypes = (
|
|||||||
4 => 'smartlock3'
|
4 => 'smartlock3'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my %deviceTypeIds = reverse(%deviceTypes);
|
||||||
|
|
||||||
|
|
||||||
my %modes = (
|
my %modes = (
|
||||||
2 => {
|
2 => {
|
||||||
0 => 'door mode',
|
0 => 'door mode',
|
||||||
@ -180,7 +183,14 @@ my %lockStates = (
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
my %deviceTypeIds = reverse(%deviceTypes);
|
my %doorsensorStates = (
|
||||||
|
1 => 'deactivated',
|
||||||
|
2 => 'door closed',
|
||||||
|
3 => 'door opened',
|
||||||
|
4 => 'door state unknown',
|
||||||
|
5 => 'calibrating'
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
sub Define {
|
sub Define {
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
@ -205,6 +215,7 @@ sub Define {
|
|||||||
$hash->{STATE} = 'Initialized';
|
$hash->{STATE} = 'Initialized';
|
||||||
$hash->{NOTIFYDEV} = 'global,autocreate,' . $name;
|
$hash->{NOTIFYDEV} = 'global,autocreate,' . $name;
|
||||||
|
|
||||||
|
|
||||||
my $iodev = ::AttrVal( $name, 'IODev', 'none' );
|
my $iodev = ::AttrVal( $name, 'IODev', 'none' );
|
||||||
|
|
||||||
::AssignIoPort( $hash, $iodev ) if ( !$hash->{IODev} );
|
::AssignIoPort( $hash, $iodev ) if ( !$hash->{IODev} );
|
||||||
@ -541,7 +552,9 @@ sub WriteReadings {
|
|||||||
&& $t ne 'deviceType'
|
&& $t ne 'deviceType'
|
||||||
&& $t ne 'paired'
|
&& $t ne 'paired'
|
||||||
&& $t ne 'batteryCritical'
|
&& $t ne 'batteryCritical'
|
||||||
&& $t ne 'timestamp' );
|
&& $t ne 'timestamp'
|
||||||
|
&& $t ne 'doorsensorState'
|
||||||
|
&& $t ne 'doorsensorStateName' );
|
||||||
|
|
||||||
::readingsBulkUpdate( $hash, $t,
|
::readingsBulkUpdate( $hash, $t,
|
||||||
( $v =~ m/^[0-9]$/ ? $lockStates{$v}{ $hash->{DEVICETYPEID} } : $v ) )
|
( $v =~ m/^[0-9]$/ ? $lockStates{$v}{ $hash->{DEVICETYPEID} } : $v ) )
|
||||||
@ -553,6 +566,9 @@ sub WriteReadings {
|
|||||||
::readingsBulkUpdate( $hash, $t, $deviceTypes{$v} )
|
::readingsBulkUpdate( $hash, $t, $deviceTypes{$v} )
|
||||||
if ( $t eq 'deviceType' );
|
if ( $t eq 'deviceType' );
|
||||||
|
|
||||||
|
::readingsBulkUpdate( $hash, $t, $doorsensorStates{$v} )
|
||||||
|
if ( $t eq 'doorsensorState' );
|
||||||
|
|
||||||
::readingsBulkUpdate( $hash, $t, ( $v == 1 ? 'true' : 'false' ) )
|
::readingsBulkUpdate( $hash, $t, ( $v == 1 ? 'true' : 'false' ) )
|
||||||
if ( $t eq 'paired' );
|
if ( $t eq 'paired' );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user