mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 04:36:36 +00:00
12_HProtocolGateway: moved strapping table csv file to attribute
git-svn-id: https://svn.fhem.de/fhem/trunk@18595 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0f4e37ab0b
commit
a3004feefd
@ -1,5 +1,6 @@
|
||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||
# Do not insert empty lines here, update check depends on it.
|
||||
- change: 12_HProtocolGateway: moved strapping table csv file to attribute
|
||||
- bugfix: 98_WeekdayTimer: restore old Revision; remove Twilight dependency
|
||||
- bugfix: 88_HMCCU: Module HttpUtils included
|
||||
- changed. 98_WOL: remove dependency on Twilight + German COmmandref
|
||||
|
@ -49,8 +49,7 @@ sub HProtocolGateway_Initialize($) {
|
||||
"parityBit:N,E,O " .
|
||||
"databitsLength:5,6,7,8 " .
|
||||
"stopBit:0,1 " .
|
||||
"pollIntervalMins " .
|
||||
"path";
|
||||
"pollIntervalMins";
|
||||
}
|
||||
|
||||
sub HProtocolGateway_Define($$) {
|
||||
@ -342,8 +341,6 @@ sub HProtocolGateway_Attr (@) {
|
||||
} else {
|
||||
RemoveInternalTimer($hash);
|
||||
}
|
||||
} elsif ($attr eq 'path') {
|
||||
$attr{$name}{path} = $val;
|
||||
} elsif ($attr eq 'baudrate') {
|
||||
$attr{$name}{baudrate} = $val;
|
||||
HProtocolGateway_DeviceConfig($hash);
|
||||
@ -386,19 +383,19 @@ sub HProtocolGateway_Poll($) {
|
||||
sub HProtocolGateway_Tank($$$) {
|
||||
my ($hash,$tankHash,$filllevel) = @_;
|
||||
my $name = $hash->{NAME};
|
||||
my $path = AttrVal($name,"path","");
|
||||
my $type = AttrVal($tankHash->{NAME},"type","");
|
||||
my $type = AttrVal($tankHash->{NAME}, 'type','');
|
||||
|
||||
my %TankChartHash;
|
||||
open my $fh, '<', $path.$type or die "Cannot open: $!";
|
||||
while (my $line = <$fh>) {
|
||||
|
||||
my @array = split(" ", $type);
|
||||
|
||||
foreach my $line (@array) {
|
||||
$line =~ s/\s*\z//;
|
||||
my @array = split /,/, $line;
|
||||
my $key = shift @array;
|
||||
$TankChartHash{$key} = $array[0];
|
||||
}
|
||||
close $fh;
|
||||
|
||||
|
||||
my $volume = 0;
|
||||
my $volume1 = 0;
|
||||
my $level1 = 0;
|
||||
@ -433,7 +430,6 @@ sub HProtocolGateway_Tank($$$) {
|
||||
<ul>
|
||||
<code>define <name> HProtocolGateway /dev/tty???<br />
|
||||
attr <name> pollIntervalMins 2<br />
|
||||
attr <name> path /opt/fhem/<br />
|
||||
attr <name> baudrate 1200<br />
|
||||
attr <name> databitsLength 8<br />
|
||||
attr <name> parityBit N<br />
|
||||
@ -441,23 +437,6 @@ sub HProtocolGateway_Tank($$$) {
|
||||
<br />
|
||||
<br />
|
||||
Defines an HProtocolGateway connected to RS232 serial standard interface.<br /><br />
|
||||
path is the path for tank<01>.csv strapping table files.<br /><br />
|
||||
|
||||
<code>
|
||||
level,volume<br />
|
||||
10,16<br />
|
||||
520,7781<br />
|
||||
1330,29105<br />
|
||||
1830,43403<br />
|
||||
2070,49844<br />
|
||||
2220,53580<br />
|
||||
2370,57009<br />
|
||||
2400,57650<br />
|
||||
2430,58275<br />
|
||||
2370,57009<br />
|
||||
2400,57650<br />
|
||||
2430,58275<br />
|
||||
</code>
|
||||
|
||||
</ul><br />
|
||||
|
||||
@ -466,8 +445,6 @@ sub HProtocolGateway_Tank($$$) {
|
||||
<ul>
|
||||
<li>pollIntervalMins<br />
|
||||
poll Interval in Mins</li>
|
||||
<li>path<br />
|
||||
Strapping Table csv file path</li>
|
||||
<li>baudrate<br />
|
||||
Baudrate / 300, 600, 1200, 2400, 4800, 9600</li>
|
||||
<li>databitsLength<br />
|
||||
|
@ -34,10 +34,10 @@ sub HProtocolTank_Initialize($) {
|
||||
$hash->{AttrFn} = "HProtocolGateway_Attr";
|
||||
$hash->{Match} = "^[a-zA-Z0-9_]+ [a-zA-Z0-9_]+ [+-]*[0-9]+([.][0-9]+)?";
|
||||
$hash->{AttrList} = "hID " .
|
||||
"mode:FillLevel,Volume,Ullage " .
|
||||
"type " .
|
||||
"product:Diesel,FuelOil,Petrol " .
|
||||
"sensorSystem:Hectronic,Unitronics,PMS-IB " .
|
||||
"mode:FillLevel,Volume,Ullage " .
|
||||
"product:Diesel,FuelOil,Petrol " .
|
||||
"type " .
|
||||
$readingFnAttributes;
|
||||
}
|
||||
|
||||
@ -103,10 +103,14 @@ sub HProtocolTank_Attr (@) {
|
||||
my $hash = $defs{$name};
|
||||
my $msg = '';
|
||||
|
||||
if ($attr eq 'type') {
|
||||
$attr{$name}{type} = $val;
|
||||
if ($attr eq 'strappingTable') {
|
||||
$attr{$name}{strappingTable} = $val;
|
||||
} elsif ($attr eq 'mode') {
|
||||
$attr{$name}{mode} = $val;
|
||||
} elsif ($attr eq 'product') {
|
||||
$attr{$name}{product} = $val;
|
||||
} elsif ($attr eq 'sensorSystem') {
|
||||
$attr{$name}{sensorSystem} = $val;
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,11 +176,27 @@ sub HProtocolTank_Attr (@) {
|
||||
<li>mode<br />
|
||||
Mode / FillLevel, Volume, Ullage</li>
|
||||
<li>type<br />
|
||||
Strapping Table csv file / tank01.csv</li>
|
||||
Type / Strapping Table csv</li>
|
||||
<li>product<br />
|
||||
Product / Diesel, FuelOil, Petrol</li>
|
||||
</ul><br />
|
||||
</ul><br /><br />
|
||||
strapping table csv<br /><br />
|
||||
|
||||
<code>
|
||||
level,volume<br />
|
||||
10,16<br />
|
||||
520,7781<br />
|
||||
1330,29105<br />
|
||||
1830,43403<br />
|
||||
2070,49844<br />
|
||||
2220,53580<br />
|
||||
2370,57009<br />
|
||||
2400,57650<br />
|
||||
2430,58275<br />
|
||||
2370,57009<br />
|
||||
2400,57650<br />
|
||||
2430,58275<br />
|
||||
</code>
|
||||
|
||||
</ul><br />
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user