mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
HMCCU: 4.4 beta release candidate 2
git-svn-id: https://svn.fhem.de/fhem/trunk@24198 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
52d3aa3c20
commit
bd9a91a9f0
@ -1,3 +1,4 @@
|
||||
- bugfix: 88_HMCCU.pm: Release candidate 2
|
||||
- bugfix: 88_HMCCU.pm: Fixed some bugs. New command set readingFilter
|
||||
- bugfix: 88_HMCCU.pm: Fixed device detection bugs
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,9 +4,9 @@
|
||||
#
|
||||
# $Id: 88_HMCCUCHN.pm 18552 2019-02-10 11:52:28Z zap $
|
||||
#
|
||||
# Version 4.4.033
|
||||
# Version 4.4.037
|
||||
#
|
||||
# (c) 2020 zap (zap01 <at> t-online <dot> de)
|
||||
# (c) 2021 zap (zap01 <at> t-online <dot> de)
|
||||
#
|
||||
######################################################################
|
||||
# Client device for Homematic channels.
|
||||
@ -48,7 +48,7 @@ sub HMCCUCHN_Initialize ($)
|
||||
|
||||
$hash->{AttrList} = 'IODev ccucalculate '.
|
||||
'ccuflags:multiple-strict,ackState,logCommand,noReadings,trace,showMasterReadings,showLinkReadings,showDeviceReadings,showServiceReadings '.
|
||||
'ccureadingfilter:textField-long '.
|
||||
'ccureadingfilter:textField-long statedatapoint controldatapoint '.
|
||||
'ccureadingformat:name,namelc,address,addresslc '.
|
||||
'ccureadingname:textField-long ccuSetOnChange ccuReadingPrefix '.
|
||||
'ccuscaleval ccuverify:0,1,2 ccuget:State,Value '.
|
||||
@ -89,7 +89,7 @@ sub HMCCUCHN_Define ($@)
|
||||
return $usage if ($n == 3);
|
||||
if ($arg eq 'readonly') { $hash->{readonly} = 'yes'; }
|
||||
elsif (lc($arg) eq 'nodefaults' && $init_done) { $hash->{hmccu}{nodefaults} = 1; }
|
||||
elsif ($arg eq 'defaults' && $init_done) { $hash->{hmccu}{nodefaults} = 0; }
|
||||
elsif (lc($arg) eq 'defaults' && $init_done) { $hash->{hmccu}{nodefaults} = 0; }
|
||||
else { return $usage; }
|
||||
$n++;
|
||||
}
|
||||
@ -159,22 +159,26 @@ sub HMCCUCHN_InitDevice ($$)
|
||||
$devHash->{ccudevstate} = 'active';
|
||||
|
||||
if ($init_done) {
|
||||
my $detect = HMCCU_DetectDevice ($ioHash, $da, $di);
|
||||
|
||||
# Interactive device definition
|
||||
HMCCU_SetSCAttributes ($ioHash, $devHash);
|
||||
HMCCU_SetSCAttributes ($ioHash, $devHash, $detect);
|
||||
HMCCU_AddDevice ($ioHash, $di, $da, $devHash->{NAME});
|
||||
HMCCU_UpdateDevice ($ioHash, $devHash);
|
||||
HMCCU_UpdateDeviceRoles ($ioHash, $devHash);
|
||||
|
||||
my ($sc, $sd, $cc, $cd, $sdCnt, $cdCnt) = HMCCU_GetSCDatapoints ($devHash);
|
||||
return -2 if (!defined($detect) || $detect->{level} == 0); # Device not detected
|
||||
|
||||
HMCCU_UpdateRoleCommands ($ioHash, $devHash, $cc);
|
||||
HMCCU_UpdateAdditionalCommands ($ioHash, $devHash, $cc, $cd);
|
||||
if (!HMCCU_SetDefaultSCDatapoints ($ioHash, $devHash, $detect)) {
|
||||
HMCCU_Log ($devHash, 2, "Cannot set default state- and control datapoints");
|
||||
}
|
||||
|
||||
if (!exists($devHash->{hmccu}{nodefaults}) || $devHash->{hmccu}{nodefaults} == 0) {
|
||||
if (!HMCCU_SetDefaultAttributes ($devHash)) {
|
||||
HMCCU_SetDefaults ($devHash);
|
||||
}
|
||||
}
|
||||
|
||||
HMCCU_GetUpdate ($devHash, $da, 'Value');
|
||||
}
|
||||
|
||||
@ -229,18 +233,24 @@ sub HMCCUCHN_Attr ($@)
|
||||
return 'Device is read only' if ($clHash->{readonly} eq 'yes');
|
||||
}
|
||||
elsif ($attrname =~ /^(state|control)datapoint$/) {
|
||||
return "Invalid value $attrval"
|
||||
if (!HMCCU_SetSCDatapoints ($clHash, $attrname, $attrval));
|
||||
my $role = HMCCU_GetChannelRole ($clHash);
|
||||
return "Invalid value $attrval" if (!HMCCU_SetSCDatapoints ($clHash, $attrname, $attrval, $role));
|
||||
}
|
||||
}
|
||||
elsif ($cmd eq 'del') {
|
||||
if ($attrname =~ /^(state|control)datapoint$/) {
|
||||
# Reset value
|
||||
HMCCU_SetSCDatapoints ($clHash, $attrname);
|
||||
delete $clHash->{hmccu}{roleCmds}
|
||||
if (exists($clHash->{hmccu}{roleCmds}) &&
|
||||
(!exists($clHash->{hmccu}{control}{chn}) || $clHash->{hmccu}{control}{chn} eq ''));
|
||||
if ($init_done) {
|
||||
if (!HMCCU_SetDefaultSCDatapoints ($ioHash, $clHash)) {
|
||||
HMCCU_Log ($clHash, 2, "Cannot set default state- and control datapoints");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# HMCCU_RefreshReadings ($clHash) if ($init_done);
|
||||
|
||||
return undef;
|
||||
}
|
||||
@ -319,21 +329,23 @@ sub HMCCUCHN_Set ($@)
|
||||
}
|
||||
elsif ($lcopt eq 'defaults') {
|
||||
my $mode = shift @$a // 'update';
|
||||
$rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, ctrlChn => $cc });
|
||||
$rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => $cc });
|
||||
$rc = HMCCU_SetDefaults ($hash) if (!$rc);
|
||||
HMCCU_RefreshReadings ($hash) if ($rc);
|
||||
return HMCCU_SetError ($hash, $rc == 0 ? "No default attributes found" : "OK");
|
||||
}
|
||||
else {
|
||||
my $retmsg = "clear defaults:reset,update";
|
||||
|
||||
my ($a, $c) = split(":", $hash->{ccuaddr});
|
||||
my @dpRList = ();
|
||||
my $dpRCount = HMCCU_GetValidDatapoints ($hash, $hash->{ccutype}, $c, 5, \@dpRList);
|
||||
$retmsg .= ' readingFilter:multiple-strict,'.join(',', @dpRList) if ($dpRCount > 0);
|
||||
|
||||
if ($hash->{readonly} ne 'yes') {
|
||||
$retmsg .= ' config';
|
||||
my ($a, $c) = split(":", $hash->{ccuaddr});
|
||||
my $dpCount = HMCCU_GetValidDatapoints ($hash, $hash->{ccutype}, $c, 2);
|
||||
$retmsg .= ' datapoint' if ($dpCount > 0);
|
||||
my @dpList = ();
|
||||
$dpCount = HMCCU_GetValidDatapoints ($hash, $hash->{ccutype}, $c, 5, \@dpList);
|
||||
$retmsg .= ' readingFilter:multiple-strict,'.join(',', @dpList) if ($dpCount > 0);
|
||||
my $dpWCount = HMCCU_GetValidDatapoints ($hash, $hash->{ccutype}, $c, 2);
|
||||
$retmsg .= ' datapoint' if ($dpWCount > 0);
|
||||
$retmsg .= " $cmdList" if ($cmdList ne '');
|
||||
}
|
||||
# return AttrTemplate_Set ($hash, $retmsg, $name, $opt, @$a);
|
||||
|
@ -4,9 +4,9 @@
|
||||
#
|
||||
# $Id: 88_HMCCUDEV.pm 18552 2019-02-10 11:52:28Z zap $
|
||||
#
|
||||
# Version 4.4.040
|
||||
# Version 4.4.045
|
||||
#
|
||||
# (c) 2020 zap (zap01 <at> t-online <dot> de)
|
||||
# (c) 2021 zap (zap01 <at> t-online <dot> de)
|
||||
#
|
||||
######################################################################
|
||||
# Client device for Homematic devices.
|
||||
@ -17,6 +17,7 @@ package main;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
# use Data::Dumper;
|
||||
use SetExtensions;
|
||||
|
||||
require "$attr{global}{modpath}/FHEM/88_HMCCU.pm";
|
||||
@ -52,8 +53,8 @@ sub HMCCUDEV_Initialize ($)
|
||||
'ccureadingformat:name,namelc,address,addresslc,datapoint,datapointlc '.
|
||||
'ccureadingname:textField-long ccuSetOnChange ccuReadingPrefix '.
|
||||
'ccuget:State,Value ccuscaleval ccuverify:0,1,2 disable:0,1 '.
|
||||
'hmstatevals:textField-long statevals substexcl substitute:textField-long statechannel '.
|
||||
'controlchannel stripnumber peer:textField-long traceFilter '.
|
||||
'hmstatevals:textField-long statevals substexcl substitute:textField-long statechannel statedatapoint '.
|
||||
'controlchannel controldatapoint stripnumber peer:textField-long traceFilter '.
|
||||
$readingFnAttributes;
|
||||
}
|
||||
|
||||
@ -66,9 +67,8 @@ sub HMCCUDEV_Define ($@)
|
||||
my ($hash, $a, $h) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
my $usage = "Usage: define $name HMCCUDEV {device|'virtual'} [control-channel] ".
|
||||
"['readonly'] ['noDefaults'|'defaults'] [force] [iodev={iodev-name}] [address={virtual-device-no}]".
|
||||
"[{groupexp=regexp|group={device|channel}[,...]]";
|
||||
my $usage = "Usage: define $name HMCCUDEV device [control-channel] ".
|
||||
"['readonly'] ['noDefaults'|'defaults'] [forceDev] [iodev={iodev-name}]";
|
||||
return $usage if (scalar(@$a) < 3);
|
||||
|
||||
my @errmsg = (
|
||||
@ -85,12 +85,19 @@ sub HMCCUDEV_Define ($@)
|
||||
|
||||
my @warnmsg = (
|
||||
"OK",
|
||||
"Control channel ambiguous. Please specify control channel in device definition or attribute controldatapoint"
|
||||
"Control channel ambiguous. You can change the default control channel in device definition or with attribute controldatapoint",
|
||||
"Device type not known by HMCCU. Please set control and/or state channel with attributes controldatapoint and statedatapoint"
|
||||
);
|
||||
|
||||
my ($devname, $devtype, $devspec) = splice (@$a, 0, 3);
|
||||
my $ioHash = undef;
|
||||
|
||||
# Handle some legacy options
|
||||
return 'Virtual devices are no longer supported. Use FHEM built in features like readingsgroup or structure'
|
||||
if ($devspec eq 'virtual');
|
||||
HMCCU_Log ($hash, 2, "Found old device definition syntax using group or groupexp. Group options will be ignored in furture versions.")
|
||||
if (exists($h->{group}) || exists($h->{groupexp}));
|
||||
|
||||
# Store some definitions for delayed initialization
|
||||
$hash->{readonly} = 'no';
|
||||
$hash->{hmccu}{devspec} = $devspec;
|
||||
@ -100,20 +107,12 @@ sub HMCCUDEV_Define ($@)
|
||||
$hash->{hmccu}{semDefaults} = 0;
|
||||
$hash->{hmccu}{forcedev} = 0;
|
||||
|
||||
if (exists($h->{address})) {
|
||||
return 'Option address not allowed' if ($init_done || $devspec ne 'virtual');
|
||||
$hash->{hmccu}{address} = $h->{address};
|
||||
}
|
||||
else {
|
||||
return 'Option address not specified' if (!$init_done && $devspec eq 'virtual');
|
||||
}
|
||||
|
||||
# Parse optional command line parameters
|
||||
foreach my $arg (@$a) {
|
||||
if ($arg eq 'readonly') { $hash->{readonly} = 'yes'; }
|
||||
if (lc($arg) eq 'readonly') { $hash->{readonly} = 'yes'; }
|
||||
elsif (lc($arg) eq 'nodefaults' && $init_done) { $hash->{hmccu}{nodefaults} = 1; }
|
||||
elsif ($arg eq 'defaults' && $init_done) { $hash->{hmccu}{nodefaults} = 0; }
|
||||
elsif ($arg eq 'force') { $hash->{hmccu}{forcedev} = 1; }
|
||||
elsif (lc($arg) eq 'defaults' && $init_done) { $hash->{hmccu}{nodefaults} = 0; }
|
||||
elsif (lc($arg) eq 'forcedev') { $hash->{hmccu}{forcedev} = 1; }
|
||||
elsif ($arg =~ /^[0-9]+$/) { $attr{$name}{controlchannel} = $arg; }
|
||||
else { return $usage; }
|
||||
}
|
||||
@ -180,34 +179,7 @@ sub HMCCUDEV_InitDevice ($$)
|
||||
my $gdcount = 0;
|
||||
my $gdname = $devspec;
|
||||
|
||||
if ($devspec eq 'virtual') {
|
||||
my $no = 0;
|
||||
if (exists($devHash->{hmccu}{address})) {
|
||||
# Only true during FHEM start
|
||||
$no = $devHash->{hmccu}{address};
|
||||
}
|
||||
else {
|
||||
# Search for free address. Maximum of 10000 virtual devices allowed.
|
||||
for (my $i=1; $i<=10000; $i++) {
|
||||
my $va = sprintf ("VIR%07d", $i);
|
||||
if (!HMCCU_IsValidDevice ($ioHash, $va, 1)) {
|
||||
$no = $i;
|
||||
last;
|
||||
}
|
||||
}
|
||||
return 7 if ($no == 0);
|
||||
$devHash->{DEF} .= " address=$no";
|
||||
}
|
||||
|
||||
# Inform HMCCU device about client device
|
||||
return 2 if (!HMCCU_AssignIODevice ($devHash, $ioHash->{NAME}));
|
||||
|
||||
$devHash->{ccuif} = 'fhem';
|
||||
$devHash->{ccuaddr} = sprintf ("VIR%07d", $no);
|
||||
$devHash->{ccuname} = $name;
|
||||
$devHash->{ccudevstate} = 'active';
|
||||
}
|
||||
else {
|
||||
# Check if device is valid
|
||||
return 1 if (!HMCCU_IsValidDevice ($ioHash, $devspec, 7));
|
||||
|
||||
my ($di, $da, $dn, $dt, $dc) = HMCCU_GetCCUDeviceParam ($ioHash, $devspec);
|
||||
@ -228,7 +200,7 @@ sub HMCCUDEV_InitDevice ($$)
|
||||
if ($init_done) {
|
||||
# Initialize user attributes
|
||||
my $detect = HMCCU_DetectDevice ($ioHash, $da, $di);
|
||||
return "Specify option 'force' for HMCCUDEV or use HMCCUCHN instead (recommended). Command: define $name HMCCUCHN $detect->{defAdd}"
|
||||
return "Specify option 'forceDev' for HMCCUDEV or use HMCCUCHN instead (recommended). Command: define $name HMCCUCHN $detect->{defAdd}"
|
||||
if (defined($detect) && $detect->{defMod} eq 'HMCCUCHN' && $devHash->{hmccu}{forcedev} == 0);
|
||||
|
||||
# Interactive device definition
|
||||
@ -237,27 +209,29 @@ sub HMCCUDEV_InitDevice ($$)
|
||||
HMCCU_UpdateDevice ($ioHash, $devHash);
|
||||
HMCCU_UpdateDeviceRoles ($ioHash, $devHash);
|
||||
|
||||
my ($sc, $sd, $cc, $cd, $sdCnt, $cdCnt) = HMCCU_GetSCDatapoints ($devHash);
|
||||
return -1 if ($cdCnt >= 2);
|
||||
return -2 if (!defined($detect) || $detect->{level} == 0); # Device not detected
|
||||
|
||||
HMCCU_UpdateRoleCommands ($ioHash, $devHash, $cc);
|
||||
HMCCU_UpdateAdditionalCommands ($ioHash, $devHash, $cc, $cd);
|
||||
if (!HMCCU_SetDefaultSCDatapoints ($ioHash, $devHash, $detect)) {
|
||||
HMCCU_Log ($devHash, 2, "Cannot set default state- and control datapoints");
|
||||
}
|
||||
|
||||
if (!exists($devHash->{hmccu}{nodefaults}) || $devHash->{hmccu}{nodefaults} == 0) {
|
||||
my $chn = $cc eq '' ? ($sc eq '' ? undef : $sc) : $cc;
|
||||
my $chn = $detect->{defCCh} != -1 ? $detect->{defCCh} : $detect->{defSCh};
|
||||
if (!HMCCU_SetDefaultAttributes ($devHash, {
|
||||
mode => 'update', role => undef, roleChn => $chn,
|
||||
})) {
|
||||
HMCCU_Log ($devHash, 2, "No role attributes found");
|
||||
HMCCU_Log ($devHash, 2, "No role attributes found for channel $chn");
|
||||
HMCCU_SetDefaults ($devHash);
|
||||
}
|
||||
}
|
||||
|
||||
HMCCU_GetUpdate ($devHash, $da, 'Value');
|
||||
}
|
||||
|
||||
return -1 if ($detect->{level} == 2); # More than 1 control channel
|
||||
}
|
||||
|
||||
# Parse group options
|
||||
if ($devHash->{ccuif} eq 'VirtualDevices' || $devHash->{ccuif} eq 'fhem') {
|
||||
if ($devHash->{ccuif} eq 'VirtualDevices') {
|
||||
my @devlist = ();
|
||||
if (exists ($devHash->{hmccu}{groupexp})) {
|
||||
# Group devices specified by name expression
|
||||
@ -284,32 +258,6 @@ sub HMCCUDEV_InitDevice ($$)
|
||||
return 3 if ($gdcount == 0);
|
||||
|
||||
$devHash->{ccugroup} = join (',', @devlist);
|
||||
if ($devspec eq 'virtual') {
|
||||
my $dev = shift @devlist;
|
||||
my $devtype = HMCCU_GetDeviceType ($ioHash, $dev, 'n/a');
|
||||
my $devna = $devtype eq 'n/a' ? 1 : 0;
|
||||
for my $d (@devlist) {
|
||||
if (HMCCU_GetDeviceType ($ioHash, $d, 'n/a') ne $devtype) {
|
||||
$devna = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my $rc = 0;
|
||||
if ($devna) {
|
||||
$devHash->{ccutype} = 'n/a';
|
||||
$devHash->{readonly} = 'yes';
|
||||
$rc = HMCCU_CreateDevice ($ioHash, $devHash->{ccuaddr}, $name, undef, $dev);
|
||||
}
|
||||
else {
|
||||
$devHash->{ccutype} = $devtype;
|
||||
$rc = HMCCU_CreateDevice ($ioHash, $devHash->{ccuaddr}, $name, $devtype, $dev);
|
||||
}
|
||||
return $rc+4 if ($rc > 0);
|
||||
|
||||
# Set default attributes
|
||||
$attr{$name}{ccureadingformat} = 'name';
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -325,7 +273,6 @@ sub HMCCUDEV_Undef ($$)
|
||||
|
||||
if ($hash->{IODev}) {
|
||||
HMCCU_RemoveDevice ($hash->{IODev}, $hash->{ccuif}, $hash->{ccuaddr}, $hash->{NAME});
|
||||
HMCCU_DeleteDevice ($hash->{IODev}) if ($hash->{ccuif} eq 'fhem');
|
||||
}
|
||||
|
||||
return undef;
|
||||
@ -364,8 +311,22 @@ sub HMCCUDEV_Attr ($@)
|
||||
return "Device is read only" if ($clHash->{readonly} eq 'yes');
|
||||
}
|
||||
elsif ($attrname =~ /^(state|control)(channel|datapoint)$/) {
|
||||
return "Invalid value $attrval"
|
||||
if (!HMCCU_SetSCDatapoints ($clHash, $attrname, $attrval));
|
||||
my $chn = $attrval;
|
||||
if ($attrname eq 'statedatapoint' || $attrname eq 'controldatapoint') {
|
||||
if ($attrval =~ /^([0-9]{1,2})\.(.+)$/) {
|
||||
$chn = $1;
|
||||
}
|
||||
else {
|
||||
return "Attribute value must be in format channel.datapoint";
|
||||
}
|
||||
}
|
||||
else {
|
||||
return "Attribute value must be a valid channel number" if (!HMCCU_IsIntNum ($attrval));
|
||||
$chn = $attrval;
|
||||
}
|
||||
|
||||
my $role = HMCCU_GetChannelRole ($clHash, $chn);
|
||||
return "Invalid value $attrval" if (!HMCCU_SetSCDatapoints ($clHash, $attrname, $attrval, $role));
|
||||
if ($init_done && exists($clHash->{hmccu}{control}{chn}) && $clHash->{hmccu}{control}{chn} ne '') {
|
||||
HMCCU_UpdateRoleCommands ($ioHash, $clHash, $clHash->{hmccu}{control}{chn});
|
||||
HMCCU_UpdateAdditionalCommands ($ioHash, $clHash, $clHash->{hmccu}{control}{chn}, $clHash->{hmccu}{control}{dpt})
|
||||
@ -380,18 +341,13 @@ sub HMCCUDEV_Attr ($@)
|
||||
delete $clHash->{hmccu}{roleCmds}
|
||||
if (exists($clHash->{hmccu}{roleCmds}) &&
|
||||
(!exists($clHash->{hmccu}{control}{chn}) || $clHash->{hmccu}{control}{chn} eq ''));
|
||||
if ($init_done) {
|
||||
if (!HMCCU_SetDefaultSCDatapoints ($ioHash, $clHash)) {
|
||||
HMCCU_Log ($clHash, 2, "Cannot set default state- and control datapoints");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# if ($init_done && $attrname =~ /^(statechannel|controlchannel|statedatapoint|controldatapoint)$/) {
|
||||
# my ($sc, $sd, $cc, $cd, $sdCnt, $cdCnt) = HMCCU_GetSCDatapoints ($ioHash);
|
||||
# if ($cdCnt < 2) {
|
||||
# HMCCU_UpdateRoleCommands ($ioHash, $clHash, $cc);
|
||||
# HMCCU_UpdateAdditionalCommands ($ioHash, $clHash, $cc, $cd);
|
||||
# }
|
||||
# }
|
||||
|
||||
# HMCCU_RefreshReadings ($clHash) if ($init_done);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -470,7 +426,7 @@ sub HMCCUDEV_Set ($@)
|
||||
}
|
||||
elsif ($lcopt eq 'defaults') {
|
||||
my $mode = shift @$a // 'update';
|
||||
$rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, ctrlChn => $cc });
|
||||
$rc = HMCCU_SetDefaultAttributes ($hash, { mode => $mode, role => undef, roleChn => $cc });
|
||||
$rc = HMCCU_SetDefaults ($hash) if (!$rc);
|
||||
HMCCU_RefreshReadings ($hash) if ($rc);
|
||||
return HMCCU_SetError ($hash, $rc == 0 ? 'No default attributes found' : 'OK');
|
||||
@ -478,13 +434,14 @@ sub HMCCUDEV_Set ($@)
|
||||
else {
|
||||
my $retmsg = 'clear defaults:reset,update';
|
||||
|
||||
my @dpRList = ();
|
||||
my $dpRCount = HMCCU_GetValidDatapoints ($hash, $hash->{ccutype}, -1, 5, \@dpRList);
|
||||
$retmsg .= ' readingFilter:multiple-strict,'.join(',', @dpRList) if ($dpRCount > 0);
|
||||
|
||||
if ($hash->{readonly} ne 'yes') {
|
||||
$retmsg .= ' config';
|
||||
my $dpCount = HMCCU_GetValidDatapoints ($hash, $hash->{ccutype}, -1, 2);
|
||||
$retmsg .= ' datapoint' if ($dpCount > 0);
|
||||
my @dpList = ();
|
||||
$dpCount = HMCCU_GetValidDatapoints ($hash, $hash->{ccutype}, -1, 5, \@dpList);
|
||||
$retmsg .= ' readingFilter:multiple-strict,'.join(',', @dpList) if ($dpCount > 0);
|
||||
my $dpWCount = HMCCU_GetValidDatapoints ($hash, $hash->{ccutype}, -1, 2);
|
||||
$retmsg .= ' datapoint' if ($dpWCount > 0);
|
||||
$retmsg .= " $cmdList" if ($cmdList ne '');
|
||||
}
|
||||
# return AttrTemplate_Set ($hash, $retmsg, $name, $opt, @$a);
|
||||
@ -524,10 +481,6 @@ sub HMCCUDEV_Get ($@)
|
||||
# Get additional commands
|
||||
my $cmdList = $hash->{hmccu}{cmdlist}{get} // '';
|
||||
|
||||
# Virtual devices only support command get update
|
||||
return "HMCCUDEV: Unknown argument $opt, choose one of update:noArg"
|
||||
if ($ccuif eq 'fhem' && $opt ne 'update');
|
||||
|
||||
my $result = '';
|
||||
my $rc;
|
||||
|
||||
@ -609,27 +562,18 @@ sub HMCCUDEV_Get ($@)
|
||||
<a name="HMCCUDEVdefine"></a>
|
||||
<b>Define</b><br/><br/>
|
||||
<ul>
|
||||
<code>define <name> HMCCUDEV {<device> | 'virtual'} [<controlchannel>]
|
||||
[readonly] [<u>defaults</u>|noDefaults] [force] {group={device|channel}[,...]|groupexp=regexp]
|
||||
[iodev=<iodev-name>]</code>
|
||||
<code>define <name> HMCCUDEV <device> [<controlchannel>]
|
||||
[readonly] [<u>defaults</u>|noDefaults] [forceDev] [iodev=<iodev-name>]</code>
|
||||
<br/><br/>
|
||||
If option 'readonly' is specified no set command will be available. With option 'defaults'
|
||||
some default attributes depending on CCU device type will be set. Default attributes are only
|
||||
available for some device types. The option is ignored during FHEM start.
|
||||
Option 'force' must be specified to define a HMCCUDEV device even if the preferred and
|
||||
Option 'forceDev' must be specified to define a HMCCUDEV device even if the preferred and
|
||||
recommended type is HMCCUCHN.<br/>
|
||||
Parameter <i>controlchannel</i> corresponds to attribute 'controlchannel'. If a device
|
||||
has several identical channels, some commands need to know the channel number for
|
||||
controlling the device.<br/>
|
||||
A HMCCUDEV device supports CCU group devices. The CCU devices or channels related to a group
|
||||
device are specified by using options 'group' or 'groupexp' followed by the names or
|
||||
addresses of the CCU devices or channels. By using 'groupexp' one can specify a regular
|
||||
expression for CCU device or channel names. Since version 4.2.009 of HMCCU HMCCUDEV
|
||||
is able to detect members of group devices automatically. So options 'group' or
|
||||
'groupexp' are no longer necessary to define a group device.<br/>
|
||||
It's also possible to group any kind of CCU devices without defining a real group
|
||||
in CCU by using option 'virtual' instead of a CCU device specification.
|
||||
<br/><br/>
|
||||
<br/>
|
||||
Examples:<br/>
|
||||
<code>
|
||||
# Simple device by using CCU device name<br/>
|
||||
@ -638,8 +582,6 @@ sub HMCCUDEV_Get ($@)
|
||||
define temp_control HMCCUDEV BidCos-RF.LEQ1234567 1<br/>
|
||||
# Simple read only device by using CCU device address and with default attributes<br/>
|
||||
define temp_sensor HMCCUDEV BidCos-RF.LEQ2345678 1 readonly defaults
|
||||
# Group device by using CCU group device and 3 group members<br/>
|
||||
define heating_living HMCCUDEV GRP-LIV group=WIN-LIV,HEAT-LIV,THERM-LIV
|
||||
</code>
|
||||
<br/><br/>
|
||||
Internals:<br/>
|
||||
@ -843,7 +785,7 @@ sub HMCCUDEV_Get ($@)
|
||||
<a href="#HMCCUCHNattr">see HMCCUCHN</a>
|
||||
</li><br/>
|
||||
<li><b>peer [<datapoints>:<condition>:
|
||||
{ccu:<object>=<value>|hmccu:<object>=<value>|fhem:<command>}</b><br/>
|
||||
{ccu:<object>=<value>|hmccu:<object>=<value>}</b><br/>
|
||||
<a href="#HMCCUCHNattr">see HMCCUCHN</a>
|
||||
</li><br/>
|
||||
<li><b>statechannel <channel-number></b><br/>
|
||||
|
@ -4,11 +4,11 @@
|
||||
#
|
||||
# $Id: HMCCUConf.pm 18552 2019-02-10 11:52:28Z zap $
|
||||
#
|
||||
# Version 4.8.017
|
||||
# Version 4.8.025
|
||||
#
|
||||
# Configuration parameters for HomeMatic devices.
|
||||
#
|
||||
# (c) 2020 by zap (zap01 <at> t-online <dot> de)
|
||||
# (c) 2021 by zap (zap01 <at> t-online <dot> de)
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
@ -28,7 +28,7 @@ use vars qw(%HMCCU_CHN_DEFAULTS);
|
||||
use vars qw(%HMCCU_DEV_DEFAULTS);
|
||||
use vars qw(%HMCCU_SCRIPTS);
|
||||
|
||||
$HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
$HMCCU_CONFIG_VERSION = '4.8.025';
|
||||
|
||||
######################################################################
|
||||
# Map subtype to default role. Subtype is only available for HMIP
|
||||
@ -67,14 +67,26 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
'ALARM_SWITCH_VIRTUAL_RECEIVER' => {
|
||||
F => 3, S => 'ACOUSTIC_ALARM_ACTIVE', C => 'ACOUSTIC_ALARM_SELECTION', V => '', P => 2
|
||||
},
|
||||
'MOTIONDETECTOR_TRANSCEIVER' => {
|
||||
F => 3, S => 'MOTION', C => 'MOTION_DETECTION_ACTIVE', V => 'on:1,off:0', P => 2
|
||||
},
|
||||
'PRESENCEDETECTOR_TRANSCEIVER' => {
|
||||
F => 3, S => 'PRESENCE_DETECTION_STATE', C => 'PRESENCE_DETECTION_ACTIVE', V => 'on:1,off:0', P => 2
|
||||
},
|
||||
'SMOKE_DETECTOR' => {
|
||||
F => 3, S => 'SMOKE_DETECTOR_ALARM_STATUS', C => '', V => '', P => 2
|
||||
F => 3, S => 'BidCos-RF:STATE,SMOKE_DETECTOR_ALARM_STATUS', C => 'HmIP-RF:SMOKE_DETECTOR_COMMAND', V => '', P => 2
|
||||
},
|
||||
'LUXMETER' => {
|
||||
F => 3, S => 'LUX', C => '', V => '', P => 2
|
||||
},
|
||||
'MOTIONDETECTOR_TRANSCEIVER' => {
|
||||
F => 3, S => 'MOTION', C => 'MOTION_DETECTION_ACTIVE', V => 'on:true,off:false', P => 2
|
||||
'BRIGHTNESS_TRANSMITTER' => {
|
||||
F => 3, S => 'CURRENT_ILLUMINATION', C => '', V => '', P => 2
|
||||
},
|
||||
'POWERMETER' => {
|
||||
F => 3, S => 'CURRENT', C => '', V => '', P => 1
|
||||
},
|
||||
'ENERGIE_METER_TRANSMITTER' => {
|
||||
F => 3, S => 'CURRENT', C => '', V => '', P => 1
|
||||
},
|
||||
'KEY' => {
|
||||
F => 3, S => 'PRESS_SHORT', C => 'PRESS_SHORT', V => 'pressed:true', P => 1
|
||||
@ -91,6 +103,9 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
'BLIND_VIRTUAL_RECEIVER' => {
|
||||
F => 3, S => 'LEVEL', C => 'LEVEL', V => 'open:100,close:0', P => 2
|
||||
},
|
||||
'SHUTTER_VIRTUAL_RECEIVER' => {
|
||||
F => 3, S => 'LEVEL', C => 'LEVEL', V => 'open:100,close:0', P => 2
|
||||
},
|
||||
'SWITCH' => {
|
||||
F => 3, S => 'STATE', C => 'STATE', V => 'on:true,off:false', P => 2
|
||||
},
|
||||
@ -123,51 +138,59 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
},
|
||||
'HEATING_CLIMATECONTROL_TRANSCEIVER' => {
|
||||
F => 3, S => 'ACTUAL_TEMPERATURE', C => 'SET_POINT_TEMPERATURE', V => 'on:30.5,off:4.5', P => 2
|
||||
},
|
||||
'CLIMATECONTROL_REGULATOR' => {
|
||||
F => 3, S => 'LEVEL', C => 'SETPOINT', V => 'on:30.5,off:4.5', P => 2
|
||||
}
|
||||
);
|
||||
|
||||
######################################################################
|
||||
# Add or rename readings
|
||||
# SC# = Placeholder for state channel
|
||||
# CC# = Placeholder for control channel
|
||||
# C# = Placeholder for state or control channel number
|
||||
# DEFAULT should not be used, if a HMCCUDEV device has multiple
|
||||
# channels with identical datapoints (i.e. LEVEL)
|
||||
######################################################################
|
||||
|
||||
%HMCCU_READINGS = (
|
||||
'BLIND' =>
|
||||
'(CC#\.)?LEVEL$:+pct;(CC#\.)?LEVEL$:+pct',
|
||||
'(C#\.)?LEVEL$:+pct',
|
||||
'BLIND_VIRTUAL_RECEIVER' =>
|
||||
'(CC#\.)?LEVEL$:+pct;(CC#\.)?LEVEL$:+pct',
|
||||
'(C#\.)?LEVEL$:+pct',
|
||||
'SHUTTER_VIRTUAL_RECEIVER' =>
|
||||
'(C#\.)?LEVEL$:+pct',
|
||||
'DIMMER' =>
|
||||
'(CC#\.)?LEVEL$:+pct;(CC#\.)?LEVEL$:+pct',
|
||||
'(C#\.)?LEVEL$:+pct',
|
||||
'DIMMER_VIRTUAL_RECEIVER' =>
|
||||
'(CC#\.)?LEVEL$:+pct;(CC#\.)?LEVEL$:+pct',
|
||||
'(C#\.)?LEVEL$:+pct',
|
||||
'PRESENCEDETECTOR_TRANSCEIVER' =>
|
||||
'(C#\.)?ILLUMINATION:brightness;(C#\.)?PRESENCE_DETECTION_STATE:presence',
|
||||
'WEATHER' =>
|
||||
'(SC#\.)?TEMPERATURE$:+measured-temp;'.
|
||||
'(SC#\.)?HUMIDITY$:+humidity',
|
||||
'(C#\.)?TEMPERATURE$:+measured-temp;'.
|
||||
'(C#\.)?HUMIDITY$:+humidity',
|
||||
'WEATHER_TRANSMIT' =>
|
||||
'(SC#\.)?TEMPERATURE$:+measured-temp;'.
|
||||
'(SC#\.)?HUMIDITY$:+humidity',
|
||||
'(C#\.)?TEMPERATURE$:+measured-temp;'.
|
||||
'(C#\.)?HUMIDITY$:+humidity',
|
||||
'CLIMATE_TRANSCEIVER' =>
|
||||
'(SC#\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'(SC#\.)?ACTUAL_HUMIDITY$:+humidity',
|
||||
'(C#\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'(C#\.)?ACTUAL_HUMIDITY$:+humidity',
|
||||
'THERMALCONTROL_TRANSMIT' =>
|
||||
'(SC#\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'(SC#\.)?ACTUAL_HUMIDITY$:+humidity;'.
|
||||
'(CC#\.)?SET_TEMPERATURE$:+desired-temp',
|
||||
'(C#\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'(C#\.)?ACTUAL_HUMIDITY$:+humidity;'.
|
||||
'(C#\.)?SET_TEMPERATURE$:+desired-temp',
|
||||
'CLIMATECONTROL_RT_TRANSCEIVER' =>
|
||||
'(SC#\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'(SC#\.)?ACTUAL_HUMIDITY$:+humidity;'.
|
||||
'(CC#\.)?SET_TEMPERATURE$:+desired-temp',
|
||||
'(C#\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'(C#\.)?ACTUAL_HUMIDITY$:+humidity;'.
|
||||
'(C#\.)?SET_TEMPERATURE$:+desired-temp',
|
||||
'HEATING_CLIMATECONTROL_TRANSCEIVER' =>
|
||||
'(SC#\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'(SC#\.)?ACTUAL_HUMIDITY$:+humidity;'.
|
||||
'(CC#\.)?SET_POINT_TEMPERATURE$:+desired-temp',
|
||||
'(C#\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'(C#\.)?ACTUAL_HUMIDITY$:+humidity;'.
|
||||
'(C#\.)?SET_POINT_TEMPERATURE$:+desired-temp',
|
||||
'CLIMATECONTROL_REGULATOR' =>
|
||||
'(C#\.)?SETPOINT$:+desired-temp',
|
||||
'DEFAULT' =>
|
||||
'([0-9]{1,2}\.)?LEVEL$:+pct;'.
|
||||
'([0-9]{1,2}\.)?SET_TEMPERATURE$:+desired-temp;'.
|
||||
'([0-9]{1,2}\.)?ACTUAL_TEMPERATURE$:+measured-temp;'.
|
||||
'^([0-9]{1,2}\.)?(ACTUAL_TEMPERATURE|TEMPERATURE)$:+measured-temp;'.
|
||||
'([0-9]{1,2}\.)?SET_POINT_TEMPERATURE$:+desired-temp;'.
|
||||
'([0-9]{1,2}\.)?ACTUAL_HUMIDITY$:+humidity'
|
||||
);
|
||||
@ -176,7 +199,7 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
# Set commands related to channel role
|
||||
# Role => { Command-Definition, ... }
|
||||
# Command-Defintion:
|
||||
# Command => 'Datapoint-Definition[:Function] [...]'
|
||||
# Command[:InterfaceExpr] => 'Datapoint-Definition[:Function] [...]'
|
||||
# Function:
|
||||
# A Perl function name
|
||||
# Datapoint-Definition:
|
||||
@ -198,8 +221,13 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
|
||||
%HMCCU_ROLECMDS = (
|
||||
'MOTIONDETECTOR_TRANSCEIVER' => {
|
||||
'on' => 'V:MOTION_DETECTION_ACTIVE:active=1',
|
||||
'off' => 'V:MOTION_DETECTION_ACTIVE:active=0'
|
||||
'on' => 'V:MOTION_DETECTION_ACTIVE:1',
|
||||
'off' => 'V:MOTION_DETECTION_ACTIVE:0'
|
||||
},
|
||||
'PRESENCEDETECTOR_TRANSCEIVER' => {
|
||||
'on' => 'V:PRESENCE_DETECTION_ACTIVE:1',
|
||||
'off' => 'V:PRESENCE_DETECTION_ACTIVE:0',
|
||||
'reset' => 'V:RESET_PRESENCE:1'
|
||||
},
|
||||
'SMOKE_DETECTOR' => {
|
||||
'command' => 'V:SMOKE_DETECTOR_COMMAND:#command'
|
||||
@ -292,8 +320,8 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
'off' => 'V:MANU_MODE:4.5',
|
||||
'auto' => 'V:AUTO_MODE:1',
|
||||
'boost' => 'V:BOOST_MODE:1',
|
||||
'week-program' => 'D:WEEK_PROGRAM_POINTER:#program',
|
||||
'get week-program' => 'D:WEEK_PROGRAM_POINTER:#program:HMCCU_DisplayWeekProgram'
|
||||
'week-program:VirtualDevices' => 'D:WEEK_PROGRAM_POINTER:#program',
|
||||
'get week-program:VirtualDevices' => 'D:WEEK_PROGRAM_POINTER:#program:HMCCU_DisplayWeekProgram'
|
||||
},
|
||||
'HEATING_CLIMATECONTROL_TRANSCEIVER' => {
|
||||
'desired-temp' => 'V:SET_POINT_TEMPERATURE:?temperature',
|
||||
@ -303,6 +331,11 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
'boost' => 'V:BOOST_MODE:1',
|
||||
'on' => 'V:CONTROL_MODE:1 V:SET_POINT_TEMPERATURE:30.5',
|
||||
'off' => 'V:CONTROL_MODE:1 V:SET_POINT_TEMPERATURE:4.5'
|
||||
},
|
||||
'CLIMATECONTROL_REGULATOR' => {
|
||||
'desired-temp' => 'V:SETPOINT:?temperature',
|
||||
'on' => 'V:SETPOINT:30.5',
|
||||
'off' => 'V:SETPOINT:4.5'
|
||||
}
|
||||
);
|
||||
|
||||
@ -318,13 +351,19 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
'SHUTTER_CONTACT_TRANSCEIVER' => {
|
||||
'_none_' => ''
|
||||
},
|
||||
'MOTIONDETECTOR_TRANSCEIVER' => {
|
||||
'cmdIcon' => 'on:general_an off:general_aus'
|
||||
},
|
||||
'PRESENCEDETECTOR_TRANSCEIVER' => {
|
||||
'cmdIcon' => 'on:general_an off:general_aus'
|
||||
},
|
||||
'KEY' => {
|
||||
'event-on-update-reading' => '.*',
|
||||
'event-on-update-reading' => 'PRESS.*',
|
||||
'cmdIcon' => 'press:taster',
|
||||
'webCmd' => 'press'
|
||||
},
|
||||
'KEY_TRANSCEIVER' => {
|
||||
'event-on-update-reading' => '.*',
|
||||
'event-on-update-reading' => 'PRESS.*',
|
||||
'cmdIcon' => 'press:taster',
|
||||
'webCmd' => 'press'
|
||||
},
|
||||
@ -381,17 +420,31 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
'cmdIcon' => 'auto:sani_heating_automatic manu:sani_heating_manual boost:sani_heating_boost on:general_an off:general_aus',
|
||||
'webCmd' => 'desired-temp:auto:manu:boost:on:off',
|
||||
'widgetOverride' => 'desired-temp:slider,4.5,0.5,30.5,1'
|
||||
},
|
||||
'CLIMATECONTROL_REGULATOR' => {
|
||||
'substexcl' => 'desired-temp',
|
||||
'cmdIcon' => 'on:general_an off:general_aus',
|
||||
'webCmd' => 'desired-temp:on:off',
|
||||
'widgetOverride' => 'desired-temp:slider,4.5,0.5,30.5,1'
|
||||
}
|
||||
);
|
||||
|
||||
######################################################################
|
||||
# Value conversions
|
||||
# Role => {
|
||||
# Datapoint => { Value => 'Conversion', ... },
|
||||
# ...
|
||||
# }
|
||||
######################################################################
|
||||
|
||||
%HMCCU_CONVERSIONS = (
|
||||
'MOTIONDETECTOR_TRANSCEIVER' => {
|
||||
'MOTION' => { '0' => 'noMotion', 'false' => 'noMotion', '1' => 'motion', 'true' => 'motion' },
|
||||
},
|
||||
'PRESENCEDETECTOR_TRANSCEIVER' => {
|
||||
'PRESENCE_DETECTION_STATE' => { '0' => 'noPresence', 'false' => 'noPresence', '1' => 'presence', 'true' => 'presence' },
|
||||
'PRESENCE_DETECTION_ACTIVE' => { '0' => 'off', 'false' => 'off', '1' => 'on', 'true', 'on' }
|
||||
},
|
||||
'KEY' => {
|
||||
'PRESS_SHORT' => { '1' => 'pressed', 'true' => 'pressed' },
|
||||
'PRESS_LONG' => { '1' => 'pressed', 'true' => 'pressed' }
|
||||
@ -460,8 +513,12 @@ $HMCCU_CONFIG_VERSION = '4.8.017';
|
||||
},
|
||||
'HEATING_CLIMATECONTROL_TRANSCEIVER' => {
|
||||
'SET_POINT_TEMPERATURE' => { '4.5' => 'off', '30.5' => 'on' },
|
||||
'SET_POINT_MODE' => { '0' => 'auto', '1' => 'manual', '2' => 'boost', '3' => 'off' },
|
||||
'WINDOW_STATE' => { '0' => 'closed', '1' => 'open', 'false' => 'closed', 'true' => 'open' }
|
||||
},
|
||||
'CLIMATECONTROL_REGULATOR' => {
|
||||
'SETPOINT' => { '4.5' => 'off', '30.5' => 'on' }
|
||||
},
|
||||
'DEFAULT' => {
|
||||
'AES_KEY' => { '0' => 'off', 'false' => 'off', '1' => 'on', 'true' => 'on' },
|
||||
'LOW_BAT' => { '0' => 'ok', 'false' => 'ok', '1' => 'low', 'true' => 'low' },
|
||||
@ -1642,6 +1699,9 @@ string chnid;
|
||||
string sDPId;
|
||||
object odev = (dom.GetObject(ID_DEVICES)).Get("\$devname");
|
||||
if (odev) {
|
||||
string intid=odev.Interface();
|
||||
string intna=dom.GetObject(intid).Name();
|
||||
WriteLine ("D;" # intna # ";" # odev.Address() # ";" # odev.Name() # ";" # odev.HssType());
|
||||
foreach (chnid, odev.Channels()) {
|
||||
object ochn = dom.GetObject(chnid);
|
||||
if (ochn) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
UPD 2020-12-30_19:07:35 102657 FHEM/88_HMCCURPCPROC.pm
|
||||
UPD 2021-01-17_13:14:22 78455 FHEM/HMCCUConf.pm
|
||||
UPD 2021-01-17_13:14:07 42113 FHEM/88_HMCCUCHN.pm
|
||||
UPD 2021-01-17_13:13:53 323775 FHEM/88_HMCCU.pm
|
||||
UPD 2021-01-17_13:14:00 33721 FHEM/88_HMCCUDEV.pm
|
||||
UPD 2021-04-09_14:16:13 102657 FHEM/88_HMCCURPCPROC.pm
|
||||
UPD 2021-04-09_14:16:13 80676 FHEM/HMCCUConf.pm
|
||||
UPD 2021-04-09_14:16:13 42605 FHEM/88_HMCCUCHN.pm
|
||||
UPD 2021-04-09_14:16:13 331948 FHEM/88_HMCCU.pm
|
||||
UPD 2021-04-09_14:16:13 31582 FHEM/88_HMCCUDEV.pm
|
||||
|
Loading…
x
Reference in New Issue
Block a user