mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-25 22:09:21 +00:00
HMCCU: New datapoint based calculation modes
git-svn-id: https://svn.fhem.de/fhem/trunk@14158 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d0d429fce1
commit
6a65dd90d4
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
# Version 4.0.001
|
# Version 4.0.002
|
||||||
#
|
#
|
||||||
# (c) 2017 zap (zap01 <at> t-online <dot> de)
|
# (c) 2017 zap (zap01 <at> t-online <dot> de)
|
||||||
#
|
#
|
||||||
@ -51,7 +51,7 @@
|
|||||||
# attr <name> substitute <subst-rule>[;...]
|
# attr <name> substitute <subst-rule>[;...]
|
||||||
#
|
#
|
||||||
################################################################
|
################################################################
|
||||||
# Requires module 88_HMCCU.pm
|
# Requires modules 88_HMCCU.pm, HMCCUConf.pm
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
@ -756,13 +756,18 @@ sub HMCCUCHN_Get ($@)
|
|||||||
If set to 1 state will be set to result of command (i.e. 'OK'). Otherwise state is only
|
If set to 1 state will be set to result of command (i.e. 'OK'). Otherwise state is only
|
||||||
updated if value of state datapoint has changed.
|
updated if value of state datapoint has changed.
|
||||||
</li><br/>
|
</li><br/>
|
||||||
<li><b>ccucalculate <value>:<reading>[:<dp-list>[;...]</b><br/>
|
<li><b>ccucalculate <value-type>:<reading>[:<dp-list>[;...]</b><br/>
|
||||||
Calculate special values like dewpoint based on datapoints specified in
|
Calculate special values like dewpoint based on datapoints specified in
|
||||||
<i>dp-list</i>. The result is stored in <i>reading</i>. The following <i>values</i>
|
<i>dp-list</i>. The result is stored in <i>reading</i>. The following <i>values</i>
|
||||||
are supported:<br/>
|
are supported:<br/>
|
||||||
dewpoint = calculate dewpoint, <i>dp-list</i> = <temperature>,<humidity><br/>
|
dewpoint = calculate dewpoint, <i>dp-list</i> = <temperature>,<humidity><br/>
|
||||||
abshumidity = calculate absolute humidity, <i>dp-list</i> = <temperature>,
|
abshumidity = calculate absolute humidity, <i>dp-list</i> = <temperature>,<humidity><br/>
|
||||||
<humidity><br/>
|
inc = increment datapoint value considering reset of datapoint, <i>dp-list</i> = <counter-datapoint><br/>
|
||||||
|
inc = increment datapoint value considering reset of datapoint, <i>dp-list</i> = <counter-datapoint><br/>
|
||||||
|
min = calculate minimum continuously, <i>dp-list</i> = <datapoint><br/>
|
||||||
|
max = calculate maximum continuously, <i>dp-list</i> = <datapoint><br/>
|
||||||
|
sum = calculate sum continuously, <i>dp-list</i> = <datapoint><br/>
|
||||||
|
avg = calculate average continuously, <i>dp-list</i> = <datapoint>
|
||||||
Example:<br/>
|
Example:<br/>
|
||||||
<code>dewpoint:taupunkt:1.TEMPERATURE,1.HUMIDITY</code>
|
<code>dewpoint:taupunkt:1.TEMPERATURE,1.HUMIDITY</code>
|
||||||
</li><br/>
|
</li><br/>
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#####################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# 88_HMCCUDEV.pm
|
# 88_HMCCUDEV.pm
|
||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
# Version 4.0.001
|
# Version 4.0.002
|
||||||
#
|
#
|
||||||
# (c) 2017 zap (zap01 <at> t-online <dot> de)
|
# (c) 2017 zap (zap01 <at> t-online <dot> de)
|
||||||
#
|
#
|
||||||
#####################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# define <name> HMCCUDEV {<ccudev>|virtual} [<statechannel>] [readonly] [defaults]
|
# define <name> HMCCUDEV {<ccudev>|virtual} [<statechannel>] [readonly] [defaults]
|
||||||
# [{group={<device>|<channel>}[,...]|groupexp=<regexp>}] [iodev=<iodevname>]
|
# [{group={<device>|<channel>}[,...]|groupexp=<regexp>}] [iodev=<iodevname>]
|
||||||
@ -37,6 +37,7 @@
|
|||||||
# attr <name> ccucalculate <value>:<reading>[:<dp-list>][...]
|
# attr <name> ccucalculate <value>:<reading>[:<dp-list>][...]
|
||||||
# attr <name> ccuflags { altread, nochn0, trace }
|
# attr <name> ccuflags { altread, nochn0, trace }
|
||||||
# attr <name> ccuget { State | Value }
|
# attr <name> ccuget { State | Value }
|
||||||
|
# attr <name> ccupeer [channel.]datapoint oper expr:{ hmccu:object=value | fhem:command }
|
||||||
# attr <name> ccureadings { 0 | 1 }
|
# attr <name> ccureadings { 0 | 1 }
|
||||||
# attr <name> ccureadingformat { address[lc] | name[lc] | datapoint[lc] }
|
# attr <name> ccureadingformat { address[lc] | name[lc] | datapoint[lc] }
|
||||||
# attr <name> ccureadingfilter <filter-rule>[,...]
|
# attr <name> ccureadingfilter <filter-rule>[,...]
|
||||||
@ -52,9 +53,9 @@
|
|||||||
# attr <name> substexcl <reading-expr>
|
# attr <name> substexcl <reading-expr>
|
||||||
# attr <name> substitute <subst-rule>[;...]
|
# attr <name> substitute <subst-rule>[;...]
|
||||||
#
|
#
|
||||||
#####################################################################
|
######################################################################
|
||||||
# Requires module 88_HMCCU
|
# Requires modules 88_HMCCU.pm, HMCCUConf.pm
|
||||||
#####################################################################
|
######################################################################
|
||||||
|
|
||||||
package main;
|
package main;
|
||||||
|
|
||||||
@ -84,7 +85,12 @@ sub HMCCUDEV_Initialize ($)
|
|||||||
$hash->{AttrFn} = "HMCCUDEV_Attr";
|
$hash->{AttrFn} = "HMCCUDEV_Attr";
|
||||||
$hash->{parseParams} = 1;
|
$hash->{parseParams} = 1;
|
||||||
|
|
||||||
$hash->{AttrList} = "IODev ccuackstate:0,1 ccucalculate ccuflags:multiple-strict,altread,nochn0,trace ccureadingfilter:textField-long ccureadingformat:name,namelc,address,addresslc,datapoint,datapointlc ccureadingname ccureadings:0,1 ccuget:State,Value ccuscaleval ccuverify:0,1,2 disable:0,1 hmstatevals:textField-long statevals substexcl substitute:textField-long statechannel statedatapoint controldatapoint stripnumber ". $readingFnAttributes;
|
$hash->{AttrList} = "IODev ccuackstate:0,1 ccucalculate:textField-long ".
|
||||||
|
"ccuflags:multiple-strict,altread,nochn0,trace ccureadingfilter:textField-long ".
|
||||||
|
"ccureadingformat:name,namelc,address,addresslc,datapoint,datapointlc ccureadingname ".
|
||||||
|
"ccureadings:0,1 ccuget:State,Value ccuscaleval ccuverify:0,1,2 disable:0,1 ".
|
||||||
|
"hmstatevals:textField-long statevals substexcl substitute:textField-long statechannel ".
|
||||||
|
"statedatapoint controldatapoint stripnumber ccupeer:textField-long ".$readingFnAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
@ -96,9 +102,10 @@ sub HMCCUDEV_Define ($@)
|
|||||||
my ($hash, $a, $h) = @_;
|
my ($hash, $a, $h) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
my $usage = "Usage: define $name HMCCUDEV {device|'virtual'} [state-channel] " .
|
my $usage = "Usage: define $name HMCCUDEV {device|'virtual'} [state-channel] ".
|
||||||
"['readonly'] ['defaults'] [iodev={iodev-name}] [{groupexp=regexp|group={device|channel}[,...]]";
|
"['readonly'] ['defaults'] [iodev={iodev-name}] ".
|
||||||
return $usage if (@$a < 3);
|
"[{groupexp=regexp|group={device|channel}[,...]]";
|
||||||
|
return $usage if (scalar (@$a) < 3);
|
||||||
|
|
||||||
my $devname = shift @$a;
|
my $devname = shift @$a;
|
||||||
my $devtype = shift @$a;
|
my $devtype = shift @$a;
|
||||||
@ -121,8 +128,7 @@ sub HMCCUDEV_Define ($@)
|
|||||||
foreach my $d (sort keys %defs) {
|
foreach my $d (sort keys %defs) {
|
||||||
my $ch = $defs{$d};
|
my $ch = $defs{$d};
|
||||||
next if (!exists ($ch->{TYPE}));
|
next if (!exists ($ch->{TYPE}));
|
||||||
next if ($ch->{TYPE} ne 'HMCCUDEV');
|
next if ($ch->{TYPE} ne 'HMCCUDEV' || $d eq $name);
|
||||||
next if ($d eq $name);
|
|
||||||
next if ($ch->{ccuif} ne 'VirtualDevices' || $ch->{ccuname} ne 'none');
|
next if ($ch->{ccuif} ne 'VirtualDevices' || $ch->{ccuname} ne 'none');
|
||||||
$no++;
|
$no++;
|
||||||
}
|
}
|
||||||
@ -905,12 +911,8 @@ sub HMCCUDEV_Get ($@)
|
|||||||
<li><b>ccuackstate {<u>0</u> | 1}</b><br/>
|
<li><b>ccuackstate {<u>0</u> | 1}</b><br/>
|
||||||
<a href="#HMCCUCHNattr">see HMCCUCHN</a>
|
<a href="#HMCCUCHNattr">see HMCCUCHN</a>
|
||||||
</li><br/>
|
</li><br/>
|
||||||
<li><b>ccucalculate <value>:<reading>[:<dp-list>[;...]</b><br/>
|
<li><b>ccucalculate <value-type>:<reading>[:<dp-list>[;...]</b><br/>
|
||||||
Calculate special values like dewpoint based on datapoints specified in
|
<a href="#HMCCUCHNattr">see HMCCUCHN</a>
|
||||||
<i>dp-list</i>. Datapoints in <i>dp-list</i> must be specified in format
|
|
||||||
<channelno>.<datapoint>. The result is stored in <i>reading</i>.
|
|
||||||
The following <i>values</i> are supported:<br/>
|
|
||||||
dewpoint = calculate dewpoint, <i>dp-list</i> = <temperature>,<humidity>
|
|
||||||
</li><br/>
|
</li><br/>
|
||||||
<li><b>ccuflags {nochn0, trace}</b><br/>
|
<li><b>ccuflags {nochn0, trace}</b><br/>
|
||||||
<a href="#HMCCUCHNattr">see HMCCUCHN</a>
|
<a href="#HMCCUCHNattr">see HMCCUCHN</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user