mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-07 22:29:19 +00:00
HMCCU: new command get deviceinfo
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@10132 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e6de748b61
commit
dd130a269e
@ -99,6 +99,7 @@ sub HMCCU_StartRPCServer ($);
|
|||||||
sub HMCCU_StopRPCServer ($);
|
sub HMCCU_StopRPCServer ($);
|
||||||
sub HMCCU_IsRPCServerRunning ($);
|
sub HMCCU_IsRPCServerRunning ($);
|
||||||
sub HMCCU_CheckProcess ($);
|
sub HMCCU_CheckProcess ($);
|
||||||
|
sub HMCCU_GetDeviceInfo ($$);
|
||||||
sub HMCCU_GetDeviceList ($);
|
sub HMCCU_GetDeviceList ($);
|
||||||
sub HMCCU_GetAddress ($$$);
|
sub HMCCU_GetAddress ($$$);
|
||||||
sub HMCCU_GetCCUObjectAttribute ($$);
|
sub HMCCU_GetCCUObjectAttribute ($$);
|
||||||
@ -331,7 +332,7 @@ sub HMCCU_Get ($@)
|
|||||||
my ($hash, @a) = @_;
|
my ($hash, @a) = @_;
|
||||||
my $name = shift @a;
|
my $name = shift @a;
|
||||||
my $opt = shift @a;
|
my $opt = shift @a;
|
||||||
my $options = "devicelist:noArg devstate datapoint vars channel parfile config configdesc";
|
my $options = "devicelist:noArg devstate datapoint vars channel parfile config configdesc deviceinfo";
|
||||||
my $host = $hash->{host};
|
my $host = $hash->{host};
|
||||||
|
|
||||||
my $ccureadingformat = AttrVal ($name, "ccureadingformat", 'name');
|
my $ccureadingformat = AttrVal ($name, "ccureadingformat", 'name');
|
||||||
@ -431,13 +432,22 @@ sub HMCCU_Get ($@)
|
|||||||
HMCCU_SetState ($hash, "OK");
|
HMCCU_SetState ($hash, "OK");
|
||||||
return $ccureadings ? undef : $result;
|
return $ccureadings ? undef : $result;
|
||||||
}
|
}
|
||||||
|
elsif ($opt eq 'deviceinfo') {
|
||||||
|
my $device = shift @a;
|
||||||
|
|
||||||
|
return HMCCU_SetError ($hash, "") if (!defined ($device));
|
||||||
|
|
||||||
|
$result = HMCCU_GetDeviceInfo ($hash, $device);
|
||||||
|
return HMCCU_SetError ($hash, -2) if ($result eq '');
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
elsif ($opt eq 'devicelist') {
|
elsif ($opt eq 'devicelist') {
|
||||||
my $dumplist = shift @a;
|
my $dumplist = shift @a;
|
||||||
|
|
||||||
$hash->{DevCount} = HMCCU_GetDeviceList ($hash);
|
$hash->{DevCount} = HMCCU_GetDeviceList ($hash);
|
||||||
|
|
||||||
if ($hash->{DevCount} < 0) {
|
if ($hash->{DevCount} < 0) {
|
||||||
return HMCCU_SetError ($hash, "HM Script execution failed");
|
return HMCCU_SetError ($hash, -2);
|
||||||
}
|
}
|
||||||
elsif ($hash->{DevCount} == 0) {
|
elsif ($hash->{DevCount} == 0) {
|
||||||
return HMCCU_SetError ($hash, "No devices received from CCU");
|
return HMCCU_SetError ($hash, "No devices received from CCU");
|
||||||
@ -912,6 +922,43 @@ sub HMCCU_CheckProcess ($)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# Get channel and datapoints of CCU device
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
sub HMCCU_GetDeviceInfo ($$)
|
||||||
|
{
|
||||||
|
my ($hash, $device) = @_;
|
||||||
|
my $devname = '';
|
||||||
|
|
||||||
|
my ($int, $add, $chn, $dpt, $nam, $flags) = HMCCU_ParseObject ($device, 0);
|
||||||
|
if ($flags == $HMCCU_FLAG_ADDRESS) {
|
||||||
|
$devname = HMCCU_GetDeviceName ($add, '');
|
||||||
|
return '' if ($devname eq '');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$devname = $nam;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $script = qq(
|
||||||
|
string chnid;
|
||||||
|
string sDPId;
|
||||||
|
object odev = dom.GetObject ("$devname");
|
||||||
|
foreach (chnid, odev.Channels())
|
||||||
|
{
|
||||||
|
object ochn = dom.GetObject(chnid);
|
||||||
|
WriteLine("Channel " # ochn.Address() # " " # ochn.Name());
|
||||||
|
foreach(sDPId, ochn.DPs().EnumUsedIDs())
|
||||||
|
{
|
||||||
|
object oDP = dom.GetObject(sDPId);
|
||||||
|
WriteLine (" DP " # oDP.Name() # " = " # oDP.Value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return HMCCU_HMScript ($hash->{host}, $script);
|
||||||
|
}
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
# Read list of CCU devices via Homematic Script.
|
# Read list of CCU devices via Homematic Script.
|
||||||
# Update data of client devices if not current.
|
# Update data of client devices if not current.
|
||||||
@ -1756,6 +1803,10 @@ sub HMCCU_RPCSetConfig ($$$)
|
|||||||
Get value of datapoint(s). If no datapoint is specified all datapoints of specified
|
Get value of datapoint(s). If no datapoint is specified all datapoints of specified
|
||||||
channel are read. <datapoint> can be specified as a regular expression.
|
channel are read. <datapoint> can be specified as a regular expression.
|
||||||
</li><br/>
|
</li><br/>
|
||||||
|
<li>get <name> deviceinfo <device-name>
|
||||||
|
<br/>
|
||||||
|
List device channels and datapoints.
|
||||||
|
</li><br/>
|
||||||
<li>get <name> devicelist [dump]
|
<li>get <name> devicelist [dump]
|
||||||
<br/>
|
<br/>
|
||||||
Read list of devices and channels from CCU. This command is executed automatically after device
|
Read list of devices and channels from CCU. This command is executed automatically after device
|
||||||
|
Loading…
x
Reference in New Issue
Block a user