2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

HMCCU: Version 5.0

git-svn-id: https://svn.fhem.de/fhem/trunk@24940 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2021-09-09 17:27:53 +00:00
parent c44ec53ad7
commit e99921a2cf
7 changed files with 808 additions and 306 deletions

View File

@ -1,9 +1,10 @@
- bugfix: 88_HMCCU.pm: Fixed some bux in version 5.0
- bugfix: 88_HMCCU.pm: Version 5.0
- bugfix: 88_HMCCU.pm: Release candidate 7
- bugfix: 88_HMCCU.pm: Release candidate 6
- bugfix: 88_HMCCU.pm: Release candidate 5
- bugfix: 88_HMCCU.pm: Release candidate 4
- bugfix: 88_HMCCU.pm: Release candidate 3
- bugfix: 88_HMCCU.pm: Release candidate 2
- bugfix: 88_HMCCU.pm: Fixed bug in set defaults command
- bugfix: 88_HMCCU.pm: Fixed state-/controldatapoint bug during FHEM start
- bugfix: 88_HMCCU.pm: Fixed some bugs. New command set readingFilter
- bugfix: 88_HMCCU.pm: Fixed device detection bugs

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
#
# $Id: 88_HMCCUCHN.pm 18552 2019-02-10 11:52:28Z zap $
#
# Version 4.4.039
# Version 5.0
#
# (c) 2021 zap (zap01 <at> t-online <dot> de)
#
@ -71,6 +71,18 @@ sub HMCCUCHN_Define ($@)
my ($devname, $devtype, $devspec) = splice (@$a, 0, 3);
my $ioHash;
my @errmsg = (
"OK",
"Invalid or unknown CCU device name or address",
"Can't assign I/O device"
);
my @warnmsg = (
"OK",
"Unknown warning message",
"Device type not known by HMCCU. Please set control and/or state channel with attributes controldatapoint and statedatapoint"
);
my $existDev = HMCCU_ExistsClientDevice ($devspec, $devtype);
return "FHEM device $existDev for CCU device $devspec already exists" if ($existDev ne '');
@ -82,6 +94,7 @@ sub HMCCUCHN_Define ($@)
$hash->{hmccu}{channels} = 1;
$hash->{hmccu}{nodefaults} = $init_done ? 0 : 1;
$hash->{hmccu}{semDefaults} = 0;
$hash->{hmccu}{detect} = 0;
# Parse optional command line parameters
my $n = 0;
@ -117,7 +130,7 @@ sub HMCCUCHN_Define ($@)
else {
# CCU not ready during FHEM start
if (!defined($ioHash) || $ioHash->{ccustate} ne 'active') {
HMCCU_Log ($hash, 3, 'Cannot detect IO device, maybe CCU not ready. Trying later ...');
HMCCU_Log ($hash, 3, "Cannot detect IO device, maybe CCU not ready or device doesn't exist on CCU");
$hash->{ccudevstate} = 'pending';
return undef;
}
@ -125,10 +138,14 @@ sub HMCCUCHN_Define ($@)
# Initialize FHEM device, set IO device
my $rc = HMCCUCHN_InitDevice ($ioHash, $hash);
return 'Invalid or unknown CCU channel name or address' if ($rc == 1);
return "Can't assign I/O device $ioHash->{NAME}" if ($rc == 2);
return undef;
if (HMCCU_IsIntNum ($rc)) {
return $errmsg[$rc] if ($rc > 0 && $rc < scalar(@errmsg));
HMCCU_LogDisplay ($hash, 2, $warnmsg[-$rc]) if ($rc < 0 && -$rc < scalar(@warnmsg));
return undef;
}
else {
return $rc;
}
}
######################################################################
@ -137,6 +154,7 @@ sub HMCCUCHN_Define ($@)
# Return 0 on successful initialization or >0 on error:
# 1 = Invalid channel name or address
# 2 = Cannot assign IO device
# -2 = Device type not known by HMCCU
######################################################################
sub HMCCUCHN_InitDevice ($$)
@ -168,11 +186,11 @@ sub HMCCUCHN_InitDevice ($$)
HMCCU_UpdateDevice ($ioHash, $devHash);
HMCCU_UpdateDeviceRoles ($ioHash, $devHash);
return -2 if (!defined($detect) || $detect->{level} == 0); # Device not detected
return -2 if (!defined($detect) || $detect->{level} == 0);
if (!HMCCU_SetDefaultSCDatapoints ($ioHash, $devHash, $detect)) {
HMCCU_Log ($devHash, 2, "Cannot set default state- and control datapoints");
}
my ($sc, $sd, $cc, $cd, $rsd, $rcd) = HMCCU_SetDefaultSCDatapoints ($ioHash, $devHash, $detect, 1);
HMCCU_Log ($devHash, 2, "Cannot set default state- and/or control datapoints. Maybe device type not known by HMCCU")
if ($rsd == 0 && $rcd == 0);
HMCCU_SetInitialAttributes ($ioHash, $name);
@ -233,7 +251,11 @@ sub HMCCUCHN_Attr ($@)
$clHash->{IODev} = $defs{$attrval};
}
elsif ($attrname eq 'statevals') {
return 'Device is read only' if ($clHash->{readonly} eq 'yes');
return 'Attribute statevals ignored. Device is read only' if ($clHash->{readonly} eq 'yes');
return 'Attribute statevals ignored. Device type is known by HMCCU' if ($clHash->{hmccu}{detect} > 0);
if ($init_done && !HMCCU_IsValidControlDatapoint ($clHash)) {
HMCCU_LogDisplay ($clHash, 2, 'Warning: Attribute controldatapoint not set or set to invalid datapoint');
}
}
elsif ($attrname =~ /^(state|control)datapoint$/) {
my $role = HMCCU_GetChannelRole ($clHash);
@ -248,9 +270,9 @@ sub HMCCUCHN_Attr ($@)
if (exists($clHash->{hmccu}{roleCmds}) &&
(!exists($clHash->{hmccu}{control}{chn}) || $clHash->{hmccu}{control}{chn} eq ''));
if ($init_done) {
if (!HMCCU_SetDefaultSCDatapoints ($ioHash, $clHash)) {
HMCCU_Log ($clHash, 2, "Cannot set default state- and control datapoints");
}
my ($sc, $sd, $cc, $cd, $rsd, $rcd) = HMCCU_SetDefaultSCDatapoints ($ioHash, $clHash, undef, 1);
HMCCU_Log ($clHash, 2, "Cannot set default state- and/or control datapoints")
if ($rsd == 0 && $rcd == 0);
}
}
}
@ -282,7 +304,7 @@ sub HMCCUCHN_Set ($@)
if (HMCCU_IsRPCStateBlocking ($ioHash));
# Build set command syntax
my $syntax = 'clear defaults:reset,update';
my $syntax = 'clear defaults:reset,update,old';
# Command readingFilter depends on readable datapoints
my ($add, $chn) = split(":", $hash->{ccuaddr});
@ -329,7 +351,10 @@ sub HMCCUCHN_Set ($@)
}
elsif ($lcopt eq 'defaults') {
my $mode = shift @$a // 'update';
my $rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => undef });
my $rc = 0;
if ($mode ne 'old') {
$rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => undef });
}
$rc = HMCCU_SetDefaults ($hash) if (!$rc);
HMCCU_RefreshReadings ($hash) if ($rc);
return HMCCU_SetError ($hash, $rc == 0 ? "No default attributes found" : "OK");
@ -396,9 +421,10 @@ sub HMCCUCHN_Get ($@)
return HMCCU_ExecuteGetDeviceInfoCommand ($ioHash, $hash, $devAddr, defined($extended) ? 1 : 0);
}
elsif ($lcopt =~ /^(config|values|update)$/) {
my $filter = shift @$a;
my ($devAddr, undef) = HMCCU_SplitChnAddr ($ccuaddr);
my @addList = ($devAddr, "$devAddr:0", $ccuaddr);
my $result = HMCCU_ExecuteGetParameterCommand ($ioHash, $hash, $lcopt, \@addList);
my $result = HMCCU_ExecuteGetParameterCommand ($ioHash, $hash, $lcopt, \@addList, $filter);
return HMCCU_SetError ($hash, "Can't get device description") if (!defined($result));
return HMCCU_DisplayGetParameterResult ($ioHash, $hash, $result);
}
@ -503,12 +529,13 @@ sub HMCCUCHN_Get ($@)
<code>set temp_control datapoint SET_TEMPERATURE 21</code><br/>
<code>set temp_control datapoint AUTO_MODE 1 SET_TEMPERATURE=21</code>
</li><br/>
<li><b>set &lt;name&gt; defaults ['reset'|'<u>update</u>']</b><br/>
<li><b>set &lt;name&gt; defaults ['reset'|'old'|'<u>update</u>']</b><br/>
Set default attributes for CCU device type. Default attributes are only available for
some device types and for some channels of a device type. If option 'reset' is specified,
the following attributes are deleted before the new attributes are set:
'ccureadingname', 'ccuscaleval', 'eventMap', 'substexcl', 'webCmd', 'widgetOverride'.
During update to version 4.4 it's recommended to use option 'reset'.
During update to version 4.4 it's recommended to use option 'reset'. With option 'old'
the attributes are set according to HMCCU 4.3 defaults mechanism.
</li><br/>
<li><b>set &lt;name&gt; down [&lt;value&gt;]</b><br/>
[dimmer, blind] Decrement value of datapoint LEVEL. This command is only available
@ -522,7 +549,7 @@ sub HMCCUCHN_Get ($@)
<code>set myswitch on-for-timer 300</code>
</li><br/>
<li><b>set &lt;name&gt; on-till &lt;timestamp&gt;</b><br/>
[switch] Switch device on until <i>timestamp</i>. Parameter <i>timestamp</i> can be a time in
[switch,dimmer] Switch device on until <i>timestamp</i>. Parameter <i>timestamp</i> can be a time in
format HH:MM or HH:MM:SS. This command is only available if channel contains a datapoint
ON_TIME.
</li><br/>
@ -545,7 +572,7 @@ sub HMCCUCHN_Get ($@)
channel contains a datapoint STOP.
</li><br/>
<li><b>set &lt;name&gt; toggle</b><br/>
Toggle state datapoint between values defined by attribute 'statevals'. This command is
Toggle state datapoint between values defined by attribute 'statevals' or by channel role. This command is
only available if state values can be detected or are defined by using attribute
'statevals'. Toggling supports more than two state values.<br/><br/>
Example: Toggle blind actor between states 'open', 'half' and 'close'<br/>
@ -570,8 +597,9 @@ sub HMCCUCHN_Get ($@)
<a name="HMCCUCHNget"></a>
<b>Get</b><br/><br/>
<ul>
<li><b>get &lt;name&gt; config</b><br/>
Get configuration parameters of device and channel.
<li><b>get &lt;name&gt; config [&lt;filter-expr&gt;]</b><br/>
Get configuration parameters of device and channel. If <i>filter-expr</i> is specified,
only parameters matching the expression are stored as readings.<br/>
Values related to configuration or link parameters are stored as readings beginning
with "R-" for MASTER parameter set and "L-" for LINK parameter set.
Prefixes "R-" and "L-" can be modified with attribute 'ccuReadingPrefix'. Whether parameters are
@ -614,11 +642,13 @@ sub HMCCUCHN_Get ($@)
information to your post in the FHEM forum, if you have a question about
the integration of a new device. See also command 'get deviceInfo'.
</li><br/>
<li><b>get &lt;name&gt; update</b><br/>
<li><b>get &lt;name&gt; update [&lt;filter-expr&gt;]</b><br/>
Update all readings for all parameters of all parameter sets (MASTER, LINK, VALUES).
If <i>filter-expr</i> is specified, only parameters matching the expression are stored as readings.
</li><br/>
<li><b>get &lt;name&gt; values</b><br/>
<li><b>get &lt;name&gt; values [&lt;filter-expr&gt;]</b><br/>
Update all readings for all parameters of parameter set VALUES (datapoints).
If <i>filter-expr</i> is specified, only parameters matching the expression are stored as readings.
</li><br/>
<li><b>get &lt;name&gt; weekProgram [&lt;program-number&gt;|<u>all</u>]</b><br/>
Display week programs. This command is only available if a device supports week programs.
@ -827,14 +857,18 @@ sub HMCCUCHN_Get ($@)
state datapoint cannot be detected automatically.
</li><br/>
<a name="statevals"></a>
<li><b>statevals &lt;text&gt;:&lt;text&gt;[,...]</b><br/>
Define substitution for values of set commands. The parameters <i>text</i> are available
as set commands.
<li><b>statevals &lt;new-command&gt;:&lt;control-datapoint-value&gt;[,...]</b><br/>
Define set commands for control datapoint. This attribute should only be used if the device
type is not recognized by HMCCU. Using this attribute for automatically detected devices
could lead to problems!
<br/><br/>
Example:<br/>
Example: controldatapoint of a device is STATE. Device is not recognized by HMCCU:<br/>
<code>
# Define 2 new commands on and off representing the possible states of STATE:<br/>
attr my_switch statevals on:true,off:false<br/>
set my_switch on
# After attr the commands on and off are available:<br/>
set my_switch on<br/>
set my_switch off
</code>
</li><br/>
<a name="stripnumber"></a>
@ -862,7 +896,9 @@ sub HMCCUCHN_Get ($@)
</li><br/>
<a name="substitute"></a>
<li><b>substitute &lt;subst-rule&gt;[;...]</b><br/>
Define substitutions for datapoint/reading values. Syntax of <i>subst-rule</i> is<br/><br/>
Define substitutions for datapoint/reading values. This attribute is helpful / necessary if
a device is not automatically detected by HMCCU.<br/>
Syntax of <i>subst-rule</i> is<br/><br/>
[[&lt;type&gt;:][&lt;channelno&gt;.]&lt;datapoint&gt;[,...]!]&lt;{#n1-m1|regexp}&gt;:&lt;text&gt;[,...]
<br/><br/>
Parameter <i>type</i> is a valid channel type/role, i.e. "SHUTTER_CONTACT".

View File

@ -4,7 +4,7 @@
#
# $Id: 88_HMCCUDEV.pm 18552 2019-02-10 11:52:28Z zap $
#
# Version 4.4.048
# Version 5.0
#
# (c) 2021 zap (zap01 <at> t-online <dot> de)
#
@ -95,7 +95,7 @@ sub HMCCUDEV_Define ($@)
# Handle some legacy options
return 'Virtual devices are no longer supported. Use FHEM built in features like readingsgroup or structure'
if ($devspec eq 'virtual');
HMCCU_Log ($hash, 2, "Found old device definition syntax using group or groupexp. Group options will be ignored in furture versions.")
HMCCU_Log ($hash, 2, "Found old device definition syntax using group or groupexp. Group options will be ignored in future versions.")
if (exists($h->{group}) || exists($h->{groupexp}));
# Store some definitions for delayed initialization
@ -106,6 +106,7 @@ sub HMCCUDEV_Define ($@)
$hash->{hmccu}{nodefaults} = $init_done ? 0 : 1;
$hash->{hmccu}{semDefaults} = 0;
$hash->{hmccu}{forcedev} = 0;
$hash->{hmccu}{detect} = 0;
# Parse optional command line parameters
foreach my $arg (@$a) {
@ -139,7 +140,7 @@ sub HMCCUDEV_Define ($@)
else {
# CCU not ready during FHEM start
if (!defined($ioHash) || $ioHash->{ccustate} ne 'active') {
HMCCU_Log ($hash, 3, 'Cannot detect IO device, maybe CCU not ready. Trying later ...');
HMCCU_Log ($hash, 3, "Cannot detect IO device, maybe CCU not ready or device doesn't exist on CCU");
$hash->{ccudevstate} = 'pending';
return undef;
}
@ -149,7 +150,7 @@ sub HMCCUDEV_Define ($@)
my $rc = HMCCUDEV_InitDevice ($ioHash, $hash);
if (HMCCU_IsIntNum ($rc)) {
return $errmsg[$rc] if ($rc > 0 && $rc < scalar(@errmsg));
HMCCU_LogDisplay ($hash, 2, $warnmsg[-$rc]) if ($init_done && $rc < 0 && -$rc < scalar(@warnmsg));
HMCCU_LogDisplay ($hash, 2, $warnmsg[-$rc]) if ($rc < 0 && -$rc < scalar(@warnmsg));
return undef;
}
else {
@ -168,7 +169,8 @@ sub HMCCUDEV_Define ($@)
# 5 = Type of virtual device not defined
# 6 = Device type not found
# 7 = Too many virtual devices
# -1 = Control channel must be specified
# -1 = Control channel ambiguous
# -2 = Device type not known by HMCCU
######################################################################
sub HMCCUDEV_InitDevice ($$)
@ -209,11 +211,11 @@ sub HMCCUDEV_InitDevice ($$)
HMCCU_UpdateDevice ($ioHash, $devHash);
HMCCU_UpdateDeviceRoles ($ioHash, $devHash);
return -2 if (!defined($detect) || $detect->{level} == 0); # Device not detected
return -2 if (!defined($detect) || $detect->{level} == 0);
if (!HMCCU_SetDefaultSCDatapoints ($ioHash, $devHash, $detect)) {
HMCCU_Log ($devHash, 2, "Cannot set default state- and control datapoints");
}
my ($sc, $sd, $cc, $cd, $rsd, $rcd) = HMCCU_SetDefaultSCDatapoints ($ioHash, $devHash, $detect, 1);
HMCCU_Log ($devHash, 2, "Cannot set default state- and/or control datapoints. Maybe device type not known by HMCCU")
if ($rsd == 0 && $rcd == 0);
HMCCU_SetInitialAttributes ($ioHash, $name);
@ -310,7 +312,11 @@ sub HMCCUDEV_Attr ($@)
$clHash->{IODev} = $defs{$attrval};
}
elsif ($attrname eq 'statevals') {
return "Device is read only" if ($clHash->{readonly} eq 'yes');
return 'Attribute statevals ignored. Device is read only' if ($clHash->{readonly} eq 'yes');
return 'Attribute statevals ignored. Device type is known by HMCCU' if ($clHash->{hmccu}{detect} > 0);
if ($init_done && !HMCCU_IsValidControlDatapoint ($clHash)) {
HMCCU_LogDisplay ($clHash, 2, 'Warning: Attribute controldatapoint not set or set to invalid datapoint');
}
}
elsif ($attrname =~ /^(state|control)(channel|datapoint)$/) {
my $chn = $attrval;
@ -329,11 +335,6 @@ sub HMCCUDEV_Attr ($@)
my $role = HMCCU_GetChannelRole ($clHash, $chn);
return "Invalid value $attrval" if (!HMCCU_SetSCDatapoints ($clHash, $attrname, $attrval, $role));
if ($init_done && exists($clHash->{hmccu}{control}{chn}) && $clHash->{hmccu}{control}{chn} ne '') {
HMCCU_UpdateRoleCommands ($ioHash, $clHash, $clHash->{hmccu}{control}{chn});
HMCCU_UpdateAdditionalCommands ($ioHash, $clHash, $clHash->{hmccu}{control}{chn}, $clHash->{hmccu}{control}{dpt})
if (exists($clHash->{hmccu}{control}{dpt}) && $clHash->{hmccu}{control}{dpt} ne '');
}
}
}
elsif ($cmd eq 'del') {
@ -344,9 +345,10 @@ sub HMCCUDEV_Attr ($@)
if (exists($clHash->{hmccu}{roleCmds}) &&
(!exists($clHash->{hmccu}{control}{chn}) || $clHash->{hmccu}{control}{chn} eq ''));
if ($init_done) {
if (!HMCCU_SetDefaultSCDatapoints ($ioHash, $clHash)) {
HMCCU_Log ($clHash, 2, "Cannot set default state- and control datapoints");
}
# Try to set default state and control datapoint and update command list
my ($sc, $sd, $cc, $cd, $rsd, $rcd) = HMCCU_SetDefaultSCDatapoints ($ioHash, $clHash, undef, 1);
HMCCU_Log ($clHash, 2, "Cannot set default state- and/or control datapoints")
if ($rsd == 0 && $rcd == 0);
}
}
}
@ -377,7 +379,7 @@ sub HMCCUDEV_Set ($@)
if (HMCCU_IsRPCStateBlocking ($ioHash));
# Build set command syntax
my $syntax = 'clear defaults:reset,update';
my $syntax = 'clear defaults:reset,update,old';
# Command readingFilter depends on readable datapoints
my @dpRList = ();
@ -422,7 +424,10 @@ sub HMCCUDEV_Set ($@)
}
elsif ($lcopt eq 'defaults') {
my $mode = shift @$a // 'update';
my $rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => undef });
my $rc = 0;
if ($mode ne 'old') {
$rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => undef });
}
$rc = HMCCU_SetDefaults ($hash) if (!$rc);
HMCCU_RefreshReadings ($hash) if ($rc);
return HMCCU_SetError ($hash, $rc == 0 ? 'No default attributes found' : 'OK');
@ -503,13 +508,14 @@ sub HMCCUDEV_Get ($@)
return HMCCU_ExecuteGetDeviceInfoCommand ($ioHash, $hash, $ccuaddr, defined($extended) ? 1 : 0);
}
elsif ($lcopt =~ /^(config|values|update)$/) {
my $filter = shift @$a;
my @addList = ($ccuaddr);
my $devDesc = HMCCU_GetDeviceDesc ($ioHash, $ccuaddr, $ccuif);
return HMCCU_SetError ($hash, "Can't get device description") if (!defined($devDesc));
push @addList, split (',', $devDesc->{CHILDREN});
my $result = HMCCU_ExecuteGetParameterCommand ($ioHash, $hash, $lcopt, \@addList);
my $result = HMCCU_ExecuteGetParameterCommand ($ioHash, $hash, $lcopt, \@addList, $filter);
return HMCCU_SetError ($hash, "Can't get device description") if (!defined($result));
return HMCCU_DisplayGetParameterResult ($ioHash, $hash, $result);
}
@ -608,12 +614,13 @@ sub HMCCUDEV_Get ($@)
<code>set temp_control datapoint 2.SET_TEMPERATURE 21</code><br/>
<code>set temp_control datapoint 2.AUTO_MODE 1 2.SET_TEMPERATURE 21</code>
</li><br/>
<li><b>set &lt;name&gt; defaults ['reset'|'<u>update</u>']</b><br/>
<li><b>set &lt;name&gt; defaults ['reset'|'old'|'<u>update</u>']</b><br/>
Set default attributes for CCU device type. Default attributes are only available for
some device types and for some channels of a device type. If option 'reset' is specified,
the following attributes are deleted before the new attributes are set:
'ccureadingname', 'ccuscaleval', 'eventMap', 'substexcl', 'webCmd', 'widgetOverride'.
During update to version 4.4 it's recommended to use option 'reset'.
During update to version 4.4 it's recommended to use option 'reset'. With option 'old'
the attributes are set according to HMCCU 4.3 defaults mechanism.
</li><br/>
<li><b>set &lt;name&gt; down [&lt;value&gt;]</b><br/>
<a href="#HMCCUCHNset">see HMCCUCHN</a>

View File

@ -4,7 +4,7 @@
#
# $Id: 88_HMCCURPCPROC.pm 18745 2019-02-26 17:33:23Z zap $
#
# Version 4.4.014
# Version 5.0
#
# Subprocess based RPC Server module for HMCCU.
#
@ -39,7 +39,7 @@ require "$attr{global}{modpath}/FHEM/88_HMCCU.pm";
######################################################################
# HMCCURPC version
my $HMCCURPCPROC_VERSION = '4.4.014';
my $HMCCURPCPROC_VERSION = '5.0';
# Maximum number of events processed per call of Read()
my $HMCCURPCPROC_MAX_EVENTS = 100;
@ -126,6 +126,17 @@ my %RPC_METHODS = (
);
# RPC event types
# EV = Event
# ND = New device
# DD = Delete device
# RD = Replace device
# RA = Readded device
# UD = Update device
# IN = Init RPC connection
# EX = Exit RPC process
# SL = Server loop
# ST = Statistics (not in list of event types)
# TO = Timeout
my @RPC_EVENT_TYPES = ('EV', 'ND', 'DD', 'RD', 'RA', 'UD', 'IN', 'EX', 'SL', 'TO');
@ -138,6 +149,7 @@ sub HMCCURPCPROC_Initialize ($);
sub HMCCURPCPROC_Define ($$);
sub HMCCURPCPROC_InitDevice ($$);
sub HMCCURPCPROC_Undef ($$);
sub HMCCURPCPROC_Rename ($$);
sub HMCCURPCPROC_DelayedShutdown ($);
sub HMCCURPCPROC_Shutdown ($);
sub HMCCURPCPROC_Attr ($@);
@ -237,6 +249,7 @@ sub HMCCURPCPROC_Initialize ($)
$hash->{DefFn} = 'HMCCURPCPROC_Define';
$hash->{UndefFn} = 'HMCCURPCPROC_Undef';
$hash->{RenameFn} = 'HMCCURPCPROC_Rename';
$hash->{SetFn} = 'HMCCURPCPROC_Set';
$hash->{GetFn} = 'HMCCURPCPROC_Get';
$hash->{ReadFn} = 'HMCCURPCPROC_Read';
@ -447,6 +460,21 @@ sub HMCCURPCPROC_Undef ($$)
return undef;
}
######################################################################
# Rename device
######################################################################
sub HMCCURPCPROC_Rename ($$)
{
my ($newName, $oldName) = @_;
my $hash = $defs{$newName};
my $ioHash = $hash->{IODev};
my $ifName = $hash->{rpcinterface};
$ioHash->{hmccu}{interfaces}{$ifName}{device} = $newName;
}
######################################################################
# Delayed shutdown FHEM
######################################################################
@ -532,6 +560,8 @@ sub HMCCURPCPROC_Attr ($@)
}
}
HMCCU_LogDisplay ($hash, 2, 'Please restart RPC server to apply attribute changes') if ($init_done);
return undef;
}
@ -2403,6 +2433,11 @@ sub HMCCURPCPROC_HexDump ($$)
{
my ($name, $data) = @_;
if (!defined($data)) {
HMCCU_Log ($name, 4, 'HexDump called without data');
return;
}
my $offset = 0;
foreach my $chunk (unpack "(a16)*", $data) {

View File

@ -4,7 +4,7 @@
#
# $Id: HMCCUConf.pm 18552 2019-02-10 11:52:28Z zap $
#
# Version 4.8.030
# Version 5.0
#
# Configuration parameters for HomeMatic devices.
#
@ -28,7 +28,7 @@ use vars qw(%HMCCU_CHN_DEFAULTS);
use vars qw(%HMCCU_DEV_DEFAULTS);
use vars qw(%HMCCU_SCRIPTS);
$HMCCU_CONFIG_VERSION = '4.8.030';
$HMCCU_CONFIG_VERSION = '5.0';
######################################################################
# Map subtype to default role. Subtype is only available for HMIP
@ -64,9 +64,18 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
'ROTARY_HANDLE_TRANSCEIVER' => {
F => 3, S => 'STATE', C => '', V => '', P => 2
},
'MULTI_MODE_INPUT_TRANSMITTER' => {
F => 3, S => 'STATE', C => '', V => '', P => 1
},
'ALARM_SWITCH_VIRTUAL_RECEIVER' => {
F => 3, S => 'ACOUSTIC_ALARM_ACTIVE', C => 'ACOUSTIC_ALARM_SELECTION', V => '', P => 2
},
'DOOR_LOCK_STATE_TRANSMITTER' => {
F => 3, S => 'LOCK_STATE', C => 'LOCK_TARGET_LEVEL', V => 'open:2,unlocked:1,locked:0'
},
'ACCELERATION_TRANSCEIVER' => {
F => 3, S => 'MOTION', C => '', V => '', P => 1
},
'MOTION_DETECTOR' => {
F => 3, S => 'MOTION', C => '', V => '', P => 1
},
@ -76,6 +85,9 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
'PRESENCEDETECTOR_TRANSCEIVER' => {
F => 3, S => 'PRESENCE_DETECTION_STATE', C => 'PRESENCE_DETECTION_ACTIVE', V => 'active:1,inactive:0', P => 2
},
'PASSAGE_DETECTOR_DIRECTION_TRANSMITTER' => {
F => 3, S => 'CURRENT_PASSAGE_DIRECTION', C => '', V => '', P => 1
},
'SMOKE_DETECTOR' => {
F => 3, S => 'BidCos-RF:STATE,SMOKE_DETECTOR_ALARM_STATUS', C => 'HmIP-RF:SMOKE_DETECTOR_COMMAND', V => '', P => 2
},
@ -137,7 +149,7 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
F => 3, S => 'TEMPERATURE', C => '', V => '', P => 1
},
'WEATHER_TRANSMIT' => {
F => 3, S => 'TEMPERATURE', C => '', V => '', P => 1
F => 3, S => 'ACTUAL_TEMPERATURE', C => '', V => '', P => 1
},
'CLIMATE_TRANSCEIVER' => {
F => 3, S => 'ACTUAL_TEMPERATURE', C => '', V => '', P => 1
@ -156,6 +168,9 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
},
'CLIMATECONTROL_VENT_DRIVE' => {
F => 3, S => 'VALVE_STATE', C => '', V => '', P => 2
},
'WATER_DETECTION_TRANSMITTER' => {
F => 3, S => 'ALARMSTATE', C => '', V => '', P => 1
}
);
@ -183,6 +198,14 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
'(C#\.)?LEVEL$:+pct',
'DIMMER_VIRTUAL_RECEIVER' =>
'(C#\.)?LEVEL$:+pct',
'KEY' =>
'(C#\.)?PRESS_(SHORT|LONG)$:+pressed',
'KEY_TRANSCEIVER' =>
'(C#\.)?PRESS_(SHORT|LONG)$:+pressed',
'VIRTUAL_KEY' =>
'(C#\.)?PRESS_(SHORT|LONG)$:+pressed',
'ACCELERATION_TRANSCEIVER' =>
'(C#\.)?MOTION:motion',
'MOTION_DETECTOR' =>
'^(C#\.)?BRIGHTNESS$:brightness;(C#\.)?MOTION:motion',
'MOTIONDETECTOR_TRANSCEIVER' =>
@ -224,23 +247,37 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
# Set commands related to channel role
# Role => { Command-Definition, ... }
# Command-Defintion:
# Command[:InterfaceExpr] => 'Datapoint-Definition[:Function] [...]'
# Command[:InterfaceExpr] => [No:]Datapoint-Def[:Function] [...]'
# No:
# Execution order of subcommands. By default subcommands are
# executed from left to right.
# Function:
# A Perl function name
# Datapoint-Definition:
# Paramset:Datapoint:[Parameter=]FixedValue
# Paramset:Datapoint:?Parameter
# Paramset:Datapoint:?Parameter=Default-Value
# Paramset:Datapoint:#Parameter[=FixedValue,[...]]
# Paramset:Datapoint:*Parameter=Default-Value
# Datapoint-Def:
# Paramset:Datapoints:[Parameter=]FixedValue
# Paramset:Datapoints:?Parameter
# Paramset:Datapoints:?Parameter=Default-Value
# Paramset:Datapoints:#Parameter[=FixedValue,[...]]
# Paramset:Datapoints:*Parameter=Default-Value
# Paramset:
# V=VALUES, M=MASTER (channel), D=MASTER (device), I=INTERNAL
# Datapoints:
# List of parameter names separated by ','
# Parameter characters:
# ? = any value is accepted
# # = If datapoint is of type ENUM, values are taken from
# parameter set description. Otherwise a list of values must
# be specified.
# be specified after '='.
# * = internal value $hash->{hmccu}{values}{parameterName}
# FixedValue: Parameter values are detected in the following order:
# 1. If command parameter name is identical with controldatapoint,
# option values are taken from controldatapoint definition {V}. The
# FixedValues are used as lookup key into HMCCU_STATECCONTROL.
# The command options are identical to the FixedValues.
# 2. FixedValues are treated as option values. The option
# names are taken from HMCCU_CONVERSIONS by using FixedValues as
# lookup key.
# 3. As a fallback command options and option values are identical.
# If Default-Value is preceeded by + or -, value is added to or
# subtracted from current datapoint value
######################################################################
@ -248,11 +285,14 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
%HMCCU_ROLECMDS = (
'MOTIONDETECTOR_TRANSCEIVER' => {
'detection' => 'V:MOTION_DETECTION_ACTIVE:#detection=inactive,active',
'reset' => 'V:RESET_MOTION:1'
'reset' => 'V:RESET_MOTION:true'
},
'PRESENCEDETECTOR_TRANSCEIVER' => {
'detection' => 'V:PRESENCE_DETECTION_ACTIVE:#detection=inactive,active',
'reset' => 'V:RESET_PRESENCE:1'
'reset' => 'V:RESET_PRESENCE:true'
},
'PASSAGE_DETECTOR_DIRECTION_TRANSMITTER' => {
'detection' => 'M:PASSAGE_DETECTION,CHANNEL_OPERATION_MODE:#inactive,active'
},
'SMOKE_DETECTOR' => {
'command' => 'V:SMOKE_DETECTOR_COMMAND:#command'
@ -262,6 +302,11 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
'acousticAlarm' => 'V:ACOUSTIC_ALARM_SELECTION:#alarmMode V:OPTICAL_ALARM_SELECTION:0 V:DURATION_UNIT:0 V:DURATION_VALUE:10',
'duration' => 'I:DURATION_VALUE:?duration I:DURATION_UNIT:#unit'
},
'DOOR_LOCK_STATE_TRANSMITTER' => {
'open' => 'V:LOCK_TARGET_LEVEL:2',
'unlock' => 'V:LOCK_TARGET_LEVEL:1',
'lock' => 'V:LOCK_TARGET_LEVEL:0'
},
'KEY' => {
'on' => 'V:PRESS_SHORT:1',
'off' => 'V:PRESS_SHORT:1',
@ -309,19 +354,23 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
'on-till' => 'V:ON_TIME:?time V:STATE:1'
},
'DIMMER' => {
'pct' => 'V:LEVEL:?level V:ON_TIME:?time=0.0 V:RAMP_TIME:?ramp=0.5',
'pct' => '3:V:LEVEL:?level 1:V:ON_TIME:?time=0.0 2:V:RAMP_TIME:?ramp=0.5',
'on' => 'V:LEVEL:100',
'off' => 'V:LEVEL:0',
'on-for-timer' => 'V:ON_TIME:?duration V:STATE:1',
'on-till' => 'V:ON_TIME:?time V:STATE:1',
'on-for-timer' => 'V:ON_TIME:?duration V:LEVEL:100',
'on-till' => 'V:ON_TIME:?time V:LEVEL:100',
'up' => 'V:LEVEL:?delta=+10',
'down' => 'V:LEVEL:?delta=-10',
'stop' => 'V:RAMP_STOP:1'
},
'DIMMER_VIRTUAL_RECEIVER' => {
'pct' => 'V:LEVEL:?level V:ON_TIME:?time V:RAMP_TIME:?ramp',
'pct' => '3:V:LEVEL:?level 1:V:ON_TIME:?time=0.0 2:V:RAMP_TIME:?ramp=0.5',
'on' => 'V:LEVEL:100',
'off' => 'V:LEVEL:0',
'on-for-timer' => 'V:ON_TIME:?duration V:STATE:1',
'on-till' => 'V:ON_TIME:?time V:STATE:1'
'on-for-timer' => 'V:ON_TIME:?duration V:LEVEL:100',
'on-till' => 'V:ON_TIME:?time V:LEVEL:100',
'up' => 'V:LEVEL:?delta=+10',
'down' => 'V:LEVEL:?delta=-10',
},
'THERMALCONTROL_TRANSMIT' => {
'desired-temp' => 'V:SET_TEMPERATURE:?temperature',
@ -371,9 +420,19 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
'SHUTTER_CONTACT_TRANSCEIVER' => {
'_none_' => ''
},
'MULTI_MODE_INPUT_TRANSMITTER' => {
'_none_' => ''
},
'ACCELERATION_TRANSCEIVER' => {
'_none_' => ''
},
'MOTION_DETECTOR' => {
'_none_' => ''
},
'DOOR_LOCK_STATE_TRANSMITTER' => {
'cmdIcon' => 'open:fts_door_open unlock:secur_open lock:secur_lock',
'webCmd' => 'lock:unlock:open'
},
'MOTIONDETECTOR_TRANSCEIVER' => {
'cmdIcon' => 'reset:rc_BACK',
'webCmd' => 'detection:reset'
@ -382,6 +441,9 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
'cmdIcon' => 'reset:rc_BACK',
'webCmd' => 'detection:reset'
},
'PASSAGE_DETECTOR_DIRECTION_TRANSMITTER' => {
'_none_' => ''
},
'KEY' => {
'event-on-update-reading' => 'PRESS.*',
'cmdIcon' => 'press:taster',
@ -461,6 +523,9 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
},
'CLIMATECONTROL_VENT_DRIVE' => {
'_none_' => ''
},
'WATER_DETECTION_TRANSMITTER' => {
'_none_' => ''
}
);
@ -473,16 +538,23 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
######################################################################
%HMCCU_CONVERSIONS = (
'ACCELERATION_TRANSCEIVER' => {
'MOTION' => { '0' => 'noMotion', 'false' => 'noMotion', '1' => 'motion', 'true' => 'motion' }
},
'MOTION_DETECTOR' => {
'MOTION' => { '0' => 'noMotion', 'false' => 'noMotion', '1' => 'motion', 'true' => 'motion' }
},
'MOTIONDETECTOR_TRANSCEIVER' => {
'MOTION' => { '0' => 'noMotion', 'false' => 'noMotion', '1' => 'motion', 'true' => 'motion' },
'MOTION_DETECTION_ACTIVE' => { '0' => 'inactive', 'false' => 'inactive', '1' => 'active', 'true', 'active' }
'MOTION_DETECTION_ACTIVE' => { '0' => 'inactive', 'false' => 'inactive', '1' => 'active', 'true' => 'active' }
},
'PRESENCEDETECTOR_TRANSCEIVER' => {
'PRESENCE_DETECTION_STATE' => { '0' => 'noPresence', 'false' => 'noPresence', '1' => 'presence', 'true' => 'presence' },
'PRESENCE_DETECTION_ACTIVE' => { '0' => 'inactive', 'false' => 'inactive', '1' => 'active', 'true', 'active' }
'PRESENCE_DETECTION_ACTIVE' => { '0' => 'inactive', 'false' => 'inactive', '1' => 'active', 'true' => 'active' }
},
'PASSAGE_DETECTOR_DIRECTION_TRANSMITTER' => {
'PASSAGE_DETECTION' => { '0' => 'inactive', 1 => 'active' },
'CHANNEL_OPERATION_MODE' => { '0' => 'inactive', 1 => 'active'}
},
'KEY' => {
'PRESS_SHORT' => { '1' => 'pressed', 'true' => 'pressed' },
@ -564,6 +636,9 @@ $HMCCU_CONFIG_VERSION = '4.8.030';
'CLIMATECONTROL_REGULATOR' => {
'SETPOINT' => { '4.5' => 'off', '30.5' => 'on' }
},
'WATER_DETECTION_TRANSMITTER' => {
'ALARMSTATE' => { '0' => 'noAlarm', '1' => 'Alarm', 'false' => 'noAlarm', 'true' => 'alarm' }
},
'DEFAULT' => {
'AES_KEY' => { '0' => 'off', 'false' => 'off', '1' => 'on', 'true' => 'on' },
'LOW_BAT' => { '0' => 'ok', 'false' => 'ok', '1' => 'low', 'true' => 'low' },

View File

@ -1,5 +1,5 @@
UPD 2021-06-07_18:52:09 102813 FHEM/88_HMCCURPCPROC.pm
UPD 2021-06-07_18:52:09 82168 FHEM/HMCCUConf.pm
UPD 2021-06-07_18:52:09 42050 FHEM/88_HMCCUCHN.pm
UPD 2021-06-07_18:52:09 344833 FHEM/88_HMCCU.pm
UPD 2021-06-07_18:52:09 30896 FHEM/88_HMCCUDEV.pm
UPD 2021-09-09_19:12:29 103713 FHEM/88_HMCCURPCPROC.pm
UPD 2021-09-09_18:45:27 84909 FHEM/HMCCUConf.pm
UPD 2021-09-02_19:33:39 43994 FHEM/88_HMCCUCHN.pm
UPD 2021-09-08_20:42:05 358142 FHEM/88_HMCCU.pm
UPD 2021-09-02_19:33:39 31267 FHEM/88_HMCCUDEV.pm