2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 05:06:35 +00:00

cum_kwh/cum_m3 by Peter

git-svn-id: https://svn.fhem.de/fhem/trunk@223 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2008-08-04 14:34:53 +00:00
parent 51d6e237c0
commit 41844a01ec
4 changed files with 19 additions and 21 deletions

View File

@ -420,3 +420,4 @@
- feature: 90_at is using now InternalTimer, subsecond precision added - feature: 90_at is using now InternalTimer, subsecond precision added
- feature: HMS100-FIT added (01.01.08 by Peter and 22.01.08 by Juergen) - feature: HMS100-FIT added (01.01.08 by Peter and 22.01.08 by Juergen)
- feature: 91_watchdog added to handle the HMS100-FIT - feature: 91_watchdog added to handle the HMS100-FIT
- feature: cum_kWh/cum_m3 added to EMWZ/EMGZ (11.01.08 by Peter)

View File

@ -76,6 +76,10 @@ EMWZ_GetStatus($)
$vals{"alarm_PA"} = w($d,45) . " Watt"; $vals{"alarm_PA"} = w($d,45) . " Watt";
$vals{"price_CF"} = sprintf("%.3f", w($d,47)/10000); $vals{"price_CF"} = sprintf("%.3f", w($d,47)/10000);
$vals{"RperKW_EC"} = $ec; $vals{"RperKW_EC"} = $ec;
$hash->{READINGS}{cum_kWh}{VAL} = 0 if(!$hash->{READINGS}{cum_kWh}{VAL});
$vals{"cum_kWh"} = sprintf("%0.3f",
$hash->{READINGS}{cum_kWh}{VAL} + $vals{"energy"});
my $tn = TimeNow(); my $tn = TimeNow();
my $idx = 0; my $idx = 0;

View File

@ -54,14 +54,8 @@ EMGZ_GetStatus($)
} }
my $pulses=w($d,13); my $pulses=w($d,13);
my $ec=w($d,49) / 10;
if($ec < 0) { # war <=
my $msg = "EMGZ read error (GetStatus 2)";
Log GetLogLevel($name,2), $msg;
return $msg;
}
$ec = 100; # fixed value my $ec = 100; # fixed value
my $cur_energy = $pulses / $ec; # ec = U/m^3 my $cur_energy = $pulses / $ec; # ec = U/m^3
my $cur_power = $cur_energy / 5 * 60; # 5minute interval scaled to 1h my $cur_power = $cur_energy / 5 * 60; # 5minute interval scaled to 1h
@ -75,10 +69,14 @@ EMGZ_GetStatus($)
my %vals; my %vals;
$vals{"5min_pulses"} = $pulses; $vals{"5min_pulses"} = $pulses;
$vals{"act_flow_m3"} = sprintf("%0.3f", $cur_energy); $vals{"act_flow_m3"} = sprintf("%0.3f", $cur_energy);
$vals{"m3ph"} = sprintf("%.3f", $cur_power); $vals{"m3ph"} = sprintf("%.3f", $cur_power);
$vals{"alarm_PA"} = w($d,45) . " Watt"; # nonsens $vals{"alarm_PA"} = w($d,45) . " Watt"; # nonsens
$vals{"price_CF"} = sprintf("%.3f", w($d,47)/10000); $vals{"price_CF"} = sprintf("%.3f", w($d,47)/10000);
$vals{"Rperm3_EC"} = $ec; $vals{"Rperm3_EC"} = $ec;
$hash->{READINGS}{cum_m3}{VAL} = 0 if(!$hash->{READINGS}{cum_m3}{VAL});
$vals{"cum_m3"} = sprintf("%0.3f",
$hash->{READINGS}{cum_m3}{VAL} + $vals{"act_flow_m3"});
my $tn = TimeNow(); my $tn = TimeNow();
my $idx = 0; my $idx = 0;
@ -125,7 +123,7 @@ EMGZ_Set($@)
{ {
my ($hash, @a) = @_; my ($hash, @a) = @_;
my $u = "Usage: set <name> <type> <value>, " . my $u = "Usage: set <name> <type> <value>, " .
"<type> is one of price,alarm,rperkw"; "<type> is price";
return $u if(int(@a) != 3); return $u if(int(@a) != 3);
@ -139,11 +137,6 @@ EMGZ_Set($@)
if($a[1] eq "price") { if($a[1] eq "price") {
$v *= 10000; # Make display and input the same $v *= 10000; # Make display and input the same
$msg = sprintf("79%02x2f02%02x%02x", $d-1, $v%256, int($v/256)); $msg = sprintf("79%02x2f02%02x%02x", $d-1, $v%256, int($v/256));
} elsif($a[1] eq "alarm") {
$msg = sprintf("79%02x2d02%02x%02x", $d-1, $v%256, int($v/256));
} elsif($a[1] eq "rperkw") {
$v *= 10; # Make display and input the same
$msg = sprintf("79%02x3102%02x%02x", $d-1, $v%256, int($v/256));
} else { } else {
return $u; return $u;
} }
@ -151,7 +144,7 @@ EMGZ_Set($@)
my $ret = IOWrite($hash, $msg); my $ret = IOWrite($hash, $msg);
if(!defined($ret)) { if(!defined($ret)) {
my $msg = "EMWZ $name read error (Set)"; $msg = "EMWZ $name read error (Set)";
Log GetLogLevel($name,2), $msg; Log GetLogLevel($name,2), $msg;
return $msg; return $msg;
} }

View File

@ -143,7 +143,7 @@ my $nextat; # Time when next timer will be triggered.
my $intAtCnt=0; my $intAtCnt=0;
my $reread_active = 0; my $reread_active = 0;
my $AttrList = "room comment"; my $AttrList = "room comment";
my $cvsid = '$Id: fhem.pl,v 1.50 2008-08-04 13:47:53 rudolfkoenig Exp $'; my $cvsid = '$Id: fhem.pl,v 1.51 2008-08-04 14:34:53 rudolfkoenig Exp $';
$init_done = 0; $init_done = 0;
@ -394,12 +394,12 @@ Log($$)
my $nfile = ResolveDateWildcards($attr{global}{logfile}, @t); my $nfile = ResolveDateWildcards($attr{global}{logfile}, @t);
OpenLogfile($nfile) if($currlogfile && $currlogfile ne $nfile); OpenLogfile($nfile) if($currlogfile && $currlogfile ne $nfile);
# my $tim = sprintf("%04d.%02d.%02d %02d:%02d:%02d", my $tim = sprintf("%04d.%02d.%02d %02d:%02d:%02d",
# $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0]); $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0]);
my ($seconds, $microseconds) = gettimeofday(); # my ($seconds, $microseconds) = gettimeofday();
my $tim = sprintf("%04d.%02d.%02d %02d:%02d:%02d.%03d", # my $tim = sprintf("%04d.%02d.%02d %02d:%02d:%02d.%03d",
$t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0], $microseconds/1000); # $t[5]+1900,$t[4]+1,$t[3], $t[2],$t[1],$t[0], $microseconds/1000);
if($logopened) { if($logopened) {
print LOG "$tim $loglevel: $text\n"; print LOG "$tim $loglevel: $text\n";