2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-22 08:11:44 +00:00

10_MAX.pm: fix deassociate device

git-svn-id: https://svn.fhem.de/fhem/trunk@23287 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Wzut 2020-12-03 18:00:50 +00:00
parent 2f6d458604
commit 0aee167b70

View File

@ -200,12 +200,17 @@ sub MAX_Define {
$hash->{type} = $type;
$hash->{devtype} = $devtype;
$hash->{addr} = $addr;
$hash->{TimeSlot} = -1 if ($type =~ m{Thermostat}xms); # wird durch CUL_MAX neu gesetzt
$hash->{'.count'} = 0; # ToDo Kommentar
$hash->{'.sendToAddr'} = '-1'; # zu wem haben wird direkt gesendet ?
$hash->{'.sendToName'} = '';
$hash->{'.timer'} = 300 if (($type ne 'PushButton') && ($type ne 'Cube'));
$hash->{SVN} = (qw($Id$))[2];
if ($type =~ m{Thermostat}xms) {
$hash->{TimeSlot} = -1 ; # wird durch CUL_MAX neu gesetzt
$hash->{webCmd} = 'desiredTemperature'; # Hint for FHEMWEB
}
$modules{MAX}{defptr}{$addr} = $hash;
CommandAttr(undef,"$name model $type"); # Forum Stats werten nur attr model aus
@ -1853,7 +1858,7 @@ sub MAX_Parse
{
my @ar = grep {$_ ne $args[1]} @peers;
@peers = sort @ar;
readingsDelete($sname,'peers') if (!@peers); # keiner mehr da
readingsDelete($shash,'peers') if (!@peers); # keiner mehr da
}
readingsBulkUpdate($shash, 'peers', join(',',@peers)) if (@peers);
@ -1925,11 +1930,13 @@ sub MAX_Parse
my $state = ReadingsVal($shash->{NAME}, 'state', 'waiting for data');
$shash->{'.desiredTemperature'} = MAX_SerializeTemperature($shash->{'.desiredTemperature'}) if($shash->{'.desiredTemperature'});
my $c = '';
$c = '°C' if (exists($shash->{'.desiredTemperature'}) && (substr($shash->{'.desiredTemperature'},0,1) ne 'o')); # on/off
#my $c = '';
#$c = '°C' if (exists($shash->{'.desiredTemperature'}) && (substr($shash->{'.desiredTemperature'},0,1) ne 'o')); # on/off
#$c = '°C' if (defined($shash->{'.desiredTemperature'}) && substr($shash->{'.desiredTemperature'},0,1) ne 'o'); # on/off
$state = $shash->{'.desiredTemperature'}.$c if (exists($shash->{'.desiredTemperature'}));
#$state = $shash->{'.desiredTemperature'}.$c if (exists($shash->{'.desiredTemperature'}));
$state = $shash->{'.desiredTemperature'} if (exists($shash->{'.desiredTemperature'}));
$state = ($shash->{'.isopen'}) ? 'opened' : 'closed' if (exists($shash->{'.isopen'}));
if ($shash->{devtype} > 5)
@ -1941,19 +1948,19 @@ sub MAX_Parse
if (IsDummy($shash->{NAME}))
{
$state .= " (auto)" if (exists($shash->{mode}) && (int($shash->{'.mode'}) == 0));
$state .= " (manual)" if (exists($shash->{mode}) && (int($shash->{'.mode'}) == 1));
$state .= ' (auto)' if (exists($shash->{mode}) && (int($shash->{'.mode'}) == 0));
$state .= ' (manual)' if (exists($shash->{mode}) && (int($shash->{'.mode'}) == 1));
}
$state .= ' (boost)' if (exists($shash->{'.mode'}) && (int($shash->{'.mode'}) == 3));
$state .= ' (until '.$shash->{until}.')' if (exists($shash->{'.mode'}) && (int($shash->{'.mode'}) == 2) && exists($shash->{until}));
$state .= " (until shash->{'until')" if (exists($shash->{'.mode'}) && (int($shash->{'.mode'}) == 2) && exists($shash->{'until'}));
$state .= ' (battery low)' if (exists($shash->{'.battery'}) && $shash->{'.battery'});
$state .= ' (rf error)' if (exists($shash->{'.rferror'}) && $shash->{'.rferror'});
readingsBulkUpdate($shash, 'state', $state);
if (exists($shash->{'.desiredTemperature'})
&& $c # weder on noch off
&& substr($shash->{'.desiredTemperature'},0,1) ne 'o')
&& ($shash->{'.desiredTemperature'} != ReadingsNum($sname,'windowOpenTemperature',0))
&& AttrNum($sname,'windowOpenCheck',0))
{