mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-07 22:29:19 +00:00
HMCCU: Replace invalid characters in reading names
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@10286 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c218ba7df0
commit
c6a4f7aa6c
@ -631,7 +631,6 @@ sub HMCCU_ParseObject ($$)
|
|||||||
# ChannelNam,Datapoint
|
# ChannelNam,Datapoint
|
||||||
# Address,Datapoint
|
# Address,Datapoint
|
||||||
# Address,ChannelNo,Datapoint
|
# Address,ChannelNo,Datapoint
|
||||||
#
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
sub HMCCU_GetReadingName ($$$$$$)
|
sub HMCCU_GetReadingName ($$$$$$)
|
||||||
@ -649,19 +648,17 @@ sub HMCCU_GetReadingName ($$$$$$)
|
|||||||
if ($n eq '') {
|
if ($n eq '') {
|
||||||
if ($a ne '' && $c ne '') {
|
if ($a ne '' && $c ne '') {
|
||||||
$n = HMCCU_GetChannelName ($a.':'.$c, '');
|
$n = HMCCU_GetChannelName ($a.':'.$c, '');
|
||||||
$n =~ s/\:/\./;
|
|
||||||
}
|
}
|
||||||
elsif ($a ne '' && $c eq '') {
|
elsif ($a ne '' && $c eq '') {
|
||||||
$n = HMCCU_GetDeviceName ($a, '');
|
$n = HMCCU_GetDeviceName ($a, '');
|
||||||
$n =~ s/\:/_/g;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$n =~ s/\:/\./;
|
$n =~ s/\:/\./g;
|
||||||
}
|
$n =~ s/[^A-Za-z\d_\.-]+/_/g;
|
||||||
|
|
||||||
$rn = $n ne '' ? $n.'.'.$d : '';
|
$rn = $n ne '' ? $n.'.'.$d : '';
|
||||||
}
|
}
|
||||||
@ -684,8 +681,7 @@ sub HMCCU_GetReadingName ($$$$$$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# Format reading value depending depending on attribute
|
# Format reading value depending attribute stripnumber.
|
||||||
# stripnumber.
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
||||||
sub HMCCU_FormatReadingValue ($$)
|
sub HMCCU_FormatReadingValue ($$)
|
||||||
@ -810,16 +806,18 @@ sub HMCCU_SubstRule ($$$)
|
|||||||
return ($rc, $value);
|
return ($rc, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
##############################################################
|
##################################################################
|
||||||
# Update HMCCU readings and client readings.
|
# Update HMCCU readings and client readings.
|
||||||
#
|
#
|
||||||
# Parameters:
|
# Parameters:
|
||||||
# hash, devadd, channelno, reading, value, [mode]
|
# hash, devadd, channelno, reading, value, [mode]
|
||||||
#
|
#
|
||||||
# Parameter devadd can be a device or a channel address.
|
# Parameter devadd can be a device or a channel address. If
|
||||||
# Reading values are substituted if attribute substitute is
|
# devadd is a channel address parameter channelno should be ''.
|
||||||
# is set in client device.
|
# Valid modes are: hmccu, rpcevent, client.
|
||||||
##############################################################
|
# Reading values are substituted if attribute substitute is set
|
||||||
|
# in client device.
|
||||||
|
##################################################################
|
||||||
|
|
||||||
sub HMCCU_UpdateClientReading ($@)
|
sub HMCCU_UpdateClientReading ($@)
|
||||||
{
|
{
|
||||||
@ -872,26 +870,11 @@ sub HMCCU_UpdateClientReading ($@)
|
|||||||
my $st = AttrVal ($cn, 'statedatapoint', 'STATE');
|
my $st = AttrVal ($cn, 'statedatapoint', 'STATE');
|
||||||
my $substitute = AttrVal ($cn, 'substitute', '');
|
my $substitute = AttrVal ($cn, 'substitute', '');
|
||||||
last if ($upd == 0);
|
last if ($upd == 0);
|
||||||
# next if ($dpt ne '' && $dpt !~ /$flt/);
|
|
||||||
next if ($dpt eq '' || $dpt !~ /$flt/);
|
next if ($dpt eq '' || $dpt !~ /$flt/);
|
||||||
|
|
||||||
my $clreading = HMCCU_GetReadingName ('', $devadd, $channel, $dpt, '', $crf);
|
my $clreading = HMCCU_GetReadingName ('', $devadd, $channel, $dpt, '', $crf);
|
||||||
next if ($clreading eq '');
|
next if ($clreading eq '');
|
||||||
|
|
||||||
# my $clreading = $reading;
|
|
||||||
# if ($crf eq 'datapoint') {
|
|
||||||
# $clreading = $dpt ne '' ? $dpt : $reading;
|
|
||||||
# }
|
|
||||||
# elsif ($crf eq 'name') {
|
|
||||||
# $clreading = HMCCU_GetChannelName ($chnadd, $reading);
|
|
||||||
# $clreading .= '.'.$dpt if ($dpt ne '');
|
|
||||||
# }
|
|
||||||
# elsif ($crf eq 'address') {
|
|
||||||
# my $int = HMCCU_GetDeviceInterface ($devadd, 'BidCos-RF');
|
|
||||||
# $clreading = $int.'.'.$chnadd;
|
|
||||||
# $clreading .= '.'.$dpt if ($dpt ne '');
|
|
||||||
# }
|
|
||||||
|
|
||||||
# Client substitute attribute has priority
|
# Client substitute attribute has priority
|
||||||
my $cl_value;
|
my $cl_value;
|
||||||
if ($substitute ne '') {
|
if ($substitute ne '') {
|
||||||
@ -1410,8 +1393,8 @@ sub HMCCU_ReadRPCQueue ($)
|
|||||||
$element = $queue->deq();
|
$element = $queue->deq();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($HMCCU_EventTime > 0 && time()-$HMCCU_EventTime > 180) {
|
if ($HMCCU_EventTime > 0 && time()-$HMCCU_EventTime > 300) {
|
||||||
Log 1, "HMCCU: Received no events from CCU since 180 seconds";
|
Log 1, "HMCCU: Received no events from CCU since 300 seconds";
|
||||||
}
|
}
|
||||||
|
|
||||||
# HMCCU_DeleteDevices (\@deldevices) if (@deldevices > 0);
|
# HMCCU_DeleteDevices (\@deldevices) if (@deldevices > 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user