mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
Die changed to return, Power Limit decreased to 30kWh
git-svn-id: https://svn.fhem.de/fhem/trunk@72 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
83ff2cc59c
commit
3d296ad858
@ -53,7 +53,7 @@ EM_Define($$)
|
|||||||
|
|
||||||
Log 3, "EM opening device $dev";
|
Log 3, "EM opening device $dev";
|
||||||
my $po = new Device::SerialPort ($dev);
|
my $po = new Device::SerialPort ($dev);
|
||||||
return "Can't open $dev: $!\n" if(!$po);
|
return "Can't open $dev: $!" if(!$po);
|
||||||
Log 3, "EM opened device $dev";
|
Log 3, "EM opened device $dev";
|
||||||
$po->close();
|
$po->close();
|
||||||
|
|
||||||
@ -229,7 +229,10 @@ EmGetData($$)
|
|||||||
$d = EmMakeMsg(pack('H*', $d));
|
$d = EmMakeMsg(pack('H*', $d));
|
||||||
|
|
||||||
my $serport = new Device::SerialPort ($dev);
|
my $serport = new Device::SerialPort ($dev);
|
||||||
die "Can't open $dev: $!\n" if(!$serport);
|
if(!$serport) {
|
||||||
|
Log 1, "EM: Can't open $dev: $!";
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
$serport->reset_error();
|
$serport->reset_error();
|
||||||
$serport->baudrate(38400);
|
$serport->baudrate(38400);
|
||||||
$serport->databits(8);
|
$serport->databits(8);
|
||||||
@ -282,6 +285,7 @@ EmGetData($$)
|
|||||||
if(b($retval,1) != 0) { $rm = "EM Bad second byte"; goto DONE; }
|
if(b($retval,1) != 0) { $rm = "EM Bad second byte"; goto DONE; }
|
||||||
if(w($retval,2) != $l-7) { $rm = "EM Length mismatch"; goto DONE; }
|
if(w($retval,2) != $l-7) { $rm = "EM Length mismatch"; goto DONE; }
|
||||||
if(!EmCrcCheck($retval,$l-7)) { $rm = "EM Bad CRC"; goto DONE; }
|
if(!EmCrcCheck($retval,$l-7)) { $rm = "EM Bad CRC"; goto DONE; }
|
||||||
|
$serport->close();
|
||||||
return substr($retval, 4, $l-7);
|
return substr($retval, 4, $l-7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ EMWZ_GetStatus($)
|
|||||||
my $cur_energy = $pulses / $ec; # ec = U/kWh
|
my $cur_energy = $pulses / $ec; # ec = U/kWh
|
||||||
my $cur_power = $cur_energy / 5 * 60; # 5minute interval scaled to 1h
|
my $cur_power = $cur_energy / 5 * 60; # 5minute interval scaled to 1h
|
||||||
|
|
||||||
if($cur_power > 100) {
|
if($cur_power > 30) { # 20Amp x 3 Phase
|
||||||
my $msg = "EMWZ Bogus reading: curr. power is reported to be $cur_power";
|
my $msg = "EMWZ Bogus reading: curr. power is reported to be $cur_power";
|
||||||
Log GetLogLevel($name,2), $msg;
|
Log GetLogLevel($name,2), $msg;
|
||||||
return $msg;
|
return $msg;
|
||||||
|
@ -52,7 +52,7 @@ EMEM_GetStatus($)
|
|||||||
my $iec = 1000;
|
my $iec = 1000;
|
||||||
my $cur_power = $pulses / 100;
|
my $cur_power = $pulses / 100;
|
||||||
|
|
||||||
if($cur_power > 100) {
|
if($cur_power > 30) { # 20Amp x 3 Phase
|
||||||
my $msg = "EMEM Bogus reading: curr. power is reported to be $cur_power";
|
my $msg = "EMEM Bogus reading: curr. power is reported to be $cur_power";
|
||||||
Log GetLogLevel($name,2), $msg;
|
Log GetLogLevel($name,2), $msg;
|
||||||
return $msg;
|
return $msg;
|
||||||
|
Loading…
Reference in New Issue
Block a user