mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
CUL_MAX: Make version check work on non-CUL devices
git-svn-id: https://svn.fhem.de/fhem/trunk@7532 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
919f4c28f4
commit
5492ce390e
@ -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.
|
||||||
|
- fix: CUL_MAX: fix usage of advanced culfw features on non-CUL devices
|
||||||
- changed: 09_CUL_FHTTK: small update to the documentation in order to
|
- changed: 09_CUL_FHTTK: small update to the documentation in order to
|
||||||
simulate the same
|
simulate the same
|
||||||
- fix: 66_ECMD: use STATE not state for connection checking (forum #31307)
|
- fix: 66_ECMD: use STATE not state for connection checking (forum #31307)
|
||||||
|
@ -56,13 +56,15 @@ CUL_MAX_SetupCUL($)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(CUL_MAX_Check($hash) >= 152) {
|
my $version = CUL_MAX_Check($hash);
|
||||||
|
Log3 $hash, 3, "CUL_MAX_Check: Detected firmware version $version of the CUL-compatible IODev";
|
||||||
|
if($version >= 152) {
|
||||||
#Doing this on older firmware disables MAX mode
|
#Doing this on older firmware disables MAX mode
|
||||||
IOWrite($hash, "", "Za". $hash->{addr});
|
IOWrite($hash, "", "Za". $hash->{addr});
|
||||||
#Append to initString, so this is resend if cul disappears and then reappears
|
#Append to initString, so this is resend if cul disappears and then reappears
|
||||||
$hash->{IODev}{initString} .= "\nZa". $hash->{addr};
|
$hash->{IODev}{initString} .= "\nZa". $hash->{addr};
|
||||||
}
|
}
|
||||||
if(CUL_MAX_Check($hash) >= 153) {
|
if($version >= 153) {
|
||||||
#Doing this on older firmware disables MAX mode
|
#Doing this on older firmware disables MAX mode
|
||||||
my $cmd = "Zw". CUL_MAX_fakeWTaddr($hash);
|
my $cmd = "Zw". CUL_MAX_fakeWTaddr($hash);
|
||||||
IOWrite($hash, "", $cmd);
|
IOWrite($hash, "", $cmd);
|
||||||
@ -127,20 +129,30 @@ sub
|
|||||||
CUL_MAX_Check($@)
|
CUL_MAX_Check($@)
|
||||||
{
|
{
|
||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
return if(!defined($hash->{IODev}));
|
if(!defined($hash->{IODev})) {
|
||||||
return if(!defined($hash->{IODev}{TYPE}));
|
Log3 $hash, 1, "CUL_MAX_Check: No IODev found.";
|
||||||
return if($hash->{IODev}{TYPE} ne "CUL");
|
return 0;
|
||||||
return if(!defined($hash->{IODev}{VERSION}));
|
}
|
||||||
|
|
||||||
|
if(!defined($hash->{IODev}{VERSION})) {
|
||||||
|
Log3 $hash, 1, "CUL_MAX_Check: No IODev has no VERSION";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
my $version = $hash->{IODev}{VERSION};
|
my $version = $hash->{IODev}{VERSION};
|
||||||
|
|
||||||
#Looks like "V 1.49 CUL868"
|
#Looks like "V 1.49 CUL868"
|
||||||
$version =~ m/V (.*)\.(.*) .*/;
|
if($version =~ m/V (.*)\.(.*) .*/) {
|
||||||
my ($major_version,$minorversion) = ($1, $2);
|
my ($major_version,$minorversion) = ($1, $2);
|
||||||
$version = 100*$major_version + $minorversion;
|
$version = 100*$major_version + $minorversion;
|
||||||
if($version < 154) {
|
if($version < 154) {
|
||||||
Log3 $hash, 2, "You are using an old version of the CUL firmware, which has known bugs with respect to MAX! support. Please update.";
|
Log3 $hash, 2, "CUL_MAX_Check: You are using an old version of the CUL firmware, which has known bugs with respect to MAX! support. Please update.";
|
||||||
|
}
|
||||||
|
return $version;
|
||||||
|
} else {
|
||||||
|
Log3 $hash, 1, "CUL_MAX_Check: Could not correctly parse IODev->{VERSION} = '$version'";
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return $version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
|
Loading…
x
Reference in New Issue
Block a user