mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 10:46:53 +00:00
77_SMAEM: contrib 3.5.0
git-svn-id: https://svn.fhem.de/fhem/trunk@20722 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
cc20c5daed
commit
f54c4b4da4
@ -301,9 +301,9 @@ sub SMAEM_Read ($) {
|
|||||||
$socket->recv($data, 608);
|
$socket->recv($data, 608);
|
||||||
my $dl = length($data);
|
my $dl = length($data);
|
||||||
if($dl == 600) {
|
if($dl == 600) {
|
||||||
$hash->{FIRMWARE} = "1.02.04.R";
|
$hash->{MODEL} = "EM / HM 2.0 < 2.03.4.R";
|
||||||
} elsif($dl == 608) {
|
} elsif($dl == 608) {
|
||||||
$hash->{FIRMWARE} = ">= 2.03.4.R";
|
$hash->{MODEL} = "HM 2.0 >= 2.03.4.R";
|
||||||
} else {
|
} else {
|
||||||
Log3 ($name, 1, "SMAEM $name - Buffer length ".$dl." is invalid. Don't parse it.");
|
Log3 ($name, 1, "SMAEM $name - Buffer length ".$dl." is invalid. Don't parse it.");
|
||||||
return;
|
return;
|
||||||
@ -312,12 +312,16 @@ sub SMAEM_Read ($) {
|
|||||||
return if (time() <= $hash->{HELPER}{STARTTIME}+30);
|
return if (time() <= $hash->{HELPER}{STARTTIME}+30);
|
||||||
|
|
||||||
# decode serial number of dataset received
|
# decode serial number of dataset received
|
||||||
|
# unpack big-endian to 2-digit hex (bin2hex)
|
||||||
my $hex = unpack('H*', $data);
|
my $hex = unpack('H*', $data);
|
||||||
my $smaserial = hex(substr($hex,40,8));
|
my $smaserial = hex(substr($hex,40,8));
|
||||||
|
|
||||||
return if(!$smaserial);
|
return if(!$smaserial);
|
||||||
return if($refsn && $refsn ne $smaserial); # nur selektiv eine EM mit angegebener Serial lesen (default: alle)
|
return if($refsn && $refsn ne $smaserial); # nur selektiv eine EM mit angegebener Serial lesen (default: alle)
|
||||||
|
|
||||||
|
$hex =~ /.*90000000(.{6})5200000000$/;
|
||||||
|
$hash->{FIRMWARE} = $1 if($1);
|
||||||
|
|
||||||
# alle Serialnummern in HELPER sammeln und ggf. speichern
|
# alle Serialnummern in HELPER sammeln und ggf. speichern
|
||||||
if(!defined($hash->{HELPER}{ALLSERIALS}) || $hash->{HELPER}{ALLSERIALS} !~ /$smaserial/) {
|
if(!defined($hash->{HELPER}{ALLSERIALS}) || $hash->{HELPER}{ALLSERIALS} !~ /$smaserial/) {
|
||||||
my $sep = $hash->{HELPER}{ALLSERIALS}?"_":undef;
|
my $sep = $hash->{HELPER}{ALLSERIALS}?"_":undef;
|
||||||
@ -406,7 +410,8 @@ sub SMAEM_DoParse ($) {
|
|||||||
if($1 eq "000e04") {
|
if($1 eq "000e04") {
|
||||||
$grid_freq = hex($2)/1000;
|
$grid_freq = hex($2)/1000;
|
||||||
$offset = 16;
|
$offset = 16;
|
||||||
}
|
}
|
||||||
|
Log3 ($name, 4, "SMAEM $name - Offset: $offset");
|
||||||
|
|
||||||
################ Aufbau Ergebnis-Array ####################
|
################ Aufbau Ergebnis-Array ####################
|
||||||
# Extract datasets from hex:
|
# Extract datasets from hex:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user