2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

HMCCU: Fixed ePaper and BSL bugs

git-svn-id: https://svn.fhem.de/fhem/trunk@25221 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2021-11-13 17:37:14 +00:00
parent 020610da0a
commit c7dc91a99e
5 changed files with 52 additions and 27 deletions

View File

@ -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: 88_HMCCU: Fixed ePaper and BSL bugs
- bugfix: 88_HMCCU: Fixed some bugs - bugfix: 88_HMCCU: Fixed some bugs
- bugfix: 73_km200: Allowing port behind IP address - bugfix: 73_km200: Allowing port behind IP address
- feature: 6.1 released - feature: 6.1 released

View File

@ -57,7 +57,7 @@ my %HMCCU_CUST_CHN_DEFAULTS;
my %HMCCU_CUST_DEV_DEFAULTS; my %HMCCU_CUST_DEV_DEFAULTS;
# HMCCU version # HMCCU version
my $HMCCU_VERSION = '5.0 213141800'; my $HMCCU_VERSION = '5.0 213171649';
# Timeout for CCU requests (seconds) # Timeout for CCU requests (seconds)
my $HMCCU_TIMEOUT_REQUEST = 4; my $HMCCU_TIMEOUT_REQUEST = 4;
@ -194,7 +194,7 @@ sub HMCCU_SubstVariables ($$$);
# Update client device readings # Update client device readings
sub HMCCU_BulkUpdate ($$$;$); sub HMCCU_BulkUpdate ($$$;$);
sub HMCCU_GetUpdate ($$;$$); sub HMCCU_GetUpdate ($$;$$);
sub HMCCU_RefreshReadings ($); sub HMCCU_RefreshReadings ($;$);
sub HMCCU_UpdateCB ($$$); sub HMCCU_UpdateCB ($$$);
sub HMCCU_UpdateClients ($$$$;$$); sub HMCCU_UpdateClients ($$$$;$$);
sub HMCCU_UpdateInternalValues ($$$$$); sub HMCCU_UpdateInternalValues ($$$$$);
@ -4686,12 +4686,17 @@ sub HMCCU_UpdateParamsetReadings ($$$;$)
# Refresh readings of a client device # Refresh readings of a client device
###################################################################### ######################################################################
sub HMCCU_RefreshReadings ($) sub HMCCU_RefreshReadings ($;$)
{ {
my ($clHash) = @_; my ($clHash, $attribute) = @_;
my $ioHash = HMCCU_GetHash ($clHash) // return;
my $ioHash = HMCCU_GetHash ($clHash) // return;
my $refreshAttrList = 'ccucalculate|ccuflags|ccureadingfilter|ccureadingformat|'.
'ccureadingname|ccuReadingPrefix|ccuscaleval|controldatapoint|hmstatevals|'.
'statedatapoint|statevals|substitute|substexcl|stripnumber';
return if (defined($attribute) && $attribute !~ /^($refreshAttrList)$/i);
HMCCU_DeleteReadings ($clHash, '.*'); HMCCU_DeleteReadings ($clHash, '.*');
my %objects; my %objects;
@ -6870,7 +6875,8 @@ sub HMCCU_UpdateRoleCommands ($$;$)
next URCROL if (!defined($role) || !exists($HMCCU_ROLECMDS->{$role})); next URCROL if (!defined($role) || !exists($HMCCU_ROLECMDS->{$role}));
URCCMD: foreach my $cmdKey (keys %{$HMCCU_ROLECMDS->{$role}}) { URCCMD: foreach my $cmdKey (keys %{$HMCCU_ROLECMDS->{$role}}) {
next URCCMD if ($clHash->{TYPE} eq 'HMCCUCHN' && $chnNo ne '' && $chnNo != $channel && $chnNo ne 'd'); # next URCCMD if ($clHash->{TYPE} eq 'HMCCUCHN' && $chnNo ne '' && $chnNo != $channel && $chnNo ne 'd');
next URCCMD if ($chnNo ne '' && $chnNo != $channel && $chnNo ne 'd');
my ($cmd, $cmdIf) = split (':', $cmdKey); my ($cmd, $cmdIf) = split (':', $cmdKey);
next URCCMD if (defined($cmdIf) && $clHash->{ccuif} !~ /$cmdIf/); next URCCMD if (defined($cmdIf) && $clHash->{ccuif} !~ /$cmdIf/);
my $cmdSyntax = $HMCCU_ROLECMDS->{$role}{$cmdKey}; my $cmdSyntax = $HMCCU_ROLECMDS->{$role}{$cmdKey};
@ -8479,9 +8485,27 @@ sub HMCCU_DetectDevice ($$$)
} }
} }
$di{defSDP} = $di{defSCh}.'.'.$di{stateRole}{$di{defSCh}}{datapoint} if ($di{defSCh} != -1); if ($di{defSCh} != -1) {
$di{defCDP} = $di{defCCh}.'.'.$di{controlRole}{$di{defCCh}}{datapoint} if ($di{defCCh} != -1); my $dpn = $di{stateRole}{$di{defSCh}}{datapoint} // '';
my $dpr = $di{stateRole}{$di{defSCh}}{role} // '';
if ($dpn eq '') {
HMCCU_Log ($ioHash, 2, "State datapoint not defined for channel $di{defSCh}, role $dpr");
}
else {
$di{defSDP} = $di{defSCh}.'.'.$dpn;
}
}
if ($di{defCCh} != -1) {
my $dpn = $di{controlRole}{$di{defCCh}}{datapoint} // '';
my $dpr = $di{controlRole}{$di{defCCh}}{role} // '';
if ($dpn eq '') {
HMCCU_Log ($ioHash, 2, "Control datapoint not defined for channel $di{defCCh}, role $dpr");
}
else {
$di{defCDP} = $di{defCCh}.'.'.$dpn;
}
}
return \%di; return \%di;
} }
@ -10112,9 +10136,9 @@ sub HMCCU_EncodeEPDisplay ($)
my @text = ('', '', ''); my @text = ('', '', '');
my @icon = ('', '', ''); my @icon = ('', '', '');
foreach my $tok (split (',', $msg)) { foreach my $tok (split (',', $msg)) {
my ($par, $val) = split (':', $tok); my ($par, $val) = split (':', $tok, 2);
next if (!defined($val)); next if (!defined($val));
if ($par =~ /^text([1-3])$/) { $text[$1-1] = substr ($val, 0, 12); } if ($par =~ /^text([1-3])$/) { $text[$1-1] = substr($val, 0, 12); }
elsif ($par =~ /^icon([1-3])$/) { $icon[$1-1] = $val; } elsif ($par =~ /^icon([1-3])$/) { $icon[$1-1] = $val; }
elsif ($par =~ /^(sound|pause|repeat|signal)$/) { $conf{$1} = $val; } elsif ($par =~ /^(sound|pause|repeat|signal)$/) { $conf{$1} = $val; }
} }

View File

@ -30,7 +30,7 @@ sub HMCCUCHN_Set ($@);
sub HMCCUCHN_Get ($@); sub HMCCUCHN_Get ($@);
sub HMCCUCHN_Attr ($@); sub HMCCUCHN_Attr ($@);
my $HMCCUCHN_VERSION = '5.0 213141800'; my $HMCCUCHN_VERSION = '5.0 213171649';
###################################################################### ######################################################################
# Initialize module # Initialize module
@ -184,7 +184,6 @@ sub HMCCUCHN_InitDevice ($$)
my $rc = 0; my $rc = 0;
if ($init_done) { if ($init_done) {
HMCCU_Log ($devHash, 2, "InitDevice called when init done");
my $detect = HMCCU_DetectDevice ($ioHash, $da, $di); my $detect = HMCCU_DetectDevice ($ioHash, $da, $di);
# Interactive device definition # Interactive device definition
@ -757,7 +756,9 @@ sub HMCCUCHN_Get ($@)
channel-name.datapoint. If set to 'datapoint' format is channel-number.datapoint. channel-name.datapoint. If set to 'datapoint' format is channel-number.datapoint.
For HMCCUCHN devices the channel part is ignored. With suffix 'lc' reading names are converted For HMCCUCHN devices the channel part is ignored. With suffix 'lc' reading names are converted
to lowercase. The reading format can also contain format specifiers %a (address), to lowercase. The reading format can also contain format specifiers %a (address),
%n (name) and %c (channel). Use %A, %N, %C for conversion to upper case.<br/><br/> %n (name) and %c (channel). Use %A, %N, %C for conversion to upper case. The readings will
be refreshed automatically if this attribute is changed. The default value for this
attribute can be defined by setting attribute ccudef-readingformat in the I/O device.<br/><br/>
Example:<br/> Example:<br/>
<code> <code>
attr mydev ccureadingformat HM_%c_%N attr mydev ccureadingformat HM_%c_%N

View File

@ -31,7 +31,7 @@ sub HMCCUDEV_Set ($@);
sub HMCCUDEV_Get ($@); sub HMCCUDEV_Get ($@);
sub HMCCUDEV_Attr ($@); sub HMCCUDEV_Attr ($@);
my $HMCCUDEV_VERSION = '5.0 213141800'; my $HMCCUDEV_VERSION = '5.0 213171649';
###################################################################### ######################################################################
# Initialize module # Initialize module
@ -209,7 +209,6 @@ sub HMCCUDEV_InitDevice ($$)
my $rc = 0; my $rc = 0;
if ($init_done) { if ($init_done) {
HMCCU_Log ($devHash, 2, "InitDevice called when init done");
my $detect = HMCCU_DetectDevice ($ioHash, $da, $di); my $detect = HMCCU_DetectDevice ($ioHash, $da, $di);
return "Specify option 'forceDev' for HMCCUDEV or use HMCCUCHN instead (recommended). Command: define $name HMCCUCHN $detect->{defAdd}" return "Specify option 'forceDev' for HMCCUDEV or use HMCCUCHN instead (recommended). Command: define $name HMCCUCHN $detect->{defAdd}"
if (defined($detect) && $detect->{defMod} eq 'HMCCUCHN' && $devHash->{hmccu}{forcedev} == 0); if (defined($detect) && $detect->{defMod} eq 'HMCCUCHN' && $devHash->{hmccu}{forcedev} == 0);
@ -699,17 +698,18 @@ sub HMCCUDEV_Get ($@)
</li><br/> </li><br/>
<li><b>ePaper Display</b><br/><br/> <li><b>ePaper Display</b><br/><br/>
This display has 5 text lines. The lines 1,2 and 4,5 are accessible via config parameters This display has 5 text lines. The lines 1,2 and 4,5 are accessible via config parameters
TEXTLINE_1 and TEXTLINE_2 in channels 1 and 2. Example:<br/><br/> TEXTLINE_1 and TEXTLINE_2 in channels 1 and 2.<br/>
Example:<br/><br/>
<code> <code>
define HM_EPDISP HMCCUDEV CCU_EPDISP<br/> define HM_EPDISP HMCCUDEV CCU_EPDISP<br/>
set HM_EPDISP config 2 TEXTLINE_1=Line1<br/> set HM_EPDISP config 2 TEXTLINE_1=Line1 # Set line 1 to "Line1"<br/>
set HM_EPDISP config 2 TEXTLINE_2=Line2<br/> set HM_EPDISP config 2 TEXTLINE_2=Line2 # Set line 2 to "Line2"<br/>
set HM_EPDISP config 1 TEXTLINE_1=Line4<br/> set HM_EPDISP config 1 TEXTLINE_1=Line4 # Set line 4 to "Line4"<br/>
set HM_EPDISP config 1 TEXTLINE_2=Line5<br/> set HM_EPDISP config 1 TEXTLINE_2=Line5 # Set line 5 to "Line5"<br/>
</code> </code>
<br/> <br/>
The lines 2,3 and 4 of the display can be accessed by setting the datapoint SUBMIT of the The lines 2,3 and 4 of the display can be modified by setting the datapoint SUBMIT of the
display to a string containing command tokens in format 'parameter=value'. The following display to a string containing command tokens in format 'parameter:value'. The following
commands are allowed: commands are allowed:
<br/><br/> <br/><br/>
<ul> <ul>
@ -728,8 +728,7 @@ sub HMCCUDEV_Get ($@)
snd_long<br/><br/> snd_long<br/><br/>
Example:<br/> Example:<br/>
<code> <code>
set HM_EPDISP datapoint 3.SUBMIT text1=Line2,text2=Line3,text3=Line4,sound=snd_short, set HM_EPDISP datapoint 3.SUBMIT "text1:Line2,text2:Has Blank,text3:10:05:21,sound:snd_short,signal:sig_red
signal=sig_red
</code> </code>
</li> </li>
</ul> </ul>

View File

@ -39,7 +39,7 @@ require "$attr{global}{modpath}/FHEM/88_HMCCU.pm";
###################################################################### ######################################################################
# HMCCURPC version # HMCCURPC version
my $HMCCURPCPROC_VERSION = '5.0 213141800'; my $HMCCURPCPROC_VERSION = '5.0 213171649';
# Maximum number of events processed per call of Read() # Maximum number of events processed per call of Read()
my $HMCCURPCPROC_MAX_EVENTS = 100; my $HMCCURPCPROC_MAX_EVENTS = 100;