mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +00:00
Bugfix for SOMFY module: add it as client to CUL module and add match pattern.
This way, the IODev is set automatically when a new SOMFY device is defined. git-svn-id: https://svn.fhem.de/fhem/trunk@6526 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
795332ff86
commit
48fbc501a1
@ -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.
|
||||||
|
- bugfix: SOMFY: add module to CUL client list, to set IODev automatically
|
||||||
- feature: sequence: triggerPartial Attribute added
|
- feature: sequence: triggerPartial Attribute added
|
||||||
- feature: 36_JeeLink: changed flash command to use fhem firmware
|
- feature: 36_JeeLink: changed flash command to use fhem firmware
|
||||||
directory (by HCS)
|
directory (by HCS)
|
||||||
|
@ -41,13 +41,13 @@ my %sets = (
|
|||||||
"patable" => "",
|
"patable" => "",
|
||||||
);
|
);
|
||||||
|
|
||||||
my @ampllist = (24, 27, 30, 33, 36, 38, 40, 42); # rAmpl(dB)
|
my @ampllist = (24, 27, 30, 33, 36, 38, 40, 42); # rAmpl(dB)
|
||||||
|
|
||||||
my $clientsSlowRF = ":FS20:FHT.*:KS300:USF1000:BS:HMS: ".
|
my $clientsSlowRF = ":FS20:FHT.*:KS300:USF1000:BS:HMS: ".
|
||||||
":CUL_EM:CUL_WS:CUL_FHTTK:CUL_HOERMANN: ".
|
":CUL_EM:CUL_WS:CUL_FHTTK:CUL_HOERMANN: ".
|
||||||
":ESA2000:CUL_IR:CUL_TX:Revolt:IT:UNIRoll: ".
|
":ESA2000:CUL_IR:CUL_TX:Revolt:IT:UNIRoll:SOMFY ".
|
||||||
":STACKABLE_CC:CUL_RFR:";
|
":STACKABLE_CC:CUL_RFR:";
|
||||||
my $clientsHomeMatic = ":CUL_HM:HMS:CUL_IR:STACKABLE_CC:";
|
my $clientsHomeMatic = ":CUL_HM:HMS:CUL_IR:STACKABLE_CC:";
|
||||||
my $clientsMAX = ":CUL_MAX:HMS:CUL_IR:STACKABLE_CC:";
|
my $clientsMAX = ":CUL_MAX:HMS:CUL_IR:STACKABLE_CC:";
|
||||||
my $clientsWMBus = ":WMBUS:HMS:CUL_IR:STACKABLE_CC:";
|
my $clientsWMBus = ":WMBUS:HMS:CUL_IR:STACKABLE_CC:";
|
||||||
|
|
||||||
@ -70,6 +70,7 @@ my %matchListSlowRF = (
|
|||||||
"G:IT" => "^i......\$",
|
"G:IT" => "^i......\$",
|
||||||
"H:STACKABLE_CC"=>"^\\*",
|
"H:STACKABLE_CC"=>"^\\*",
|
||||||
"I:UNIRoll" => "^[0-9A-F]{5}(B|D|E)",
|
"I:UNIRoll" => "^[0-9A-F]{5}(B|D|E)",
|
||||||
|
"J:SOMFY" => "^Y[r|t|s]:?[A-F0-9]+",
|
||||||
);
|
);
|
||||||
my %matchListHomeMatic = (
|
my %matchListHomeMatic = (
|
||||||
"1:CUL_HM" => "^A....................",
|
"1:CUL_HM" => "^A....................",
|
||||||
@ -124,10 +125,10 @@ sub
|
|||||||
CUL_FingerprintFn($$)
|
CUL_FingerprintFn($$)
|
||||||
{
|
{
|
||||||
my ($name, $msg) = @_;
|
my ($name, $msg) = @_;
|
||||||
|
|
||||||
# Store only the "relevant" part, as the CUL won't compute the checksum
|
# Store only the "relevant" part, as the CUL won't compute the checksum
|
||||||
$msg = substr($msg, 8) if($msg =~ m/^81/ && length($msg) > 8);
|
$msg = substr($msg, 8) if($msg =~ m/^81/ && length($msg) > 8);
|
||||||
|
|
||||||
return ($name, $msg);
|
return ($name, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +178,7 @@ CUL_Define($$)
|
|||||||
$attr{$name}{dummy} = 1;
|
$attr{$name}{dummy} = 1;
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash->{DeviceName} = $dev;
|
$hash->{DeviceName} = $dev;
|
||||||
my $ret = DevIo_OpenDev($hash, 0, "CUL_DoInit");
|
my $ret = DevIo_OpenDev($hash, 0, "CUL_DoInit");
|
||||||
return $ret;
|
return $ret;
|
||||||
@ -202,7 +203,7 @@ CUL_Undef($$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CUL_SimpleWrite($hash, "X00"); # Switch reception off, it may hang up the CUL
|
CUL_SimpleWrite($hash, "X00"); # Switch reception off, it may hang up the CUL
|
||||||
DevIo_CloseDev($hash);
|
DevIo_CloseDev($hash);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +367,7 @@ CUL_Get($@)
|
|||||||
$ampllist[$r{"1B"}&7],
|
$ampllist[$r{"1B"}&7],
|
||||||
4+4*($r{"1D"}&3) #Sens
|
4+4*($r{"1D"}&3) #Sens
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
CUL_SimpleWrite($hash, $gets{$a[1]}[0] . $arg);
|
CUL_SimpleWrite($hash, $gets{$a[1]}[0] . $arg);
|
||||||
@ -496,7 +497,7 @@ CUL_ReadAnswer($$$$)
|
|||||||
if($^O =~ m/Win/ && $hash->{USBDev}) {
|
if($^O =~ m/Win/ && $hash->{USBDev}) {
|
||||||
$hash->{USBDev}->read_const_time($to*1000); # set timeout (ms)
|
$hash->{USBDev}->read_const_time($to*1000); # set timeout (ms)
|
||||||
# Read anstatt input sonst funzt read_const_time nicht.
|
# Read anstatt input sonst funzt read_const_time nicht.
|
||||||
$buf = $hash->{USBDev}->read(999);
|
$buf = $hash->{USBDev}->read(999);
|
||||||
return ("Timeout reading answer for get $arg", undef)
|
return ("Timeout reading answer for get $arg", undef)
|
||||||
if(length($buf) == 0);
|
if(length($buf) == 0);
|
||||||
|
|
||||||
@ -571,17 +572,17 @@ sub
|
|||||||
CUL_XmitDlyHM($$$)
|
CUL_XmitDlyHM($$$)
|
||||||
{
|
{
|
||||||
my ($hash,$fn,$now) = @_;
|
my ($hash,$fn,$now) = @_;
|
||||||
|
|
||||||
my (undef,$mTy,undef,$id) = unpack 'A8A2A6A6',$fn if(length($fn)>19);
|
my (undef,$mTy,undef,$id) = unpack 'A8A2A6A6',$fn if(length($fn)>19);
|
||||||
|
|
||||||
if($id &&
|
if($id &&
|
||||||
$modules{CUL_HM}{defptr}{$id} &&
|
$modules{CUL_HM}{defptr}{$id} &&
|
||||||
$modules{CUL_HM}{defptr}{$id}{helper}{io} &&
|
$modules{CUL_HM}{defptr}{$id}{helper}{io} &&
|
||||||
$modules{CUL_HM}{defptr}{$id}{helper}{io}{nextSend}) {
|
$modules{CUL_HM}{defptr}{$id}{helper}{io}{nextSend}) {
|
||||||
my $dDly = $modules{CUL_HM}{defptr}{$id}{helper}{io}{nextSend} - $now;
|
my $dDly = $modules{CUL_HM}{defptr}{$id}{helper}{io}{nextSend} - $now;
|
||||||
#$dDly -= 0.04 if ($mTy eq "02");# while HM devices need a rest there are
|
#$dDly -= 0.04 if ($mTy eq "02");# while HM devices need a rest there are
|
||||||
# still some devices that need faster
|
# still some devices that need faster
|
||||||
# reactionfor ack.
|
# reactionfor ack.
|
||||||
# Mode needs to be determined
|
# Mode needs to be determined
|
||||||
if ($dDly > 0.01){# wait less then 10 ms will not work
|
if ($dDly > 0.01){# wait less then 10 ms will not work
|
||||||
$dDly = 0.1 if($dDly > 0.1);
|
$dDly = 0.1 if($dDly > 0.1);
|
||||||
@ -590,7 +591,7 @@ CUL_XmitDlyHM($$$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
shift(@{$hash->{helper}{$id}{QUEUE}});
|
shift(@{$hash->{helper}{$id}{QUEUE}});
|
||||||
InternalTimer($now+0.1, "CUL_XmitDlyHMTo", "$hash->{NAME}:$id", 1)
|
InternalTimer($now+0.1, "CUL_XmitDlyHMTo", "$hash->{NAME}:$id", 1)
|
||||||
if (scalar(@{$hash->{helper}{$id}{QUEUE}}));
|
if (scalar(@{$hash->{helper}{$id}{QUEUE}}));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -626,7 +627,7 @@ CUL_WriteTranslate($$$)
|
|||||||
$msg = substr($msg,6,4) . substr($msg,10);
|
$msg = substr($msg,6,4) . substr($msg,10);
|
||||||
|
|
||||||
} elsif($fn eq "cmd") { # internal command
|
} elsif($fn eq "cmd") { # internal command
|
||||||
if($msg eq "speed100") {
|
if($msg eq "speed100") {
|
||||||
$fn = "AR";
|
$fn = "AR";
|
||||||
} elsif($msg eq "speed10") {
|
} elsif($msg eq "speed10") {
|
||||||
$fn = "Ar";
|
$fn = "Ar";
|
||||||
@ -758,7 +759,7 @@ CUL_Read($)
|
|||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
my $culdata = $hash->{PARTIAL};
|
my $culdata = $hash->{PARTIAL};
|
||||||
Log3 $name, 5, "CUL/RAW: $culdata/$buf";
|
Log3 $name, 5, "CUL/RAW: $culdata/$buf";
|
||||||
$culdata .= $buf;
|
$culdata .= $buf;
|
||||||
|
|
||||||
while($culdata =~ m/\n/) {
|
while($culdata =~ m/\n/) {
|
||||||
@ -803,7 +804,7 @@ CUL_Parse($$$$@)
|
|||||||
Log3 $name, 5, "CUL_Parse: switched to $dmsg";
|
Log3 $name, 5, "CUL_Parse: switched to $dmsg";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($dmsg =~ m/^[0-9A-F]{4}U./) { # RF_ROUTER
|
if($dmsg =~ m/^[0-9A-F]{4}U./) { # RF_ROUTER
|
||||||
Dispatch($hash, $dmsg, undef);
|
Dispatch($hash, $dmsg, undef);
|
||||||
return;
|
return;
|
||||||
@ -858,6 +859,8 @@ CUL_Parse($$$$@)
|
|||||||
$dmsg = lc($dmsg);
|
$dmsg = lc($dmsg);
|
||||||
} elsif($fn eq "i" && $len >= 7) { # IT
|
} elsif($fn eq "i" && $len >= 7) { # IT
|
||||||
$dmsg = lc($dmsg);
|
$dmsg = lc($dmsg);
|
||||||
|
} elsif($fn eq "Y" && $len >= 3) { # SOMFY RTS
|
||||||
|
;
|
||||||
} elsif($fn eq "S" && $len >= 33) { # CUL_ESA / ESA2000 / Native
|
} elsif($fn eq "S" && $len >= 33) { # CUL_ESA / ESA2000 / Native
|
||||||
;
|
;
|
||||||
} elsif($fn eq "E" && $len >= 11) { # CUL_EM / Native
|
} elsif($fn eq "E" && $len >= 11) { # CUL_EM / Native
|
||||||
@ -869,7 +872,7 @@ CUL_Parse($$$$@)
|
|||||||
} elsif($fn eq "A" && $len >= 20) { # AskSin/BidCos/HomeMatic
|
} elsif($fn eq "A" && $len >= 20) { # AskSin/BidCos/HomeMatic
|
||||||
my $src = substr($dmsg,9,6);
|
my $src = substr($dmsg,9,6);
|
||||||
if($modules{CUL_HM}{defptr}{$src}){
|
if($modules{CUL_HM}{defptr}{$src}){
|
||||||
$modules{CUL_HM}{defptr}{$src}{helper}{io}{nextSend} =
|
$modules{CUL_HM}{defptr}{$src}{helper}{io}{nextSend} =
|
||||||
gettimeofday() + 0.100;
|
gettimeofday() + 0.100;
|
||||||
}
|
}
|
||||||
$dmsg .= "::$rssi:$name" if(defined($rssi));
|
$dmsg .= "::$rssi:$name" if(defined($rssi));
|
||||||
@ -933,7 +936,7 @@ CUL_SimpleWrite(@)
|
|||||||
{
|
{
|
||||||
my ($hash, $msg, $nonl) = @_;
|
my ($hash, $msg, $nonl) = @_;
|
||||||
return if(!$hash);
|
return if(!$hash);
|
||||||
($hash, $msg) = CUL_prefix(1, $hash, $msg);
|
($hash, $msg) = CUL_prefix(1, $hash, $msg);
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
if (AttrVal($name,"rfmode","") eq "HomeMatic"){
|
if (AttrVal($name,"rfmode","") eq "HomeMatic"){
|
||||||
@ -1020,8 +1023,8 @@ CUL_Attr(@)
|
|||||||
Log3 $name, 2, $msg;
|
Log3 $name, 2, $msg;
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return if($hash->{initString} eq "X21");
|
return if($hash->{initString} eq "X21");
|
||||||
$hash->{Clients} = $clientsSlowRF;
|
$hash->{Clients} = $clientsSlowRF;
|
||||||
@ -1037,11 +1040,11 @@ CUL_Attr(@)
|
|||||||
delete $hash->{".clientArray"};
|
delete $hash->{".clientArray"};
|
||||||
} elsif($aName eq "hmId"){
|
} elsif($aName eq "hmId"){
|
||||||
if ($cmd eq "set"){
|
if ($cmd eq "set"){
|
||||||
return "wrong syntax: hmId must be 6-digit-hex-code (3 byte)"
|
return "wrong syntax: hmId must be 6-digit-hex-code (3 byte)"
|
||||||
if ($aVal !~ m/^[A-F0-9]{6}$/i);
|
if ($aVal !~ m/^[A-F0-9]{6}$/i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1073,7 +1076,7 @@ CUL_prefix($$$)
|
|||||||
The CUL/CUN(O) is a family of RF devices sold by <a
|
The CUL/CUN(O) is a family of RF devices sold by <a
|
||||||
href="http://www.busware.de">busware.de</a>.
|
href="http://www.busware.de">busware.de</a>.
|
||||||
|
|
||||||
With the opensource firmware
|
With the opensource firmware
|
||||||
<a href="http://culfw.de/culfw.html">culfw</a> they are capable
|
<a href="http://culfw.de/culfw.html">culfw</a> they are capable
|
||||||
to receive and send different 433/868 MHz protocols (FS20/FHT/S300/EM/HMS/MAX!).
|
to receive and send different 433/868 MHz protocols (FS20/FHT/S300/EM/HMS/MAX!).
|
||||||
It is even possible to use these devices as range extenders/routers, see the
|
It is even possible to use these devices as range extenders/routers, see the
|
||||||
@ -1091,8 +1094,8 @@ CUL_prefix($$$)
|
|||||||
It is possible to attach more than one device in order to get better
|
It is possible to attach more than one device in order to get better
|
||||||
reception, FHEM will filter out duplicate messages.<br><br>
|
reception, FHEM will filter out duplicate messages.<br><br>
|
||||||
|
|
||||||
Note: This module may require the <code>Device::SerialPort</code> or
|
Note: This module may require the <code>Device::SerialPort</code> or
|
||||||
<code>Win32::SerialPort</code> module if you attach the device via USB
|
<code>Win32::SerialPort</code> module if you attach the device via USB
|
||||||
and the OS sets strange default parameters for serial devices.<br><br>
|
and the OS sets strange default parameters for serial devices.<br><br>
|
||||||
|
|
||||||
</td><td>
|
</td><td>
|
||||||
@ -1121,9 +1124,9 @@ CUL_prefix($$$)
|
|||||||
character, e.g.: /dev/ttyACM0@38400<br><br>
|
character, e.g.: /dev/ttyACM0@38400<br><br>
|
||||||
|
|
||||||
If the baudrate is "directio" (e.g.: /dev/ttyACM0@directio), then the
|
If the baudrate is "directio" (e.g.: /dev/ttyACM0@directio), then the
|
||||||
perl module <code>Device::SerialPort</code> is not needed, and FHEM
|
perl module <code>Device::SerialPort</code> is not needed, and FHEM
|
||||||
opens the device with simple file io. This might work if the operating
|
opens the device with simple file io. This might work if the operating
|
||||||
system uses sane defaults for the serial parameters, e.g. some Linux
|
system uses sane defaults for the serial parameters, e.g. some Linux
|
||||||
distributions and OSX.<br><br>
|
distributions and OSX.<br><br>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
@ -1319,10 +1322,10 @@ CUL_prefix($$$)
|
|||||||
Der CUL/CUN(O) ist eine Familie von Funkempfängern, die von der Firma
|
Der CUL/CUN(O) ist eine Familie von Funkempfängern, die von der Firma
|
||||||
<a href="http://www.busware.de">Busware</a> verkauft wird.
|
<a href="http://www.busware.de">Busware</a> verkauft wird.
|
||||||
|
|
||||||
Mit der OpenSource Firmware
|
Mit der OpenSource Firmware
|
||||||
<a href="http://culfw.de/culfw.html">culfw</a> können sie verschiedene
|
<a href="http://culfw.de/culfw.html">culfw</a> können sie verschiedene
|
||||||
868 MHz Funkprotokolle empfangen bzw. senden (FS20/FHT/S300/EM/HMS/MAX!).
|
868 MHz Funkprotokolle empfangen bzw. senden (FS20/FHT/S300/EM/HMS/MAX!).
|
||||||
Man kann diese Geräte auch zur Reichweitenverlängerung, siehe
|
Man kann diese Geräte auch zur Reichweitenverlängerung, siehe
|
||||||
<a href="#CUL_RFR">CUL_RFR</a> einsetzen.
|
<a href="#CUL_RFR">CUL_RFR</a> einsetzen.
|
||||||
<br> <br>
|
<br> <br>
|
||||||
|
|
||||||
@ -1363,7 +1366,7 @@ CUL_prefix($$$)
|
|||||||
Kernel Modul cdc_acm und üblicherweise wird die Schnittstelle
|
Kernel Modul cdc_acm und üblicherweise wird die Schnittstelle
|
||||||
/dev/ttyACM0 genannt. Wenn die Linux Distribution über kein Kernel
|
/dev/ttyACM0 genannt. Wenn die Linux Distribution über kein Kernel
|
||||||
Modul cdc_acm verfügt, dann kann die Schnittstelle über
|
Modul cdc_acm verfügt, dann kann die Schnittstelle über
|
||||||
usbserial mit dem folgenden Befehl erzeugt werden:
|
usbserial mit dem folgenden Befehl erzeugt werden:
|
||||||
<ul><code>
|
<ul><code>
|
||||||
modprobe usbserial vendor=0x03eb product=0x204b
|
modprobe usbserial vendor=0x03eb product=0x204b
|
||||||
</code></ul>
|
</code></ul>
|
||||||
@ -1403,7 +1406,7 @@ CUL_prefix($$$)
|
|||||||
<b>Set </b>
|
<b>Set </b>
|
||||||
<ul>
|
<ul>
|
||||||
<li>raw<br>
|
<li>raw<br>
|
||||||
Sendet einen CUL Firmware Befehl. Siehe auch
|
Sendet einen CUL Firmware Befehl. Siehe auch
|
||||||
<a href="http://culfw.de/commandref.html">hier</a> für
|
<a href="http://culfw.de/commandref.html">hier</a> für
|
||||||
nähere Erläuterungen der CUL Befehle.
|
nähere Erläuterungen der CUL Befehle.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user