diff --git a/FHEM/14_CUL_MAX.pm b/FHEM/14_CUL_MAX.pm index 5d83cf085..42edf5320 100644 --- a/FHEM/14_CUL_MAX.pm +++ b/FHEM/14_CUL_MAX.pm @@ -69,6 +69,7 @@ CUL_MAX_Define($$) $hash->{retryCount} = 0; $hash->{devices} = (); AssignIoPort($hash); + CUL_MAX_Check($hash); #This interface is shared with 00_MAXLAN.pm $hash->{SendDeviceCmd} = \&CUL_MAX_SendDeviceCmd; @@ -95,6 +96,24 @@ CUL_MAX_DisablePairmode($) $hash->{pairmode} = 0; } +sub +CUL_MAX_Check($@) +{ + my ($hash) = @_; + return if(!defined($hash->{IODev})); + return if(!defined($hash->{IODev}{TYPE})); + return if($hash->{IODev}{TYPE} ne "CUL"); + return if(!defined($hash->{IODev}{VERSION})); + my $version = $hash->{IODev}{VERSION}; + + #Looks like "V 1.49 CUL868" + $version =~ m/V (.*)\.(.*) CUL.*/; + my ($major_version,$minorversion) = ($1, $2); + if($major_version == 1 and $minorversion < 50) { + Log 2, "The current firmware of the CUL has known bugs with respect to MAX! support. Please update." + } +} + sub CUL_MAX_Set($@) { @@ -234,12 +253,15 @@ CUL_MAX_SendAck($$$) } #All inputs are hex strings, $cmd is one from %msgCmd2Id +#This is deprecated as part of the MAX backend interface sub CUL_MAX_Send(@) { # $cmd is one of my ($hash, $cmd, $dst, $payload, $flags, $groupId, $msgcnt) = @_; + CUL_MAX_Check($hash); + $flags = "00" if(!$flags); $groupId = "00" if(!defined($groupId)); if(!defined($msgcnt)) { @@ -313,6 +335,8 @@ CUL_MAX_SendDeviceCmd($$) { my ($hash,$payload) = @_; + CUL_MAX_Check($hash); + my $dstaddr = unpack("H6",substr($payload,6,3)); my $dhash = CUL_MAX_DeviceHash($dstaddr);