mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-19 12:46:03 +00:00
HMCCU: Enhanced get channel command
git-svn-id: https://svn.fhem.de/fhem/trunk@10064 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
26951527f4
commit
9687f80e5c
@ -372,7 +372,7 @@ sub HMCCU_Get ($@)
|
|||||||
elsif ($opt eq 'vars') {
|
elsif ($opt eq 'vars') {
|
||||||
my $varname = shift @a;
|
my $varname = shift @a;
|
||||||
|
|
||||||
return HMCCU_SetError ($hash, "Usage: get <device> vars <regexp>[,...]") if (!defined ($varname));
|
return HMCCU_SetError ($hash, "Usage: get $name vars {regexp}[,...]") if (!defined ($varname));
|
||||||
|
|
||||||
($rc, $result) = HMCCU_GetVariables ($hash, $varname);
|
($rc, $result) = HMCCU_GetVariables ($hash, $varname);
|
||||||
return HMCCU_SetError ($hash, $rc) if ($rc < 0);
|
return HMCCU_SetError ($hash, $rc) if ($rc < 0);
|
||||||
@ -381,11 +381,16 @@ sub HMCCU_Get ($@)
|
|||||||
return $ccureadings ? undef : $result;
|
return $ccureadings ? undef : $result;
|
||||||
}
|
}
|
||||||
elsif ($opt eq 'channel') {
|
elsif ($opt eq 'channel') {
|
||||||
my $param = shift @a;
|
my @chnlist;
|
||||||
|
|
||||||
return HMCCU_SetError ($hash, "object := {channelname|channeladdress}.datapoint_expression") if (!defined ($param));
|
foreach my $objname (@a) {
|
||||||
|
last if (!defined ($objname));
|
||||||
|
push (@chnlist, $objname);
|
||||||
|
}
|
||||||
|
if (@chnlist == 0) {
|
||||||
|
return HMCCUDEV_SetError ($hash, "Usage: get $name channel {channel-name|channel-address}[.{datapoint-expr}] [...]");
|
||||||
|
}
|
||||||
|
|
||||||
my @chnlist = ($param);
|
|
||||||
($rc, $result) = HMCCU_GetChannel ($hash, \@chnlist);
|
($rc, $result) = HMCCU_GetChannel ($hash, \@chnlist);
|
||||||
return HMCCU_SetError ($hash, $rc) if ($rc < 0);
|
return HMCCU_SetError ($hash, $rc) if ($rc < 0);
|
||||||
|
|
||||||
@ -686,7 +691,7 @@ sub HMCCU_UpdateClientReading ($@)
|
|||||||
|
|
||||||
if ($hmccu_updreadings && $updatemode ne 'client') {
|
if ($hmccu_updreadings && $updatemode ne 'client') {
|
||||||
$hmccu_value = HMCCU_Substitute ($value, $hmccu_substitute);
|
$hmccu_value = HMCCU_Substitute ($value, $hmccu_substitute);
|
||||||
if ($updatemode eq 'rpcevent' && exists ($hash->{READINGS}{$reading}{VAL})) {
|
if ($updatemode ne 'rpcevent' || exists ($hash->{READINGS}{$reading}{VAL})) {
|
||||||
readingsSingleUpdate ($hash, $reading, $hmccu_value, 1);
|
readingsSingleUpdate ($hash, $reading, $hmccu_value, 1);
|
||||||
}
|
}
|
||||||
return $hmccu_value if ($updatemode eq 'hmccu');
|
return $hmccu_value if ($updatemode eq 'hmccu');
|
||||||
@ -1454,7 +1459,7 @@ foreach (sChannel, sChnList.Split(","))
|
|||||||
else {
|
else {
|
||||||
if ($ccureadings) {
|
if ($ccureadings) {
|
||||||
readingsBulkUpdate ($hash, $reading, $value);
|
readingsBulkUpdate ($hash, $reading, $value);
|
||||||
HMCCU_SetState ($hash, $value) if ($reading =~ /\.STATE$/);
|
readingsBulkUpdate ($hash, "state", $value) if ($reading =~ /\.STATE$/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user