mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-28 11:01:59 +00:00
Updated MAX-Setup and Init, new get "cmds", check for cmds before mode switch
git-svn-id: https://svn.fhem.de/fhem/trunk@1927 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
87740f3f75
commit
5a99e983ce
@ -25,6 +25,7 @@ my %gets = ( # Name, Data to send to the CUL, Regexp for the answer
|
|||||||
"raw" => ["", '.*'],
|
"raw" => ["", '.*'],
|
||||||
"uptime" => ["t", '^[0-9A-F]{8}[\r\n]*$' ],
|
"uptime" => ["t", '^[0-9A-F]{8}[\r\n]*$' ],
|
||||||
"fhtbuf" => ["T03", '^[0-9A-F]+[\r\n]*$' ],
|
"fhtbuf" => ["T03", '^[0-9A-F]+[\r\n]*$' ],
|
||||||
|
"cmds" => ["?", '.*Use one of[ 0-9A-Za-z]+[\r\n]*$' ],
|
||||||
);
|
);
|
||||||
|
|
||||||
my %sets = (
|
my %sets = (
|
||||||
@ -142,6 +143,7 @@ CUL_Define($$)
|
|||||||
}
|
}
|
||||||
$hash->{FHTID} = uc($a[3]);
|
$hash->{FHTID} = uc($a[3]);
|
||||||
$hash->{initString} = "X21";
|
$hash->{initString} = "X21";
|
||||||
|
$hash->{CMDS} = "";
|
||||||
$hash->{Clients} = $clientsSlowRF;
|
$hash->{Clients} = $clientsSlowRF;
|
||||||
$hash->{MatchList} = \%matchListSlowRF;
|
$hash->{MatchList} = \%matchListSlowRF;
|
||||||
|
|
||||||
@ -460,6 +462,9 @@ READEND:
|
|||||||
DevIo_Disconnected($hash);
|
DevIo_Disconnected($hash);
|
||||||
$msg = "No answer";
|
$msg = "No answer";
|
||||||
|
|
||||||
|
} elsif($a[1] eq "cmds") { # nice it up
|
||||||
|
$msg =~ s/.*Use one of//g;
|
||||||
|
|
||||||
} elsif($a[1] eq "uptime") { # decode it
|
} elsif($a[1] eq "uptime") { # decode it
|
||||||
$msg =~ s/[\r\n]//g;
|
$msg =~ s/[\r\n]//g;
|
||||||
$msg = hex($msg)/125;
|
$msg = hex($msg)/125;
|
||||||
@ -525,6 +530,14 @@ CUL_DoInit($)
|
|||||||
CUL_SimpleWrite($hash, $msg);
|
CUL_SimpleWrite($hash, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Cmd-String feststellen
|
||||||
|
|
||||||
|
my $cmds = CUL_Get($hash, $name, "cmds", 0);
|
||||||
|
$cmds =~ s/$name cmds =>//g;
|
||||||
|
$cmds =~ s/ //g;
|
||||||
|
$hash->{CMDS} = $cmds;
|
||||||
|
Log 3, "$name: Possible commands: " . $hash->{CMDS};
|
||||||
|
|
||||||
CUL_SimpleWrite($hash, $hash->{initString});
|
CUL_SimpleWrite($hash, $hash->{initString});
|
||||||
|
|
||||||
# FHTID
|
# FHTID
|
||||||
@ -960,27 +973,41 @@ CUL_Attr(@)
|
|||||||
my $hash = $defs{$name};
|
my $hash = $defs{$name};
|
||||||
|
|
||||||
$a[3] = "SlowRF" if(!$a[3] || ($a[3] ne "HomeMatic" && $a[3] ne "MAX"));
|
$a[3] = "SlowRF" if(!$a[3] || ($a[3] ne "HomeMatic" && $a[3] ne "MAX"));
|
||||||
|
my $msg = $hash->{NAME} . ": Mode $a[3] not supported";
|
||||||
|
|
||||||
if($a[3] eq "HomeMatic") {
|
if($a[3] eq "HomeMatic") {
|
||||||
return if($hash->{initString} =~ m/Ar/);
|
return if($hash->{initString} =~ m/Ar/);
|
||||||
|
if(($hash->{CMDS} =~ m/A/) || IsDummy($hash->{NAME})) {
|
||||||
$hash->{Clients} = $clientsHomeMatic;
|
$hash->{Clients} = $clientsHomeMatic;
|
||||||
$hash->{MatchList} = \%matchListHomeMatic;
|
$hash->{MatchList} = \%matchListHomeMatic;
|
||||||
|
CUL_SimpleWrite($hash, "Zx") if ($hash->{CMDS} =~ m/Z/); # reset Moritz
|
||||||
$hash->{initString} = "X21\nAr"; # X21 is needed for RSSI reporting
|
$hash->{initString} = "X21\nAr"; # X21 is needed for RSSI reporting
|
||||||
CUL_SimpleWrite($hash, $hash->{initString});
|
CUL_SimpleWrite($hash, $hash->{initString});
|
||||||
|
} else {
|
||||||
|
Log 2, $msg;
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
} elsif($a[3] eq "MAX") {
|
} elsif($a[3] eq "MAX") {
|
||||||
return if($hash->{initString} =~ m/Zr/);
|
return if($hash->{initString} =~ m/Zr/);
|
||||||
|
if(($hash->{CMDS} =~ m/Z/) || IsDummy($hash->{NAME})) {
|
||||||
$hash->{Clients} = $clientsMAX;
|
$hash->{Clients} = $clientsMAX;
|
||||||
$hash->{MatchList} = \%matchListMAX;
|
$hash->{MatchList} = \%matchListMAX;
|
||||||
|
CUL_SimpleWrite($hash, "Ax") if ($hash->{CMDS} =~ m/A/); # reset AskSin
|
||||||
$hash->{initString} = "X21\nZr"; # X21 is needed for RSSI reporting
|
$hash->{initString} = "X21\nZr"; # X21 is needed for RSSI reporting
|
||||||
CUL_SimpleWrite($hash, $hash->{initString});
|
CUL_SimpleWrite($hash, $hash->{initString});
|
||||||
|
} else {
|
||||||
|
Log 2, $msg;
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return if($hash->{initString} eq "X21");
|
return if($hash->{initString} eq "X21");
|
||||||
$hash->{Clients} = $clientsSlowRF;
|
$hash->{Clients} = $clientsSlowRF;
|
||||||
$hash->{MatchList} = \%matchListSlowRF;
|
$hash->{MatchList} = \%matchListSlowRF;
|
||||||
$hash->{initString} = "X21";
|
$hash->{initString} = "X21";
|
||||||
CUL_SimpleWrite($hash, "Ax"); # reset AskSin
|
CUL_SimpleWrite($hash, "Ax") if ($hash->{CMDS} =~ m/A/); # reset AskSin
|
||||||
|
CUL_SimpleWrite($hash, "Zx") if ($hash->{CMDS} =~ m/Z/); # reset Moritz
|
||||||
CUL_SimpleWrite($hash, $hash->{initString});
|
CUL_SimpleWrite($hash, $hash->{initString});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2820,6 +2820,13 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
Read some CUL radio-chip (cc1101) registers (frequency, bandwidth, etc),
|
Read some CUL radio-chip (cc1101) registers (frequency, bandwidth, etc),
|
||||||
and display them in human readable form.
|
and display them in human readable form.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
|
<li>cmds<br>
|
||||||
|
Depending on the firmware installed, CULs have a different set of
|
||||||
|
possible commands. Please refer to the README of the firmware of your
|
||||||
|
CUL to interpret the response of this command. See also the raw-
|
||||||
|
command.
|
||||||
|
</li><br>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<a name="CULattr"></a>
|
<a name="CULattr"></a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user