diff --git a/fhem/CHANGED b/fhem/CHANGED index 391fc93ef..ea85f3ba9 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # 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. + - change: 88_HMCCU: Bug fixes and improvements - change: 93_DbRep: enable setter 'index' for device model 'Agent' - bugfix: 70_Klafs: Transferred to namespace of FHEM. One bug fixed. If necessary, set password again. diff --git a/fhem/FHEM/88_HMCCU.pm b/fhem/FHEM/88_HMCCU.pm index 49feec026..291258d97 100755 --- a/fhem/FHEM/88_HMCCU.pm +++ b/fhem/FHEM/88_HMCCU.pm @@ -57,7 +57,7 @@ my %HMCCU_CUST_CHN_DEFAULTS; my %HMCCU_CUST_DEV_DEFAULTS; # HMCCU version -my $HMCCU_VERSION = '5.0 220431743'; +my $HMCCU_VERSION = '5.0 222611615'; # Timeout for CCU requests (seconds) my $HMCCU_TIMEOUT_REQUEST = 4; @@ -8362,133 +8362,6 @@ sub HMCCU_DetectSCAttr ($$$$$) return ($sc, $sd, $cc, $cd, $rsdCnt, $rcdCnt); } -sub HMCCU_DetectSCChn ($;$$) -{ - my ($clHash, $sd, $cd) = @_; - $sd //= ''; - $cd //= ''; - - my $role = HMCCU_GetChannelRole ($clHash); - HMCCU_Trace ($clHash, 2, "role=$role"); - - if ($role ne '' && exists($HMCCU_STATECONTROL->{$role}) && $HMCCU_STATECONTROL->{$role}{F} & 1) { - my $nsd = HMCCU_DetectSCDatapoint ($HMCCU_STATECONTROL->{$role}{S}, $clHash->{ccuif}); - my $ncd = HMCCU_DetectSCDatapoint ($HMCCU_STATECONTROL->{$role}{C}, $clHash->{ccuif}); - HMCCU_Log ($clHash, 2, "statedatapoint of role and attribute do not match") - if ($nsd ne '' && $sd ne '' && $nsd ne $sd); - HMCCU_Log ($clHash, 2, "controldatapoint of role and attribute do not match") - if ($ncd ne '' && $cd ne '' && $ncd ne $cd); - - $sd = $nsd if ($nsd ne '' && $sd eq ''); - $cd = $ncd if ($ncd ne '' && $cd eq ''); - $clHash->{ccurolestate} = $role if ($nsd ne ''); - $clHash->{ccurolectrl} = $role if ($ncd ne ''); - } - - return ($sd, $cd, $sd ne '' ? 1 : 0, $cd ne '' ? 1 : 0); -} - -sub HMCCU_DetectSCDev ($;$$$$) -{ - my ($clHash, $sc, $sd, $cc, $cd) = @_; - $sc //= ''; - $sd //= ''; - $cc //= ''; - $cd //= ''; - - # Count matching roles to prevent ambiguous definitions - my ($rsc, $rsd, $rcc, $rcd) = ('', '', '', ''); - # Priorities - my ($ccp, $scp) = (0, 0); - # Number of matching roles - my $rsdCnt = $sc ne '' && $sd ne '' ? 1 : 0; - my $rcdCnt = $cc ne '' && $cd ne '' ? 1 : 0; - - my $defRole = $HMCCU_DEF_ROLE->{$clHash->{ccusubtype}}; - my $resRole; - - foreach my $roleDef (split(',', $clHash->{hmccu}{role})) { - my ($rc, $role) = split(':', $roleDef); - - next if (!defined($role) || (defined($defRole) && $role ne $defRole)); - - if (defined($role) && exists($HMCCU_STATECONTROL->{$role}) && $HMCCU_STATECONTROL->{$role}{F} & 2) { - my $nsd = HMCCU_DetectSCDatapoint ($HMCCU_STATECONTROL->{$role}{S}, $clHash->{ccuif}); - if ($sd eq '' && $nsd ne '') { - # If state datapoint is defined for this role - if ($sc ne '' && $rc eq $sc) { - # If channel of current role matches state channel, use datapoint specified - # in $HMCCU_STATECONTROL as state datapoint - $rsc = $sc; - $rsd = $nsd; - $clHash->{ccurolestate} = $role; - $rsdCnt = 1; - } - else { - # If state channel is not defined or role channel doesn't match state channel, - # assign state channel and datapoint considering role priority - if ($HMCCU_STATECONTROL->{$role}{P} > $scp) { - # Priority of this role is higher than the previous priority - $scp = $HMCCU_STATECONTROL->{$role}{P}; - $rsc = $rc; - $rsd = $nsd; - $rsdCnt = 1; - $clHash->{ccurolestate} = $role; - } - elsif ($HMCCU_STATECONTROL->{$role}{P} == $scp) { - # Priority of this role is equal to previous priority. We found more - # than 1 matching roles. We use the first matching role/channel, but count - # the number of matching roles. - if ($rsc eq '') { - $rsc = $rc; - $rsd = $nsd; - $clHash->{ccurolestate} = $role; - } - $rsdCnt++; - } - } - } - if ($cd eq '' && $HMCCU_STATECONTROL->{$role}{C} ne '') { - my $ncd = HMCCU_DetectSCDatapoint ($HMCCU_STATECONTROL->{$role}{C}, $clHash->{ccuif}); - if ($cc ne '' && $rc eq $cc) { - $rcc = $cc; - $rcd = $ncd; - $clHash->{ccurolectrl} = $role; - $rcdCnt = 1; - } - else { - # If control channel is not defined or role channel doesn't match control channel, - # assign control channel and datapoint considering role priority - if ($HMCCU_STATECONTROL->{$role}{P} > $scp) { - # Priority of this role is higher than the previous priority - $scp = $HMCCU_STATECONTROL->{$role}{P}; - $rcc = $rc; - $rcd = $ncd; - $rcdCnt = 1; - $clHash->{ccurolectrl} = $role; - } - elsif ($HMCCU_STATECONTROL->{$role}{P} == $scp) { - # Priority of this role is equal to previous priority. We found more - # than 1 matching roles. We use the first matching role/channel, but count - # the number of matching roles. - if ($rcc eq '') { - $rcc = $rc; - $rcd = $ncd; - $clHash->{ccurolectrl} = $role; - } - $rcdCnt++; - } - } - } - } - } - - ($sc, $sd) = ($rsc, $rsd) if ($rsdCnt > 0 && $sd eq ''); - ($cc, $cd) = ($rcc, $rcd) if ($rcdCnt > 0 && $cd eq ''); - - return ($sc, $sd, $cc, $cd, $rsdCnt, $rcdCnt); -} - ###################################################################### # Detect roles, channel and datapoint to be used for controlling and # displaying the state of a device or channel identified by its @@ -9442,7 +9315,8 @@ sub HMCCU_ScaleValue ($$$$$;$) my $name = $hash->{NAME}; my $ioHash = HMCCU_GetHash ($hash); - my $boundsChecking = HMCCU_IsFlag ($name, 'noBoundsChecking') ? 0 : 1; +# my $boundsChecking = HMCCU_IsFlag ($name, 'noBoundsChecking') ? 0 : 1; + my $boundsChecking = $dpt =~ /^LEVEL/ && ($value == -0.005 || $value == 1.005 || $value == 1.01) ? 0 : 1; # Get parameter definition and min/max values my $min; @@ -9542,8 +9416,8 @@ sub HMCCU_ScaleValue ($$$$$;$) elsif (defined($unit) && ($unit eq 'minutes' || $unit eq 's')) { $value = HMCCU_ConvertTime ($value, $unit, $mode); } - elsif (defined($unit) && $unit =~ /^([0-9]+)%$/) { - # percentage values + elsif (defined($unit) && $unit =~ /^([0-9]+)%$/ && $boundsChecking) { + # percentage values. Values < 0 won't be scaled my $f = $1; $min //= 0; $max //= 1.0; @@ -9551,7 +9425,7 @@ sub HMCCU_ScaleValue ($$$$$;$) $value = HMCCU_MinMax ($value, $min, $max)*$f; } else { - $value = $boundsChecking ? HMCCU_MinMax($value, $min*$f, $max*$f)/$f : $value/$f; + $value = HMCCU_MinMax($value, $min*$f, $max*$f)/$f; } } diff --git a/fhem/FHEM/88_HMCCUCHN.pm b/fhem/FHEM/88_HMCCUCHN.pm index ce7e151ef..2e2443037 100644 --- a/fhem/FHEM/88_HMCCUCHN.pm +++ b/fhem/FHEM/88_HMCCUCHN.pm @@ -30,7 +30,7 @@ sub HMCCUCHN_Set ($@); sub HMCCUCHN_Get ($@); sub HMCCUCHN_Attr ($@); -my $HMCCUCHN_VERSION = '5.0 220431743'; +my $HMCCUCHN_VERSION = '5.0 222611615'; ###################################################################### # Initialize module diff --git a/fhem/FHEM/88_HMCCUDEV.pm b/fhem/FHEM/88_HMCCUDEV.pm index f7414bfec..f55022138 100644 --- a/fhem/FHEM/88_HMCCUDEV.pm +++ b/fhem/FHEM/88_HMCCUDEV.pm @@ -31,7 +31,7 @@ sub HMCCUDEV_Set ($@); sub HMCCUDEV_Get ($@); sub HMCCUDEV_Attr ($@); -my $HMCCUDEV_VERSION = '5.0 220431743'; +my $HMCCUDEV_VERSION = '5.0 222611615'; ###################################################################### # Initialize module diff --git a/fhem/FHEM/88_HMCCURPCPROC.pm b/fhem/FHEM/88_HMCCURPCPROC.pm index 56dc9dabd..cb1205180 100755 --- a/fhem/FHEM/88_HMCCURPCPROC.pm +++ b/fhem/FHEM/88_HMCCURPCPROC.pm @@ -39,7 +39,7 @@ use SetExtensions; ###################################################################### # HMCCURPC version -my $HMCCURPCPROC_VERSION = '5.0 220431743'; +my $HMCCURPCPROC_VERSION = '5.0 222611615'; # Maximum number of events processed per call of Read() my $HMCCURPCPROC_MAX_EVENTS = 100; diff --git a/fhem/FHEM/HMCCUConf.pm b/fhem/FHEM/HMCCUConf.pm index 89ff051d6..e9d73583b 100644 --- a/fhem/FHEM/HMCCUConf.pm +++ b/fhem/FHEM/HMCCUConf.pm @@ -368,6 +368,7 @@ $HMCCU_CONFIG_VERSION = '5.0'; 'close' => 'V:LEVEL:0', 'up' => 'V:LEVEL:?delta=+20', 'down' => 'V:LEVEL:?delta=-20', + 'oldPos' => 'V:LEVEL:1.005', 'stop' => 'V:STOP:1' }, 'BLIND_VIRTUAL_RECEIVER' => { @@ -534,7 +535,7 @@ $HMCCU_CONFIG_VERSION = '5.0'; 'WINMATIC' => { 'open' => 'V:LEVEL:100', 'close' => 'V:LEVEL:0', - 'lock' => 'V:LEVEL:-0.5', + 'lock' => 'V:LEVEL:-0.005', 'pct' => 'V:LEVEL:?level', 'stop' => 'V:STOP:1' } @@ -613,6 +614,12 @@ $HMCCU_CONFIG_VERSION = '5.0'; 'RAINDETECTOR_HEAT' => { 'cmdIcon' => 'on:general_an off:general_aus' }, + 'SHUTTER_CONTACT' => { + 'devStateIcon' => 'close:fts_window_1w open:fts_window_1w_open' + }, + 'SHUTTER_CONTACT_TRANSCEIVER' => { + 'devStateIcon' => 'close:fts_window_1w open:fts_window_1w_open' + }, 'SHUTTER_TRANSMITTER' => { 'substexcl' => 'pct', }, @@ -710,16 +717,16 @@ $HMCCU_CONFIG_VERSION = '5.0'; 'STATE' => { '0' => 'off', 'false' => 'off', '1' => 'on', 'true' => 'on' } }, 'SHUTTER_CONTACT' => { - 'STATE' => { '0' => 'closed', '1' => 'open', 'false' => 'closed', 'true' => 'open' } + 'STATE' => { '0' => 'close', '1' => 'open', 'false' => 'close', 'true' => 'open' } }, 'SHUTTER_CONTACT_TRANSCEIVER' => { - 'STATE' => { '0' => 'closed', '1' => 'open', 'false' => 'closed', 'true' => 'open' } + 'STATE' => { '0' => 'close', '1' => 'open', 'false' => 'close', 'true' => 'open' } }, 'ROTARY_HANDLE_SENSOR' => { - 'STATE' => { '0' => 'closed', '1' => 'tilted', '2' => 'open' } + 'STATE' => { '0' => 'close', '1' => 'tilted', '2' => 'open' } }, 'ROTARY_HANDLE_TRANSCEIVER' => { - 'STATE' => { '0' => 'closed', '1' => 'tilted', '2' => 'open' } + 'STATE' => { '0' => 'close', '1' => 'tilted', '2' => 'open' } }, 'ALARM_SWITCH_VIRTUAL_RECEIVER' => { 'STATE' => { '0' => 'ok', '1' => 'alarm', 'false' => 'ok', 'true' => 'alarm' } @@ -740,29 +747,29 @@ $HMCCU_CONFIG_VERSION = '5.0'; 'STATE' => { '0' => 'off', 'false' => 'off', '1' => 'on', 'true' => 'on', 'off' => '0', 'on' => '1' }, }, 'BLIND' => { - 'LEVEL' => { '0' => 'closed', '100' => 'open', 'close' => '0', 'open' => '100' }, + 'LEVEL' => { '0' => 'close', '100' => 'open', 'close' => '0', 'open' => '100' }, 'DIRECTION' => { '0' => 'none', '1' => 'up', '2' => 'down' }, 'WORKING' => { '0' => 'no', 'false' => 'no', '1' => 'yes', 'true' => 'yes' } }, 'BLIND_TRANSMITTER' => { - 'LEVEL' => { '0' => 'closed', '100' => 'open', 'close' => '0', 'open' => '100' } + 'LEVEL' => { '0' => 'close', '100' => 'open', 'close' => '0', 'open' => '100' } }, 'BLIND_VIRTUAL_RECEIVER' => { - 'LEVEL' => { '0' => 'closed', '100' => 'open', 'close' => '0', 'open' => '100' }, + 'LEVEL' => { '0' => 'close', '100' => 'open', 'close' => '0', 'open' => '100' }, 'DIRECTION' => { '0' => 'none', '1' => 'up', '2' => 'down' }, 'WORKING' => { '0' => 'no', 'false' => 'no', '1' => 'yes', 'true' => 'yes' } }, 'JALOUSIE' => { - 'LEVEL' => { '0' => 'closed', '100' => 'open', 'close' => '0', 'open' => '100' }, - 'LEVEL_SLATS' => { '0' => 'closed', '100' => 'open', 'close' => '0', 'open' => '100' }, + 'LEVEL' => { '0' => 'close', '100' => 'open', 'close' => '0', 'open' => '100' }, + 'LEVEL_SLATS' => { '0' => 'close', '100' => 'open', 'close' => '0', 'open' => '100' }, 'DIRECTION' => { '0' => 'none', '1' => 'up', '2' => 'down' }, 'WORKING' => { '0' => 'no', 'false' => 'no', '1' => 'yes', 'true' => 'yes' } }, 'SHUTTER_TRANSMITTER' => { - 'LEVEL' => { '0' => 'closed', '100' => 'open', 'close' => '0', 'open' => '100' } + 'LEVEL' => { '0' => 'close', '100' => 'open', 'close' => '0', 'open' => '100' } }, 'SHUTTER_VIRTUAL_RECEIVER' => { - 'LEVEL' => { '0' => 'closed', '100' => 'open', 'close' => '0', 'open' => '100' } + 'LEVEL' => { '0' => 'close', '100' => 'open', 'close' => '0', 'open' => '100' } }, 'DIMMER' => { 'LEVEL' => { '0' => 'off', '100' => 'on', 'off' => '0', 'on' => '100' }, @@ -781,7 +788,7 @@ $HMCCU_CONFIG_VERSION = '5.0'; }, 'THERMALCONTROL_TRANSMIT' => { 'SET_TEMPERATURE' => { '4.5' => 'off', '30.5' => 'on' }, - 'WINDOW_OPEN_REPORTING' => { '0' => 'closed', '1' => 'open', 'false' => 'closed', 'true' => 'open' } + 'WINDOW_OPEN_REPORTING' => { '0' => 'close', '1' => 'open', 'false' => 'close', 'true' => 'open' } }, 'CLIMATECONTROL_RT_TRANSCEIVER' => { 'SET_TEMPERATURE' => { '4.5' => 'off', '30.5' => 'on' } @@ -789,7 +796,7 @@ $HMCCU_CONFIG_VERSION = '5.0'; 'HEATING_CLIMATECONTROL_TRANSCEIVER' => { 'SET_POINT_TEMPERATURE' => { '4.5' => 'off', '30.5' => 'on' }, 'SET_POINT_MODE' => { '0' => 'auto', '1' => 'manual', '2' => 'boost', '3' => 'off' }, - 'WINDOW_STATE' => { '0' => 'closed', '1' => 'open', 'false' => 'closed', 'true' => 'open' } + 'WINDOW_STATE' => { '0' => 'close', '1' => 'open', 'false' => 'close', 'true' => 'open' } }, 'CLIMATECONTROL_REGULATOR' => { 'SETPOINT' => { '4.5' => 'off', '30.5' => 'on' } @@ -798,7 +805,7 @@ $HMCCU_CONFIG_VERSION = '5.0'; 'ALARMSTATE' => { '0' => 'noAlarm', '1' => 'alarm', 'false' => 'noAlarm', 'true' => 'alarm' } }, 'WINMATIC' => { - 'LEVEL' => { '0' => 'closed', '100' => 'open', '-0.5' => 'locked' } + 'LEVEL' => { '0' => 'close', '100' => 'open', '-0.005' => 'locked' } }, 'DEFAULT' => { 'AES_KEY' => { '0' => 'off', 'false' => 'off', '1' => 'on', 'true' => 'on' },