mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-18 12:06:04 +00:00
70_PylonLowVoltage: internal code changes
git-svn-id: https://svn.fhem.de/fhem/trunk@28068 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
a3256560bf
commit
e1203a9de4
@ -122,6 +122,7 @@ BEGIN {
|
|||||||
|
|
||||||
# Versions History intern (Versions history by Heiko Maaz)
|
# Versions History intern (Versions history by Heiko Maaz)
|
||||||
my %vNotesIntern = (
|
my %vNotesIntern = (
|
||||||
|
"0.1.10" => "18.10.2023 new function pseudoHexToText in _callManufacturerInfo for translate battery name and Manufactorer ",
|
||||||
"0.1.9" => "25.09.2023 fix possible bat adresses ",
|
"0.1.9" => "25.09.2023 fix possible bat adresses ",
|
||||||
"0.1.8" => "23.09.2023 new Attr userBatterytype, change manufacturerInfo, protocolVersion command hash to LENID=0 ",
|
"0.1.8" => "23.09.2023 new Attr userBatterytype, change manufacturerInfo, protocolVersion command hash to LENID=0 ",
|
||||||
"0.1.7" => "20.09.2023 extend possible number of bats from 6 to 8 ",
|
"0.1.7" => "20.09.2023 extend possible number of bats from 6 to 8 ",
|
||||||
@ -813,8 +814,8 @@ sub _callManufacturerInfo {
|
|||||||
# my $softwareVersion = 'V'.hex (substr ($res, 33, 2)).'.'.hex (substr ($res, 35, 2)); # unklare Bedeutung
|
# my $softwareVersion = 'V'.hex (substr ($res, 33, 2)).'.'.hex (substr ($res, 35, 2)); # unklare Bedeutung
|
||||||
my $ManufacturerHex = substr ($res, 37, 40);
|
my $ManufacturerHex = substr ($res, 37, 40);
|
||||||
|
|
||||||
$readings->{batteryType} = $ubtt ? $ubtt.' (adapted)' : pack ("H*", $BatteryHex);
|
$readings->{batteryType} = $ubtt ? $ubtt.' (adapted)' : pseudoHexToText ($BatteryHex);
|
||||||
$readings->{Manufacturer} = pack ("H*", $ManufacturerHex);
|
$readings->{Manufacturer} = pseudoHexToText ($ManufacturerHex);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1280,6 +1281,25 @@ sub responseCheck {
|
|||||||
return $rtnerr;
|
return $rtnerr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################
|
||||||
|
# Hex-Zeichenkette in ASCII-Zeichenkette einzeln umwandeln
|
||||||
|
###############################################################
|
||||||
|
sub pseudoHexToText {
|
||||||
|
my $string = shift;
|
||||||
|
|
||||||
|
my $charcode;
|
||||||
|
my $text;
|
||||||
|
|
||||||
|
for (my $i = 0; $i < length($string); $i = $i + 2) {
|
||||||
|
$charcode = hex substr ($string, $i, 2); # charcode = aquivalente Dezimalzahl der angegebenen Hexadezimalzahl
|
||||||
|
next if($charcode == 45); # Hyphen '-' ausblenden
|
||||||
|
|
||||||
|
$text = $text.chr ($charcode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
###############################################################
|
###############################################################
|
||||||
# Fehlerausstieg
|
# Fehlerausstieg
|
||||||
###############################################################
|
###############################################################
|
||||||
|
Loading…
x
Reference in New Issue
Block a user