Hallo zusammen,
immer wieder kommt es vor, dass ein MAX_TH_ aussteigt.
seien es die beliebten F4-Fehler (ich helfe mir mit selbstgebastelter Hülse), leere Batterien, oder ein abgreissenes Gerät, das Resultat ist eine instabile MAX-infrastruktur auf Grund verbratener credits.
Leider half hier ein "disable" des betroffenen MAX-Gerätes bisher nicht. Der MAX-Scanner versuchte es munter weiter und es blieben keine Credits für "wichtige" Einstellungen.
Ich habe den scanner etwas angepasst, so dass er bei Gerätestatus "disable=1" das Gerät überspringt.
Direkt im Modul rumzuschreiben ist sicher nicht die beste Idee. Wie kann ich solche Teile auslagern, oder dem Maintainer als Vorschlag zum Einchecken senden?
##########################
# handling of notifies
sub MaxScanner_Notify($$$)
{
my ( $hash, $dev ) = @_;
my $name = $hash->{NAME};
my $devName = $dev->{NAME};
my $devdisable = AttrVal( $devName, 'disable', '0' );
my $scannerdisabled = AttrVal( $name, 'disable', '0' );
if ( grep( m/^(INITIALIZED)$/, @{ $dev->{CHANGED} } ) )
{
MaxScanner_Log( $hash, 4, 'INITIALIZED' );
MaxScanner_RestartTimer($hash,20);
return;
}
# no action if not initialized
return if ( !$hash->{helper}{initDone} );
# no action if scanner or device disabled
if ( $scannerdisabled eq '1' )
{
MaxScanner_Log $hash, 3, 'scanner disabled = Abort';
return;
}
if ( $devdisable eq '1' )
{
MaxScanner_Log $hash, 3, 'device disabled: '.$devName.' = abort';
return;
}
## check device association to MaxScanner
MaxScanner_Log $hash, 5, 'testing: '.$devName;
# get associated devices
my @associated = @{ $hash->{helper}{associatedDevices} };
# if not found return
if ( !grep( /^$devName/, @associated ) )
{
MaxScanner_Log $hash, 5, 'not associated: ' . $devName . ' abort';
return;
}
# get the event of the device
my $devReadings = int( @{ $dev->{CHANGED} } );
MaxScanner_Log $hash, 5, 'is associated: ' . $devName . ' check readings: ' . $devReadings;
my $found = '';
my $xevent = '';
for ( my $i = 0 ; $i < $devReadings ; $i++ )
{
# <onoff: 0> , <desiredTemperature: 12.0>
$xevent = $dev->{CHANGED}[$i];
$xevent = '' if ( !defined($xevent) );
#MaxScanner_Log $hash, 4, 'check event:<'.$xevent.'>';
if ( $xevent =~ m/^(onoff|desiredTemperature|temperature):.*/ )
{
MaxScanner_Log $hash, 4, 'matching event:<' . $xevent . '>';
$found = '1';
last;
}
}
# return if no matching with intersting properties
return if ( !$found );
# loop over all instances of scanner
foreach my $instName ( sort keys %{ $modules{$MaxScanner_ModulName}{defptr} } )
{
my $instHash = $defs{$instName};
MaxScanner_Log $instHash, 3, 'will start <' . $instName . '> triggerd by ' . $devName . ' ' . $xevent;
MaxScanner_Timer($instName);
}
}
....
ausserdem nötig:
######################################################
# loop over all thermostats and check what is to do
sub MaxScanner_Work($$$)
....
my $boolDesiChange = AttrVal( $therm, $MaxScanner_AttrProcessByDesiChange, '0' ) eq '1';
my $strModeHandling = uc AttrVal( $therm, $MaxScanner_AttrModeHandling, 'AUTO' );
my $dontChangeMe = '';
#. check device disable status
my $devdisable = AttrVal( $therm, 'disable', '' );
if ( $devdisable eq '1' )
{
MaxScanner_Log $hash, 3, 'device disabled: '.$therm.' = abort';
next;
}
....
John hat damals den Max-Scanner geschrieben - ich habe hier aber leider schon lange nichts mehr von Ihm gelesen...
Der Scanner ist auch nicht Offiziell wenn ich mich richtig erinnere. Vielleicht im Wiki dokumentieren..?