mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-08 13:24:56 +00:00
HMCCUDEV: Minor changes
git-svn-id: https://svn.fhem.de/fhem/trunk@10121 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1b1c657a89
commit
cf4793fdd0
@ -105,6 +105,7 @@ sub HMCCUDEV_Define ($@)
|
|||||||
return "CCU device name not found for $devspec" if ($hash->{ccuname} eq '');
|
return "CCU device name not found for $devspec" if ($hash->{ccuname} eq '');
|
||||||
|
|
||||||
$hash->{ccutype} = HMCCU_GetDeviceType ($hash->{ccuaddr}, '');
|
$hash->{ccutype} = HMCCU_GetDeviceType ($hash->{ccuaddr}, '');
|
||||||
|
$hash->{channels} = HMCCU_GetDeviceChannels ($hash->{ccuaddr});
|
||||||
$hash->{statevals} = 'devstate';
|
$hash->{statevals} = 'devstate';
|
||||||
|
|
||||||
my $n = 0;
|
my $n = 0;
|
||||||
@ -201,7 +202,7 @@ sub HMCCUDEV_Set ($@)
|
|||||||
if (!defined ($objname) || $objname !~ /^[0-9]+\..+$/ || !defined ($objvalue)) {
|
if (!defined ($objname) || $objname !~ /^[0-9]+\..+$/ || !defined ($objvalue)) {
|
||||||
return HMCCUDEV_SetError ($hash, "Usage: set <name> datapoint <channel-number>.<datapoint> <value> [...]");
|
return HMCCUDEV_SetError ($hash, "Usage: set <name> datapoint <channel-number>.<datapoint> <value> [...]");
|
||||||
}
|
}
|
||||||
$objvalue = HMCCU_Substitute ($objvalue, $statevals);
|
$objvalue = HMCCU_Substitute ($objvalue, $statevals, 1);
|
||||||
|
|
||||||
# Build datapoint address
|
# Build datapoint address
|
||||||
$objname = $hash->{ccuif}.'.'.$hash->{ccuaddr}.':'.$objname;
|
$objname = $hash->{ccuif}.'.'.$hash->{ccuaddr}.':'.$objname;
|
||||||
@ -222,7 +223,7 @@ sub HMCCUDEV_Set ($@)
|
|||||||
return HMCCUDEV_SetError ($hash, "No state channel specified") if ($statechannel eq '');
|
return HMCCUDEV_SetError ($hash, "No state channel specified") if ($statechannel eq '');
|
||||||
return HMCCUDEV_SetError ($hash, "Usage: set <name> devstate <value> [...]") if (!defined ($objvalue));
|
return HMCCUDEV_SetError ($hash, "Usage: set <name> devstate <value> [...]") if (!defined ($objvalue));
|
||||||
|
|
||||||
$objvalue = HMCCU_Substitute ($objvalue, $statevals);
|
$objvalue = HMCCU_Substitute ($objvalue, $statevals, 1);
|
||||||
|
|
||||||
# Build datapoint address
|
# Build datapoint address
|
||||||
my $objname = $hash->{ccuif}.'.'.$hash->{ccuaddr}.':'.$statechannel.'.'.$statedatapoint;
|
my $objname = $hash->{ccuif}.'.'.$hash->{ccuaddr}.':'.$statechannel.'.'.$statedatapoint;
|
||||||
@ -313,7 +314,12 @@ sub HMCCUDEV_Get ($@)
|
|||||||
my @chnlist;
|
my @chnlist;
|
||||||
foreach my $objname (@a) {
|
foreach my $objname (@a) {
|
||||||
last if (!defined ($objname));
|
last if (!defined ($objname));
|
||||||
return HMCCUDEV_SetError ($hash, "Invalid channel number: $objname") if ($objname !~ /^[0-9]+/);
|
if ($objname =~ /^([0-9]+)/ && exists ($hash->{channels})) {
|
||||||
|
return HMCCUDEV_SetError ($hash, "Invalid channel number: $objname") if ($1 >= $hash->{channels});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return HMCCUDEV_SetError ($hash, "Invalid channel number: $objname");
|
||||||
|
}
|
||||||
push (@chnlist, $hash->{ccuif}.'.'.$hash->{ccuaddr}.':'.$objname);
|
push (@chnlist, $hash->{ccuif}.'.'.$hash->{ccuaddr}.':'.$objname);
|
||||||
}
|
}
|
||||||
if (@chnlist == 0) {
|
if (@chnlist == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user