2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

76_SMAInverter: readings bat_loadtotal / bat_loadtoday included, thanks to 300P

git-svn-id: https://svn.fhem.de/fhem/trunk@20399 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
nasseeder1 2019-10-23 16:48:57 +00:00
parent afaaff1bd7
commit 33d770a5f5
3 changed files with 356 additions and 297 deletions

View File

@ -1,5 +1,7 @@
# 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: 76_SMAInverter: readings bat_loadtotal / bat_loadtoday included,
thanks to 300P
- change: 70_SolarEdgeAPI: increment version number for previous change - change: 70_SolarEdgeAPI: increment version number for previous change
- change: 70_SolarEdgeAPI: show SolarEdge logo to comply with API requirements - change: 70_SolarEdgeAPI: show SolarEdge logo to comply with API requirements
- update: 98_MSwitch: New Version 2.6a - update: 98_MSwitch: New Version 2.6a

View File

@ -32,6 +32,7 @@ eval "use FHEM::Meta;1" or my $modMetaAbsent = 1;
# Versions History by DS_Starter # Versions History by DS_Starter
our %SMAInverter_vNotesIntern = ( our %SMAInverter_vNotesIntern = (
"2.14.0" => "08.10.2019 readings bat_loadtotal (BAT_LOADTOTAL), bat_loadtoday (BAT_LOADTODAY) included by 300P, Forum: #topic,56080.msg986302.html#msg986302",
"2.13.4" => "30.08.2019 STP10.0-3AV-40 298 included into %SMAInverter_devtypes ", "2.13.4" => "30.08.2019 STP10.0-3AV-40 298 included into %SMAInverter_devtypes ",
"2.13.3" => "28.08.2019 commandref revised ", "2.13.3" => "28.08.2019 commandref revised ",
"2.13.2" => "27.08.2019 fix WARNING: Use of uninitialized value \$_ in substitution (s///) at /opt/fhem//FHEM/Blocking.pm line 238 ", "2.13.2" => "27.08.2019 fix WARNING: Use of uninitialized value \$_ in substitution (s///) at /opt/fhem//FHEM/Blocking.pm line 238 ",
@ -120,6 +121,8 @@ our %SMAInverter_vNotesIntern = (
# $inv_TEMP # Inverter temperature # $inv_TEMP # Inverter temperature
# $inv_GRIDRELAY # Grid Relay/Contactor Status # $inv_GRIDRELAY # Grid Relay/Contactor Status
# $inv_STATUS # Inverter Status # $inv_STATUS # Inverter Status
# $inv_BAT_LOADTODAY # Today Batteryload
# $inv_BAT_LOADTOTAL # Total Batteryload
# Aufbau Wechselrichter Type-Hash # Aufbau Wechselrichter Type-Hash
my %SMAInverter_devtypes = ( my %SMAInverter_devtypes = (
@ -304,6 +307,7 @@ sub SMAInverter_Initialize($) {
"target-susyid " . "target-susyid " .
"target-serial " . "target-serial " .
$readingFnAttributes; $readingFnAttributes;
$hash->{AttrFn} = "SMAInverter_Attr"; $hash->{AttrFn} = "SMAInverter_Attr";
eval { FHEM::Meta::InitMod( __FILE__, $hash ) }; # für Meta.pm (https://forum.fhem.de/index.php/topic,97589.0.html) eval { FHEM::Meta::InitMod( __FILE__, $hash ) }; # für Meta.pm (https://forum.fhem.de/index.php/topic,97589.0.html)
@ -376,7 +380,6 @@ sub SMAInverter_Undef($$) {
return undef; return undef;
} }
############################################################### ###############################################################
# SMAInverter Get # SMAInverter Get
############################################################### ###############################################################
@ -529,7 +532,9 @@ sub SMAInverter_getstatusDoParse($) {
$sup_OperationTime, $sup_OperationTime,
$sup_InverterTemperature, $sup_InverterTemperature,
$sup_GridRelayStatus, $sup_GridRelayStatus,
$sup_SpotBatteryLoad,
$sup_DeviceStatus); $sup_DeviceStatus);
my ($inv_TYPE, $inv_CLASS, my ($inv_TYPE, $inv_CLASS,
$inv_SPOT_ETODAY, $inv_SPOT_ETOTAL, $inv_SPOT_ETODAY, $inv_SPOT_ETOTAL,
$inv_susyid, $inv_susyid,
@ -545,7 +550,9 @@ sub SMAInverter_getstatusDoParse($) {
$inv_BAT_UDC, $inv_BAT_IDC, $inv_BAT_UDC, $inv_BAT_IDC,
$inv_BAT_CYCLES, $inv_BAT_CYCLES,
$inv_BAT_TEMP, $inv_BAT_TEMP,
$inv_BAT_LOADTODAY, $inv_BAT_LOADTOTAL,
$inv_SPOT_FREQ, $inv_SPOT_OPERTM, $inv_SPOT_FEEDTM, $inv_TEMP, $inv_GRIDRELAY, $inv_STATUS,); $inv_SPOT_FREQ, $inv_SPOT_OPERTM, $inv_SPOT_FEEDTM, $inv_TEMP, $inv_GRIDRELAY, $inv_STATUS,);
my @row_array; my @row_array;
my @array; my @array;
my $avg = 0; my $avg = 0;
@ -582,6 +589,14 @@ sub SMAInverter_getstatusDoParse($) {
BlockingInformParent("SMAInverter_setReadingFromBlocking", [$name, ".etotal_yesterday", $val], 0); BlockingInformParent("SMAInverter_setReadingFromBlocking", [$name, ".etotal_yesterday", $val], 0);
} }
# BATTERYLOAD_TOTAL speichern für BAT_LOADTODAY-Berechnung wenn WR BAT_LOADTODAY nicht liefert
if ($dt_now >= $oper_stop) {
my $val = 0;
$val = ReadingsNum($name, "bat_loadtotal", 0)*1000 if (exists $defs{$name}{READINGS}{bat_loadtotal});
$val = ReadingsNum($name, "BAT_LOADTOTAL", 0) if (exists $defs{$name}{READINGS}{BAT_LOADTOTAL});
BlockingInformParent("SMAInverter_setReadingFromBlocking", [$name, ".bat_loadtotal_yesterday", $val], 0);
}
if (($oper_start <= $dt_now && $dt_now <= $oper_stop) || AttrVal($name,"suppressSleep",0)) { if (($oper_start <= $dt_now && $dt_now <= $oper_stop) || AttrVal($name,"suppressSleep",0)) {
# normal operation or suppressed sleepmode # normal operation or suppressed sleepmode
@ -605,6 +620,7 @@ sub SMAInverter_getstatusDoParse($) {
push(@commands, "sup_SpotDCVoltage"); # Check SpotDCVoltage push(@commands, "sup_SpotDCVoltage"); # Check SpotDCVoltage
push(@commands, "sup_SpotACVoltage"); # Check SpotACVoltage push(@commands, "sup_SpotACVoltage"); # Check SpotACVoltage
push(@commands, "sup_BatteryInfo"); # Check BatteryInfo push(@commands, "sup_BatteryInfo"); # Check BatteryInfo
push(@commands, "sup_SpotBatteryLoad"); # Check Batteryload
} }
if($detail_level > 1) { if($detail_level > 1) {
@ -670,6 +686,9 @@ sub SMAInverter_getstatusDoParse($) {
elsif ($i eq "sup_DeviceStatus") { elsif ($i eq "sup_DeviceStatus") {
($sup_DeviceStatus,$inv_STATUS,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x51800200, 0x00214800, 0x002148FF); ($sup_DeviceStatus,$inv_STATUS,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x51800200, 0x00214800, 0x002148FF);
} }
elsif ($i eq "sup_SpotBatteryLoad") {
($sup_SpotBatteryLoad,$inv_BAT_LOADTODAY,$inv_BAT_LOADTOTAL,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x54000200, 0x00496700, 0x004967FF);
}
} }
# nothing more to do, just log out # nothing more to do, just log out
@ -765,6 +784,7 @@ sub SMAInverter_getstatusDoParse($) {
if($sup_ChargeStatus) { if($sup_ChargeStatus) {
push(@row_array, "chargestatus ".$inv_ChargeStatus."\n"); push(@row_array, "chargestatus ".$inv_ChargeStatus."\n");
} }
if($inv_CLASS && $inv_CLASS eq 8007 && defined($inv_SPOT_PACTOT)) { # V2.10.1 28.04.2019 if($inv_CLASS && $inv_CLASS eq 8007 && defined($inv_SPOT_PACTOT)) { # V2.10.1 28.04.2019
if($inv_SPOT_PACTOT < 0) { if($inv_SPOT_PACTOT < 0) {
push(@row_array, "power_out "."0"."\n"); push(@row_array, "power_out "."0"."\n");
@ -795,16 +815,20 @@ sub SMAInverter_getstatusDoParse($) {
push(@row_array, "bat_udc ".$inv_BAT_UDC."\n"); push(@row_array, "bat_udc ".$inv_BAT_UDC."\n");
push(@row_array, "bat_idc ".$inv_BAT_IDC."\n"); push(@row_array, "bat_idc ".$inv_BAT_IDC."\n");
} }
if($sup_SpotBatteryLoad) {
push(@row_array, "bat_loadtotal ".($inv_BAT_LOADTOTAL/1000)."\n");
push(@row_array, "bat_loadtoday ".($inv_BAT_LOADTODAY/1000)."\n");
}
} }
if($detail_level > 1) { if($detail_level > 1) {
# For Detail Level 2 # For Detail Level 2
if($sup_BatteryInfo) { if($sup_BatteryInfo) {
push(@row_array,"bat_cycles ".$inv_BAT_CYCLES."\n"); push(@row_array, "bat_cycles ".$inv_BAT_CYCLES."\n");
push(@row_array, "bat_temp ".$inv_BAT_TEMP."\n"); push(@row_array, "bat_temp ".$inv_BAT_TEMP."\n");
} }
if($sup_SpotGridFrequency) { if($sup_SpotGridFrequency) {
push(@row_array, "grid_freq. ".sprintf("%.2f",$inv_SPOT_FREQ)."\n"); push(@row_array, "grid_freq ".sprintf("%.2f",$inv_SPOT_FREQ)."\n");
} }
if($sup_TypeLabel) { if($sup_TypeLabel) {
push(@row_array, "device_type ".SMAInverter_devtype($inv_TYPE)."\n"); push(@row_array, "device_type ".SMAInverter_devtype($inv_TYPE)."\n");
@ -835,6 +859,7 @@ sub SMAInverter_getstatusDoParse($) {
push(@row_array, "device_status ".SMAInverter_StatusText($inv_STATUS)."\n"); push(@row_array, "device_status ".SMAInverter_StatusText($inv_STATUS)."\n");
} }
} }
} else { # kein SBFSpot Compatibility Mode } else { # kein SBFSpot Compatibility Mode
if($sup_EnergyProduction) { if($sup_EnergyProduction) {
push(@row_array, "SPOT_ETOTAL ".$inv_SPOT_ETOTAL."\n"); push(@row_array, "SPOT_ETOTAL ".$inv_SPOT_ETOTAL."\n");
@ -885,6 +910,10 @@ sub SMAInverter_getstatusDoParse($) {
push(@row_array, "BAT_UDC ".$inv_BAT_UDC."\n"); push(@row_array, "BAT_UDC ".$inv_BAT_UDC."\n");
push(@row_array, "BAT_IDC ".$inv_BAT_IDC."\n"); push(@row_array, "BAT_IDC ".$inv_BAT_IDC."\n");
} }
if($sup_SpotBatteryLoad) {
push(@row_array, "BAT_LOADTOTAL ".$inv_BAT_LOADTOTAL."\n");
push(@row_array, "BAT_LOADTODAY ".$inv_BAT_LOADTODAY."\n");
}
} }
if($detail_level > 1) { if($detail_level > 1) {
@ -1056,6 +1085,7 @@ sub SMAInverter_SMAcommand($$$$$) {
$inv_BAT_UDC, $inv_BAT_IDC, $inv_BAT_UDC, $inv_BAT_IDC,
$inv_BAT_CYCLES, $inv_BAT_CYCLES,
$inv_BAT_TEMP, $inv_BAT_TEMP,
$inv_BAT_LOADTODAY, $inv_BAT_LOADTOTAL,
$inv_SPOT_FREQ, $inv_SPOT_OPERTM, $inv_SPOT_FEEDTM, $inv_TEMP, $inv_GRIDRELAY, $inv_STATUS); $inv_SPOT_FREQ, $inv_SPOT_OPERTM, $inv_SPOT_FEEDTM, $inv_TEMP, $inv_GRIDRELAY, $inv_STATUS);
my $mysusyid = $hash->{HELPER}{MYSUSYID}; my $mysusyid = $hash->{HELPER}{MYSUSYID};
my $myserialnumber = $hash->{HELPER}{MYSERIALNUMBER}; my $myserialnumber = $hash->{HELPER}{MYSERIALNUMBER};
@ -1180,6 +1210,33 @@ sub SMAInverter_SMAcommand($$$$$) {
return (1,$inv_SPOT_ETODAY,$inv_SPOT_ETOTAL,$inv_susyid,$inv_serial); return (1,$inv_SPOT_ETODAY,$inv_SPOT_ETOTAL,$inv_susyid,$inv_serial);
} }
if($data_ID eq 0x4967) {
if (length($data) >= 66) {
$inv_BAT_LOADTOTAL = unpack("V*", substr($data, 62, 4));
} else {
Log3 $name, 3, "$name - WARNING - BATTERYLOAD_TOTAL wasn't deliverd ... set it to \"0\" !";
$inv_SPOT_ETOTAL = 0;
}
if (length($data) >= 82) {
$inv_BAT_LOADTODAY = unpack("V*", substr ($data, 78, 4));
} else {
# BATTERYLOAD_TODAY wurde vom WR nicht geliefert, es wird versucht ihn zu berechnen
Log3 $name, 3, "$name - BATTERYLOAD_TODAY wasn't delivered from inverter, try to calculate it ...";
my $bltotold = ReadingsNum($name, ".bat_loadtotal_yesterday", undef);
if(defined $bltotold && $inv_BAT_LOADTOTAL > $bltotold) {
$inv_BAT_LOADTODAY = $inv_BAT_LOADTOTAL - $bltotold;
Log3 $name, 3, "$name - BATTERYLOAD_TODAY calculated successfully !";
} else {
Log3 $name, 3, "$name - WARNING - unable to calculate BATTERYLOAD_TODAY ... set it to \"0\" !";
$inv_BAT_LOADTODAY = 0;
}
}
Log3 $name, 5, "$name - Data BAT_LOADTOTAL=$inv_BAT_LOADTOTAL and BAT_LOADTODAY=$inv_BAT_LOADTODAY";
return (1,$inv_BAT_LOADTODAY,$inv_BAT_LOADTOTAL,$inv_susyid,$inv_serial);
}
if($data_ID eq 0x251E) { if($data_ID eq 0x251E) {
$inv_SPOT_PDC1 = unpack("V*", substr $data, 62, 4); $inv_SPOT_PDC1 = unpack("V*", substr $data, 62, 4);
if($size < 90) {$inv_SPOT_PDC2 = 0; } else {$inv_SPOT_PDC2 = unpack("V*", substr $data, 90, 4); } # catch short response, in case PDC2 not supported if($size < 90) {$inv_SPOT_PDC2 = 0; } else {$inv_SPOT_PDC2 = unpack("V*", substr $data, 90, 4); } # catch short response, in case PDC2 not supported
@ -1853,6 +1910,9 @@ The retrieval of the inverter will be executed non-blocking. You can adjust the
<li><b>BAT_TEMP / bat_temp</b> : Battery temperature </li> <li><b>BAT_TEMP / bat_temp</b> : Battery temperature </li>
<li><b>BAT_UDC / bat_udc</b> : Battery Voltage </li> <li><b>BAT_UDC / bat_udc</b> : Battery Voltage </li>
<li><b>ChargeStatus / chargestatus</b> : Battery Charge status </li> <li><b>ChargeStatus / chargestatus</b> : Battery Charge status </li>
<li><b>BAT_LOADTODAY</b> : Battery Load Today </li>
<li><b>BAT_LOADTOTAL</b> : Battery Load Total </li>
<li><b>ChargeStatus / chargestatus</b> : Battery Charge status </li>
<li><b>CLASS / device_class</b> : Inverter Class </li> <li><b>CLASS / device_class</b> : Inverter Class </li>
<li><b>PACMAX1 / pac_max_phase_1</b> : Nominal power in Ok Mode </li> <li><b>PACMAX1 / pac_max_phase_1</b> : Nominal power in Ok Mode </li>
<li><b>PACMAX1_2 / pac_max_phase_1_2</b> : Maximum active power device (Some inverters like SB3300/SB1200) </li> <li><b>PACMAX1_2 / pac_max_phase_1_2</b> : Maximum active power device (Some inverters like SB3300/SB1200) </li>
@ -1862,7 +1922,7 @@ The retrieval of the inverter will be executed non-blocking. You can adjust the
<li><b>SPOT_ETODAY / etoday</b> : Today yield </li> <li><b>SPOT_ETODAY / etoday</b> : Today yield </li>
<li><b>SPOT_ETOTAL / etotal</b> : Total yield </li> <li><b>SPOT_ETOTAL / etotal</b> : Total yield </li>
<li><b>SPOT_FEEDTM / feed-in_time</b> : Feed-in time </li> <li><b>SPOT_FEEDTM / feed-in_time</b> : Feed-in time </li>
<li><b>SPOT_FREQ / grid_freq.</b> : Grid Frequency </li> <li><b>SPOT_FREQ / grid_freq </b> : Grid Frequency </li>
<li><b>SPOT_IAC1 / phase_1_iac</b> : Grid current phase L1 </li> <li><b>SPOT_IAC1 / phase_1_iac</b> : Grid current phase L1 </li>
<li><b>SPOT_IAC2 / phase_2_iac</b> : Grid current phase L2 </li> <li><b>SPOT_IAC2 / phase_2_iac</b> : Grid current phase L2 </li>
<li><b>SPOT_IAC3 / phase_3_iac</b> : Grid current phase L3 </li> <li><b>SPOT_IAC3 / phase_3_iac</b> : Grid current phase L3 </li>
@ -2084,6 +2144,8 @@ Die Abfrage des Wechselrichters wird non-blocking ausgeführt. Der Timeoutwert f
<li><b>BAT_TEMP / bat_temp</b> : Akku Temperatur </li> <li><b>BAT_TEMP / bat_temp</b> : Akku Temperatur </li>
<li><b>BAT_UDC / bat_udc</b> : Akku Spannung </li> <li><b>BAT_UDC / bat_udc</b> : Akku Spannung </li>
<li><b>ChargeStatus / chargestatus</b> : Akku Ladestand </li> <li><b>ChargeStatus / chargestatus</b> : Akku Ladestand </li>
<li><b>BAT_LOADTODAY</b> : Battery Load Today </li>
<li><b>BAT_LOADTOTAL</b> : Battery Load Total </li>
<li><b>CLASS / device_class</b> : Wechselrichter Klasse </li> <li><b>CLASS / device_class</b> : Wechselrichter Klasse </li>
<li><b>PACMAX1 / pac_max_phase_1</b> : Nominelle Leistung in Ok Mode </li> <li><b>PACMAX1 / pac_max_phase_1</b> : Nominelle Leistung in Ok Mode </li>
<li><b>PACMAX1_2 / pac_max_phase_1_2</b> : Maximale Leistung (für einige Wechselrichtertypen) </li> <li><b>PACMAX1_2 / pac_max_phase_1_2</b> : Maximale Leistung (für einige Wechselrichtertypen) </li>
@ -2093,7 +2155,7 @@ Die Abfrage des Wechselrichters wird non-blocking ausgeführt. Der Timeoutwert f
<li><b>SPOT_ETODAY / etoday</b> : Energie heute</li> <li><b>SPOT_ETODAY / etoday</b> : Energie heute</li>
<li><b>SPOT_ETOTAL / etotal</b> : Energie Insgesamt </li> <li><b>SPOT_ETOTAL / etotal</b> : Energie Insgesamt </li>
<li><b>SPOT_FEEDTM / feed-in_time</b> : Einspeise-Stunden </li> <li><b>SPOT_FEEDTM / feed-in_time</b> : Einspeise-Stunden </li>
<li><b>SPOT_FREQ / grid_freq.</b> : Netz Frequenz </li> <li><b>SPOT_FREQ / grid_freq </b> : Netz Frequenz </li>
<li><b>SPOT_IAC1 / phase_1_iac</b> : Netz Strom phase L1 </li> <li><b>SPOT_IAC1 / phase_1_iac</b> : Netz Strom phase L1 </li>
<li><b>SPOT_IAC2 / phase_2_iac</b> : Netz Strom phase L2 </li> <li><b>SPOT_IAC2 / phase_2_iac</b> : Netz Strom phase L2 </li>
<li><b>SPOT_IAC3 / phase_3_iac</b> : Netz Strom phase L3 </li> <li><b>SPOT_IAC3 / phase_3_iac</b> : Netz Strom phase L3 </li>

View File

@ -32,7 +32,7 @@ eval "use FHEM::Meta;1" or my $modMetaAbsent = 1;
# Versions History by DS_Starter # Versions History by DS_Starter
our %SMAInverter_vNotesIntern = ( our %SMAInverter_vNotesIntern = (
"2.14.0" => "08.10.2019 readings bat_loadtotal (BAT_LOADTOTAL), bat_loadtoday (BAT_LOADTODAY) included by 300P", "2.14.0" => "08.10.2019 readings bat_loadtotal (BAT_LOADTOTAL), bat_loadtoday (BAT_LOADTODAY) included by 300P, Forum: #topic,56080.msg986302.html#msg986302",
"2.13.4" => "30.08.2019 STP10.0-3AV-40 298 included into %SMAInverter_devtypes ", "2.13.4" => "30.08.2019 STP10.0-3AV-40 298 included into %SMAInverter_devtypes ",
"2.13.3" => "28.08.2019 commandref revised ", "2.13.3" => "28.08.2019 commandref revised ",
"2.13.2" => "27.08.2019 fix WARNING: Use of uninitialized value \$_ in substitution (s///) at /opt/fhem//FHEM/Blocking.pm line 238 ", "2.13.2" => "27.08.2019 fix WARNING: Use of uninitialized value \$_ in substitution (s///) at /opt/fhem//FHEM/Blocking.pm line 238 ",
@ -687,7 +687,7 @@ sub SMAInverter_getstatusDoParse($) {
($sup_DeviceStatus,$inv_STATUS,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x51800200, 0x00214800, 0x002148FF); ($sup_DeviceStatus,$inv_STATUS,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x51800200, 0x00214800, 0x002148FF);
} }
elsif ($i eq "sup_SpotBatteryLoad") { elsif ($i eq "sup_SpotBatteryLoad") {
($sup_SpotBatteryLoad,$inv_BAT_LOADTODAY,$inv_BAT_LOADTOTAL,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x54000200, 0x00461F00, 0x00461FFF); ($sup_SpotBatteryLoad,$inv_BAT_LOADTODAY,$inv_BAT_LOADTOTAL,$inv_susyid,$inv_serial) = SMAInverter_SMAcommand($hash, $hash->{HOST}, 0x54000200, 0x00496700, 0x004967FF);
} }
} }
@ -1210,12 +1210,7 @@ sub SMAInverter_SMAcommand($$$$$) {
return (1,$inv_SPOT_ETODAY,$inv_SPOT_ETOTAL,$inv_susyid,$inv_serial); return (1,$inv_SPOT_ETODAY,$inv_SPOT_ETOTAL,$inv_susyid,$inv_serial);
} }
####300? if($data_ID eq 0x4967) {
if($data_ID eq 0x461F) {
if (length($data) >= 66) { if (length($data) >= 66) {
$inv_BAT_LOADTOTAL = unpack("V*", substr($data, 62, 4)); $inv_BAT_LOADTOTAL = unpack("V*", substr($data, 62, 4));
} else { } else {