mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
HMCCU: Fixed rpcServerAddr and linked sysvars
git-svn-id: https://svn.fhem.de/fhem/trunk@16867 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
427d76b87d
commit
e2485bc7b0
@ -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.
|
||||
- bugfix: 88_HMCCU: fixed rpcServerAddr attribute and update of sysvar dpt
|
||||
- change: 49_SSCam: V5.2.0, support longpoll refresh of SSCamSTRM-Devices
|
||||
Design change of SSCamSTRM-Devs due to longpoll support
|
||||
- change: 82_LGTV_WebOS: change launchApp Vvalue for AmatonVideo and add
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Version 4.2.006
|
||||
# Version 4.2.007
|
||||
#
|
||||
# Module for communication between FHEM and Homematic CCU2.
|
||||
#
|
||||
@ -105,7 +105,7 @@ my %HMCCU_CUST_CHN_DEFAULTS;
|
||||
my %HMCCU_CUST_DEV_DEFAULTS;
|
||||
|
||||
# HMCCU version
|
||||
my $HMCCU_VERSION = '4.2.006';
|
||||
my $HMCCU_VERSION = '4.2.007';
|
||||
|
||||
# Default RPC port (BidCos-RF)
|
||||
my $HMCCU_RPC_PORT_DEFAULT = 2001;
|
||||
@ -4534,7 +4534,7 @@ sub HMCCU_GetRPCDevice ($$$)
|
||||
return (HMCCU_Log ($hash, 2, "Found more than one RPC device", ''), 0);
|
||||
}
|
||||
|
||||
HMCCU_Log ($hash, 1, "No RPC device defined", undef);
|
||||
HMCCU_Log ($hash, 1, "No RPC device defined for interface $ifname", undef);
|
||||
|
||||
# Create RPC device
|
||||
if ($create) {
|
||||
@ -5654,7 +5654,13 @@ sub HMCCU_GetUpdate ($$$)
|
||||
next if (!defined ($value));
|
||||
my ($iface, $chnadd, $dpt) = split /\./, $dpspec;
|
||||
next if (!defined ($dpt));
|
||||
my ($add, $chn) = HMCCU_SplitChnAddr ($chnadd);
|
||||
my ($add, $chn) = ('', '');
|
||||
if ($iface eq 'sysvar' && $chnadd eq 'link') {
|
||||
($add, $chn) = HMCCU_GetAddress ($hmccu_hash, $chnname, '', '');
|
||||
}
|
||||
else {
|
||||
($add, $chn) = HMCCU_SplitChnAddr ($chnadd);
|
||||
}
|
||||
next if ($chn eq '');
|
||||
$events{$add}{$chn}{$dpt} = $value;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Version 1.0.004
|
||||
# Version 1.0.005
|
||||
#
|
||||
# Subprocess based RPC Server module for HMCCU.
|
||||
#
|
||||
@ -35,7 +35,7 @@ use SetExtensions;
|
||||
######################################################################
|
||||
|
||||
# HMCCURPC version
|
||||
my $HMCCURPCPROC_VERSION = '1.0.004';
|
||||
my $HMCCURPCPROC_VERSION = '1.0.005';
|
||||
|
||||
# Maximum number of events processed per call of Read()
|
||||
my $HMCCURPCPROC_MAX_EVENTS = 100;
|
||||
@ -277,11 +277,13 @@ sub HMCCURPCPROC_Define ($$)
|
||||
return (0, "Can't connect to CCU ".$hash->{host}." port $ifport") if (!$socket);
|
||||
$hash->{hmccu}{localaddr} = $socket->sockhost ();
|
||||
close ($socket);
|
||||
return "Can't detect local IP address" if (!defined ($hash->{hmccu}{localaddr}));
|
||||
$hash->{hmccu}{defaultaddr} = $hash->{hmccu}{localaddr};
|
||||
|
||||
# Get unique ID for RPC server: last 2 segments of local IP address
|
||||
# Do not append random digits because of https://forum.fhem.de/index.php/topic,83544.msg797146.html#msg797146
|
||||
my @ipseg = split (/\./, $hash->{hmccu}{localaddr});
|
||||
return (0, "Invalid local IP address ".$hash->{hmccu}{localaddr}) if (scalar (@ipseg) != 4);
|
||||
return "Invalid local IP address ".$hash->{hmccu}{localaddr} if (scalar (@ipseg) != 4);
|
||||
# my $base = (time() % 10)+1;
|
||||
$hash->{rpcid} = sprintf ("%03d%03d", $ipseg[2], $ipseg[3]); # . join '', map int rand ($base), 1..2;
|
||||
|
||||
@ -362,6 +364,14 @@ sub HMCCURPCPROC_Attr ($@)
|
||||
if (($attrname eq 'rpcAcceptTimeout' || $attrname eq 'rpcMaxEvents') && $attrval == 0) {
|
||||
return "HMCCURPCPROC: [$name] Value for attribute $attrname must be greater than 0";
|
||||
}
|
||||
elsif ($attrname eq 'rpcServerAddr') {
|
||||
$hash->{hmccu}{localaddr} = $attrval;
|
||||
}
|
||||
}
|
||||
elsif ($cmd eq 'del') {
|
||||
if ($attrname eq 'rpcServerAddr') {
|
||||
$hash->{hmccu}{localaddr} = $hash->{hmccu}{defaultaddr};
|
||||
}
|
||||
}
|
||||
|
||||
return undef;
|
||||
@ -885,12 +895,17 @@ sub HMCCURPCPROC_GetAttribute ($$$$)
|
||||
my ($hash, $attr, $ioattr, $default) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $hmccu_hash = $hash->{IODev};
|
||||
my $value = 'null';
|
||||
|
||||
my $value = AttrVal ($name, $attr, 'null');
|
||||
return $value if ($value ne 'null');
|
||||
if (defined ($attr)) {
|
||||
$value = AttrVal ($name, $attr, 'null');
|
||||
return $value if ($value ne 'null');
|
||||
}
|
||||
|
||||
$value = AttrVal ($hmccu_hash->{NAME}, $ioattr, 'null');
|
||||
return $value if ($value ne 'null');
|
||||
if (defined ($ioattr)) {
|
||||
$value = AttrVal ($hmccu_hash->{NAME}, $ioattr, 'null');
|
||||
return $value if ($value ne 'null');
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
@ -1103,9 +1118,7 @@ sub HMCCURPCPROC_InitRPCServer ($$$$)
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Start RPC server processes
|
||||
# 1 process for processing event data in event queue
|
||||
# 1 process per CCU RPC interface for receiving data
|
||||
# Start RPC server process
|
||||
# Return (State, Msg)
|
||||
######################################################################
|
||||
|
||||
@ -1124,7 +1137,7 @@ sub HMCCURPCPROC_StartRPCServer ($)
|
||||
|
||||
# Get parameters and attributes
|
||||
my %procpar;
|
||||
my $localaddr = HMCCURPCPROC_GetAttribute ($hash, 'rpcServerAddr', 'rpcserveraddr', $hash->{hmccu}{localaddr});
|
||||
my $localaddr = HMCCURPCPROC_GetAttribute ($hash, undef, 'rpcserveraddr', $hash->{hmccu}{localaddr});
|
||||
my $rpcserverport = HMCCURPCPROC_GetAttribute ($hash, 'rpcServerPort', 'rpcserverport', $HMCCURPCPROC_SERVER_PORT);
|
||||
my $evttimeout = HMCCURPCPROC_GetAttribute ($hash, 'rpcEventTimeout', 'rpcevtimeout', $HMCCURPCPROC_TIMEOUT_EVENT);
|
||||
my $ccunum = $hash->{CCUNum};
|
||||
@ -1132,6 +1145,7 @@ sub HMCCURPCPROC_StartRPCServer ($)
|
||||
my $serveraddr = HMCCU_GetRPCServerInfo ($hmccu_hash, $rpcport, 'host');
|
||||
my $interface = HMCCU_GetRPCServerInfo ($hmccu_hash, $rpcport, 'name');
|
||||
my $clkey = 'CB'.$rpcport.$hash->{rpcid};
|
||||
$hash->{hmccu}{localaddr} = $localaddr;
|
||||
|
||||
# Store parameters for child process
|
||||
$procpar{socktimeout} = AttrVal ($name, 'rpcWriteTimeout', $HMCCURPCPROC_TIMEOUT_WRITE);
|
||||
|
@ -4,11 +4,11 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# Version 4.2.002
|
||||
# Version 4.2.003
|
||||
#
|
||||
# Configuration parameters for HomeMatic devices.
|
||||
#
|
||||
# (c) 2017 by zap (zap01 <at> t-online <dot> de)
|
||||
# (c) 2018 by zap (zap01 <at> t-online <dot> de)
|
||||
#
|
||||
# Datapoints LOWBAT, LOW_BAT, UNREACH, ERROR.*, SABOTAGE and FAULT.*
|
||||
# must not be specified in attribute ccureadingfilter. They are always
|
||||
@ -99,7 +99,7 @@ use vars qw(%HMCCU_SCRIPTS);
|
||||
webCmd => "devstate",
|
||||
widgetOverride => "devstate:uzsuToggle,off,on"
|
||||
},
|
||||
"HM-LC-Dim1L-Pl|HM-LC-Dim1L-Pl-2|HM-LC-Dim1L-CV|HM-LC-Dim2L-CV|HM-LC-Dim2L-SM|HM-LC-Dim1L-Pl-3|HM-LC-Dim1L-CV-2" => {
|
||||
"HM-LC-Dim1L-Pl|HM-LC-Dim1L-Pl-2|HM-LC-Dim1L-CV|HM-LC-Dim2L-CV|HM-LC-Dim2L-SM|HM-LC-Dim1L-Pl-3|HM-LC-Dim1L-CV-2" => {
|
||||
_description => "Funk-Anschnitt-Dimmaktor",
|
||||
_channels => "1",
|
||||
ccureadingfilter => "(^LEVEL\$|DIRECTION)",
|
||||
@ -291,6 +291,13 @@ use vars qw(%HMCCU_SCRIPTS);
|
||||
stripnumber => 1,
|
||||
substitute => "RAINING!(1|true):yes,(0|false):no"
|
||||
},
|
||||
"HmIP-SWO-PR|HmIP-SWO-B|HmIP-SWO-PL" => {
|
||||
_description => "Funk-Wettersensor",
|
||||
_channels => "1",
|
||||
ccureadingfilter => "1!.*",
|
||||
stripnumber => 1,
|
||||
substitute => "RAINING,RAIN_COUNTER_OVERFLOW,SUNSHINEDURATION_OVERFLOW,SUNSHINE_THRESHOLD_OVERRUN,WIND_THRESHOLD_OVERRUN!(0|false):no,(1|true):yes"
|
||||
},
|
||||
"HM-Sec-MD|HM-Sec-MDIR|HM-Sec-MDIR-2|HM-Sec-MDIR-3" => {
|
||||
_description => "Bewegungsmelder",
|
||||
_channels => "1",
|
||||
@ -704,6 +711,12 @@ use vars qw(%HMCCU_SCRIPTS);
|
||||
stripnumber => 1,
|
||||
substitute => "RAINING!(1|true):yes,(0|false):no"
|
||||
},
|
||||
"HmIP-SWO-PR|HmIP-SWO-B|HmIP-SWO-PL" => {
|
||||
_description => "Funk-Wettersensor",
|
||||
ccureadingfilter => "1!.*",
|
||||
stripnumber => 1,
|
||||
substitute => "RAINING,RAIN_COUNTER_OVERFLOW,SUNSHINEDURATION_OVERFLOW,SUNSHINE_THRESHOLD_OVERRUN,WIND_THRESHOLD_OVERRUN!(0|false):no,(1|true):yes"
|
||||
},
|
||||
"HM-ES-TX-WM" => {
|
||||
_description => "Energiezaehler Sensor",
|
||||
ccureadingfilter => "(ENERGY_COUNTER|POWER)"
|
||||
@ -1103,7 +1116,12 @@ foreach (sChnName, sChnList.Split(",")) {
|
||||
object oDP = dom.GetObject(sDPId);
|
||||
if (oDP) {
|
||||
if (OPERATION_READ & oDP.Operations()) {
|
||||
WriteLine (sChnName # "=" # oDP.Name() # "=" # oDP.\$ccuget());
|
||||
if (oDP.TypeName() == "HSSDP") {
|
||||
WriteLine (sChnName # "=" # oDP.Name() # "=" # oDP.\$ccuget());
|
||||
}
|
||||
else {
|
||||
WriteLine (sChnName # "=sysvar.link." # oDP.Name() # "=" # oDP.\$ccuget());
|
||||
}
|
||||
c = c+1;
|
||||
}
|
||||
}
|
||||
@ -1133,7 +1151,12 @@ foreach (sDevName, sDevList.Split(",")) {
|
||||
object oDP = dom.GetObject(sDPId);
|
||||
if (oDP) {
|
||||
if (OPERATION_READ & oDP.Operations()) {
|
||||
WriteLine (ochn.Name() # "=" # oDP.Name() # "=" # oDP.\$ccuget());
|
||||
if (oDP.TypeName() == "HSSDP") {
|
||||
WriteLine (ochn.Name() # "=" # oDP.Name() # "=" # oDP.\$ccuget());
|
||||
}
|
||||
else {
|
||||
WriteLine (ochn.Name() # "=sysvar.link." # oDP.Name() # "=" # oDP.\$ccuget());
|
||||
}
|
||||
c = c+1;
|
||||
}
|
||||
}
|
||||
@ -1168,7 +1191,10 @@ foreach (sDevice, sDevList.Split(",")) {
|
||||
foreach(sDPId, ochn.DPs()) {
|
||||
object oDP = dom.GetObject(sDPId);
|
||||
if (oDP) {
|
||||
string sDPName = oDP.Name().StrValueByIndex(".",2);
|
||||
string sDPName = oDP.Name();
|
||||
if (sDPName.Find(".") >= 0) {
|
||||
sDPName = sDPName.StrValueByIndex(".",2);
|
||||
}
|
||||
WriteLine (intna # ";" # sAddr # ";" # sType # ";" # sChnNo # ";" # sDPName # ";" # oDP.ValueType() # ";" # oDP.Operations());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user