mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 10:46:53 +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.
|
# 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.
|
# 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: 98_WeekdayTimer: restore old Revision; remove Twilight dependency
|
||||||
- bugfix: 88_HMCCU: Module HttpUtils included
|
- bugfix: 88_HMCCU: Module HttpUtils included
|
||||||
- changed. 98_WOL: remove dependency on Twilight + German COmmandref
|
- changed. 98_WOL: remove dependency on Twilight + German COmmandref
|
||||||
|
@ -49,8 +49,7 @@ sub HProtocolGateway_Initialize($) {
|
|||||||
"parityBit:N,E,O " .
|
"parityBit:N,E,O " .
|
||||||
"databitsLength:5,6,7,8 " .
|
"databitsLength:5,6,7,8 " .
|
||||||
"stopBit:0,1 " .
|
"stopBit:0,1 " .
|
||||||
"pollIntervalMins " .
|
"pollIntervalMins";
|
||||||
"path";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub HProtocolGateway_Define($$) {
|
sub HProtocolGateway_Define($$) {
|
||||||
@ -342,8 +341,6 @@ sub HProtocolGateway_Attr (@) {
|
|||||||
} else {
|
} else {
|
||||||
RemoveInternalTimer($hash);
|
RemoveInternalTimer($hash);
|
||||||
}
|
}
|
||||||
} elsif ($attr eq 'path') {
|
|
||||||
$attr{$name}{path} = $val;
|
|
||||||
} elsif ($attr eq 'baudrate') {
|
} elsif ($attr eq 'baudrate') {
|
||||||
$attr{$name}{baudrate} = $val;
|
$attr{$name}{baudrate} = $val;
|
||||||
HProtocolGateway_DeviceConfig($hash);
|
HProtocolGateway_DeviceConfig($hash);
|
||||||
@ -386,19 +383,19 @@ sub HProtocolGateway_Poll($) {
|
|||||||
sub HProtocolGateway_Tank($$$) {
|
sub HProtocolGateway_Tank($$$) {
|
||||||
my ($hash,$tankHash,$filllevel) = @_;
|
my ($hash,$tankHash,$filllevel) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $path = AttrVal($name,"path","");
|
my $type = AttrVal($tankHash->{NAME}, 'type','');
|
||||||
my $type = AttrVal($tankHash->{NAME},"type","");
|
|
||||||
|
|
||||||
my %TankChartHash;
|
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//;
|
$line =~ s/\s*\z//;
|
||||||
my @array = split /,/, $line;
|
my @array = split /,/, $line;
|
||||||
my $key = shift @array;
|
my $key = shift @array;
|
||||||
$TankChartHash{$key} = $array[0];
|
$TankChartHash{$key} = $array[0];
|
||||||
}
|
}
|
||||||
close $fh;
|
|
||||||
|
|
||||||
my $volume = 0;
|
my $volume = 0;
|
||||||
my $volume1 = 0;
|
my $volume1 = 0;
|
||||||
my $level1 = 0;
|
my $level1 = 0;
|
||||||
@ -433,7 +430,6 @@ sub HProtocolGateway_Tank($$$) {
|
|||||||
<ul>
|
<ul>
|
||||||
<code>define <name> HProtocolGateway /dev/tty???<br />
|
<code>define <name> HProtocolGateway /dev/tty???<br />
|
||||||
attr <name> pollIntervalMins 2<br />
|
attr <name> pollIntervalMins 2<br />
|
||||||
attr <name> path /opt/fhem/<br />
|
|
||||||
attr <name> baudrate 1200<br />
|
attr <name> baudrate 1200<br />
|
||||||
attr <name> databitsLength 8<br />
|
attr <name> databitsLength 8<br />
|
||||||
attr <name> parityBit N<br />
|
attr <name> parityBit N<br />
|
||||||
@ -441,23 +437,6 @@ sub HProtocolGateway_Tank($$$) {
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
Defines an HProtocolGateway connected to RS232 serial standard interface.<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 />
|
</ul><br />
|
||||||
|
|
||||||
@ -466,8 +445,6 @@ sub HProtocolGateway_Tank($$$) {
|
|||||||
<ul>
|
<ul>
|
||||||
<li>pollIntervalMins<br />
|
<li>pollIntervalMins<br />
|
||||||
poll Interval in Mins</li>
|
poll Interval in Mins</li>
|
||||||
<li>path<br />
|
|
||||||
Strapping Table csv file path</li>
|
|
||||||
<li>baudrate<br />
|
<li>baudrate<br />
|
||||||
Baudrate / 300, 600, 1200, 2400, 4800, 9600</li>
|
Baudrate / 300, 600, 1200, 2400, 4800, 9600</li>
|
||||||
<li>databitsLength<br />
|
<li>databitsLength<br />
|
||||||
|
@ -34,10 +34,10 @@ sub HProtocolTank_Initialize($) {
|
|||||||
$hash->{AttrFn} = "HProtocolGateway_Attr";
|
$hash->{AttrFn} = "HProtocolGateway_Attr";
|
||||||
$hash->{Match} = "^[a-zA-Z0-9_]+ [a-zA-Z0-9_]+ [+-]*[0-9]+([.][0-9]+)?";
|
$hash->{Match} = "^[a-zA-Z0-9_]+ [a-zA-Z0-9_]+ [+-]*[0-9]+([.][0-9]+)?";
|
||||||
$hash->{AttrList} = "hID " .
|
$hash->{AttrList} = "hID " .
|
||||||
"mode:FillLevel,Volume,Ullage " .
|
|
||||||
"type " .
|
|
||||||
"product:Diesel,FuelOil,Petrol " .
|
|
||||||
"sensorSystem:Hectronic,Unitronics,PMS-IB " .
|
"sensorSystem:Hectronic,Unitronics,PMS-IB " .
|
||||||
|
"mode:FillLevel,Volume,Ullage " .
|
||||||
|
"product:Diesel,FuelOil,Petrol " .
|
||||||
|
"type " .
|
||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,10 +103,14 @@ sub HProtocolTank_Attr (@) {
|
|||||||
my $hash = $defs{$name};
|
my $hash = $defs{$name};
|
||||||
my $msg = '';
|
my $msg = '';
|
||||||
|
|
||||||
if ($attr eq 'type') {
|
if ($attr eq 'strappingTable') {
|
||||||
$attr{$name}{type} = $val;
|
$attr{$name}{strappingTable} = $val;
|
||||||
} elsif ($attr eq 'mode') {
|
} elsif ($attr eq 'mode') {
|
||||||
$attr{$name}{mode} = $val;
|
$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 />
|
<li>mode<br />
|
||||||
Mode / FillLevel, Volume, Ullage</li>
|
Mode / FillLevel, Volume, Ullage</li>
|
||||||
<li>type<br />
|
<li>type<br />
|
||||||
Strapping Table csv file / tank01.csv</li>
|
Type / Strapping Table csv</li>
|
||||||
<li>product<br />
|
<li>product<br />
|
||||||
Product / Diesel, FuelOil, Petrol</li>
|
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 />
|
</ul><br />
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user