2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

HMCCU: Disable initial device update

git-svn-id: https://svn.fhem.de/fhem/trunk@19373 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2019-05-11 15:18:23 +00:00
parent e3fd2c73ee
commit 6e8848d460
3 changed files with 66 additions and 11 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: Flag for disabling initial device update
- bugfix: 10_MYSENSORS_DEVICE: prevent fhem crashing by ack timeout - bugfix: 10_MYSENSORS_DEVICE: prevent fhem crashing by ack timeout
at higher verobse levels at higher verobse levels
- change: 98_Heating_Control.pm will be removed soon. Users will need to - change: 98_Heating_Control.pm will be removed soon. Users will need to

View File

@ -4,7 +4,7 @@
# #
# $Id$ # $Id$
# #
# Version 4.3.014 # Version 4.3.015
# #
# Module for communication between FHEM and Homematic CCU2/3. # Module for communication between FHEM and Homematic CCU2/3.
# #
@ -52,7 +52,7 @@ my %HMCCU_CUST_CHN_DEFAULTS;
my %HMCCU_CUST_DEV_DEFAULTS; my %HMCCU_CUST_DEV_DEFAULTS;
# HMCCU version # HMCCU version
my $HMCCU_VERSION = '4.3.014'; my $HMCCU_VERSION = '4.3.015';
# Constants and default values # Constants and default values
my $HMCCU_MAX_IOERRORS = 100; my $HMCCU_MAX_IOERRORS = 100;
@ -2639,7 +2639,10 @@ sub HMCCU_SetRPCState ($@)
my $st = $hash->{hmccu}{interfaces}{$i}{state}; my $st = $hash->{hmccu}{interfaces}{$i}{state};
$stc{$st}++ if (exists ($stc{$st})); $stc{$st}++ if (exists ($stc{$st}));
if ($hash->{hmccu}{interfaces}{$i}{manager} eq 'HMCCU') { if ($hash->{hmccu}{interfaces}{$i}{manager} eq 'HMCCU') {
$filter = defined ($filter) ? "$filter|$i" : $i; my $rpcFlags = AttrVal ($hash->{hmccu}{interfaces}{$i}{device}, 'ccuflags', 'null');
if ($rpcFlags !~ /noInitialUpdate/) {
$filter = defined ($filter) ? "$filter|$i" : $i;
}
} }
} }
@ -2659,7 +2662,7 @@ sub HMCCU_SetRPCState ($@)
DoTrigger ($name, "RPC server $rpcstate"); DoTrigger ($name, "RPC server $rpcstate");
if ($rpcstate eq 'running') { if ($rpcstate eq 'running') {
my ($c_ok, $c_err) = HMCCU_UpdateClients ($hash, '.*', 'Attr', 0, $filter); my ($c_ok, $c_err) = HMCCU_UpdateClients ($hash, '.*', 'Attr', 0, $filter);
HMCCU_Log ($hash, 2, "Updated devices. Success=$c_ok Failed=$c_err", undef); HMCCU_Log ($hash, 2, "Updated devices for interface filter $filter. Success=$c_ok Failed=$c_err", undef);
} }
} }
} }
@ -6812,7 +6815,8 @@ sub HMCCU_RPCGetConfig ($$$$)
my $hmccu_hash = HMCCU_GetHash ($hash); my $hmccu_hash = HMCCU_GetHash ($hash);
return (-3, $result) if (!defined ($hmccu_hash)); return (-3, $result) if (!defined ($hmccu_hash));
return (-4, $result) if ($type ne 'HMCCU' && $hash->{ccudevstate} eq 'deleted'); return (-4, $result) if ($type ne 'HMCCU' && $hash->{ccudevstate} eq 'deleted');
my $hmccuflags = HMCCU_GetFlags ($hmccu_hash->{NAME});
my $ccuflags = HMCCU_GetFlags ($name); my $ccuflags = HMCCU_GetFlags ($name);
my $ccureadings = AttrVal ($name, 'ccureadings', $ccuflags =~ /noReadings/ ? 0 : 1); my $ccureadings = AttrVal ($name, 'ccureadings', $ccuflags =~ /noReadings/ ? 0 : 1);
my $readingformat = HMCCU_GetAttrReadingFormat ($hash, $hmccu_hash); my $readingformat = HMCCU_GetAttrReadingFormat ($hash, $hmccu_hash);
@ -6834,7 +6838,7 @@ sub HMCCU_RPCGetConfig ($$$$)
if ($rpctype eq 'B') { if ($rpctype eq 'B') {
HMCCU_Trace ($hash, 2, $fnc, "Method=$method Addr=$addr Port=$port"); HMCCU_Trace ($hash, 2, $fnc, "Method=$method Addr=$addr Port=$port");
if ($ccuflags =~ /(extrpc|procrpc)/) { if ($hmccuflags =~ /(extrpc|procrpc)/) {
$res = HMCCURPCPROC_SendRequest ($rpchash, $method, $BINRPC_STRING, $addr, $res = HMCCURPCPROC_SendRequest ($rpchash, $method, $BINRPC_STRING, $addr,
$BINRPC_STRING, "MASTER"); $BINRPC_STRING, "MASTER");
} }
@ -6916,13 +6920,15 @@ sub HMCCU_RPCSetConfig ($$$)
my $name = $hash->{NAME}; my $name = $hash->{NAME};
my $type = $hash->{TYPE}; my $type = $hash->{TYPE};
my $ccuflags = HMCCU_GetFlags ($name);
my $addr; my $addr;
my $res; my $res;
my $hmccu_hash = HMCCU_GetHash ($hash); my $hmccu_hash = HMCCU_GetHash ($hash);
return -3 if (!defined ($hmccu_hash)); return -3 if (!defined ($hmccu_hash));
return -4 if ($type ne 'HMCCU' && $hash->{ccudevstate} eq 'deleted'); return -4 if ($type ne 'HMCCU' && $hash->{ccudevstate} eq 'deleted');
my $hmccuflags = HMCCU_GetFlags ($hmccu_hash->{NAME});
my $ccuflags = HMCCU_GetFlags ($name);
my ($int, $add, $chn, $dpt, $nam, $flags) = HMCCU_ParseObject ($hmccu_hash, $param, my ($int, $add, $chn, $dpt, $nam, $flags) = HMCCU_ParseObject ($hmccu_hash, $param,
$HMCCU_FLAG_FULLADDR); $HMCCU_FLAG_FULLADDR);
@ -6954,7 +6960,7 @@ sub HMCCU_RPCSetConfig ($$$)
$binpar{$e}{V} = $parref->{$e}; $binpar{$e}{V} = $parref->{$e};
} }
if ($ccuflags =~ /(extrpc|procrpc)/) { if ($hmccuflags =~ /(extrpc|procrpc)/) {
$res = HMCCURPCPROC_SendRequest ($rpchash, "putParamset", $BINRPC_STRING, $addr, $res = HMCCURPCPROC_SendRequest ($rpchash, "putParamset", $BINRPC_STRING, $addr,
$BINRPC_STRING, "MASTER", $BINRPC_STRUCT, \%binpar); $BINRPC_STRING, "MASTER", $BINRPC_STRUCT, \%binpar);
} }
@ -8400,7 +8406,7 @@ sub HMCCU_CCURPC_ListDevicesCB ($$)
procrpc - Use external RPC server provided by module HMCCPRPCPROC. During first RPC procrpc - Use external RPC server provided by module HMCCPRPCPROC. During first RPC
server start HMCCU will create a HMCCURPCPROC device for each interface confiugured server start HMCCU will create a HMCCURPCPROC device for each interface confiugured
in attribute 'rpcinterface'<br/> in attribute 'rpcinterface'<br/>
reconnect - Automatically reconnect to CCU when events timeout occurred. reconnect - Automatically reconnect to CCU when events timeout occurred.<br/>
Flags intrpc, extrpc and procrpc cannot be combined. Flags intrpc, extrpc and procrpc cannot be combined.
</li><br/> </li><br/>
<li><b>ccuget {State | <u>Value</u>}</b><br/> <li><b>ccuget {State | <u>Value</u>}</b><br/>

View File

@ -4,7 +4,7 @@
# #
# $Id$ # $Id$
# #
# Version 1.7.001 # Version 1.7.002
# #
# Subprocess based RPC Server module for HMCCU. # Subprocess based RPC Server module for HMCCU.
# #
@ -158,6 +158,7 @@ sub HMCCURPCPROC_EventCB ($$$$$);
sub HMCCURPCPROC_ListDevicesCB ($$); sub HMCCURPCPROC_ListDevicesCB ($$);
# Binary RPC encoding functions # Binary RPC encoding functions
sub HMCCURPCPROC_RPCNewValue ($$);
sub HMCCURPCPROC_EncInteger ($); sub HMCCURPCPROC_EncInteger ($);
sub HMCCURPCPROC_EncBool ($); sub HMCCURPCPROC_EncBool ($);
sub HMCCURPCPROC_EncString ($); sub HMCCURPCPROC_EncString ($);
@ -202,7 +203,7 @@ sub HMCCURPCPROC_Initialize ($)
$hash->{parseParams} = 1; $hash->{parseParams} = 1;
$hash->{AttrList} = "ccuflags:multiple-strict,expert,logEvents,ccuInit,queueEvents,noEvents". $hash->{AttrList} = "ccuflags:multiple-strict,expert,logEvents,ccuInit,queueEvents,noEvents,noInitialUpdate".
" rpcMaxEvents rpcQueueSend rpcQueueSize rpcMaxIOErrors". " rpcMaxEvents rpcQueueSend rpcQueueSize rpcMaxIOErrors".
" rpcServerAddr rpcServerPort rpcWriteTimeout rpcAcceptTimeout". " rpcServerAddr rpcServerPort rpcWriteTimeout rpcAcceptTimeout".
" rpcConnTimeout rpcStatistics rpcEventTimeout rpcPingCCU ". " rpcConnTimeout rpcStatistics rpcEventTimeout rpcPingCCU ".
@ -2252,6 +2253,52 @@ sub HMCCURPCPROC_ListDevicesCB ($$)
return RPC::XML::array->new (); return RPC::XML::array->new ();
} }
######################################################################
# Convert value to RPC data type
# Valid types are bool, boolean, int, integer, float, double, string.
# If type is undefined, type is detected. If type cannot be detected
# value is returned as is.
######################################################################
sub HMCCURPCPROC_RPCNewValue ($$)
{
my ($value, $type) = @_;
# Try to detect type if type not specified
if (!defined ($type)) {
if (lc($value) =~ /^(true|false)$/) {
$type = 'boolean';
}
elsif ($value =~ /^[-+]?\d+$/) {
$type = 'integer';
}
elsif ($value =~ /^[-+]?[0-9]*\.[0-9]+$/) {
# A float must contain at least a dot followed by a digit
$type = 'float';
}
elsif ($value =~ /[a-zA-Z_ ]/ || $value =~ /^'.+'$/ || $value =~ /^".+"$/) {
$type = 'string';
}
}
if (defined ($type)) {
my $lcType = lc($type);
if ($lcType =~ /^bool/ && uc($value) =~ /^(TRUE|FALSE|0|1)$/) {
return RPC::XML::boolean->new ($value);
}
elsif ($lcType =~ /^int/ && $value =~ /^[-+]?\d+$/) {
return RPC::XML::int->new ($value);
}
elsif ($lcType =~ /^(float|double)$/ && $value =~ /^[-+]?[0-9]*\.[0-9]+$/) {
return RPC::XML::double->new ($value);
}
elsif ($lcType =~ /^str/) {
return RPC::XML::string->new ($value);
}
}
return $value;
}
###################################################################### ######################################################################
# Binary RPC encoding functions # Binary RPC encoding functions
@ -2805,6 +2852,7 @@ sub HMCCURPCPROC_DecodeResponse ($)
expert - Activate expert mode<br/> expert - Activate expert mode<br/>
logEvents - Events are written into FHEM logfile if verbose is 4<br/> logEvents - Events are written into FHEM logfile if verbose is 4<br/>
noEvents - Ignore events from CCU, do not update client device readings.<br/> noEvents - Ignore events from CCU, do not update client device readings.<br/>
noInitalUpdate - Do not update devices after RPC server started.<br/>
queueEvents - Always write events into queue and send them asynchronously to FHEM. queueEvents - Always write events into queue and send them asynchronously to FHEM.
Frequency of event transmission to FHEM depends on attribute rpcConnTimeout.<br/> Frequency of event transmission to FHEM depends on attribute rpcConnTimeout.<br/>
</li><br/> </li><br/>