mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
STACKABLE_CC (busware device) support added
git-svn-id: https://svn.fhem.de/fhem/trunk@5274 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8bc3889a4a
commit
c27f453003
@ -1,6 +1,7 @@
|
|||||||
# 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.
|
||||||
- SVN
|
- SVN
|
||||||
|
- feature: STACKABLE_CC (busware.de device for the RPi) added
|
||||||
- feature: configdb export/import added for data security (betateilchen)
|
- feature: configdb export/import added for data security (betateilchen)
|
||||||
- feature: new module 38_netatmo.pm added (justme1968)
|
- feature: new module 38_netatmo.pm added (justme1968)
|
||||||
- change: 09_CUL_FHTTK.pm: clean up code to avoid "Use of uninitialized
|
- change: 09_CUL_FHTTK.pm: clean up code to avoid "Use of uninitialized
|
||||||
|
233
fhem/FHEM/16_STACKABLE_CC.pm
Executable file
233
fhem/FHEM/16_STACKABLE_CC.pm
Executable file
@ -0,0 +1,233 @@
|
|||||||
|
##############################################
|
||||||
|
# $Id: 16_STACKABLE_CC.pm 3738 2013-08-18 14:13:59Z rudolfkoenig $
|
||||||
|
package main;
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
sub
|
||||||
|
STACKABLE_CC_Initialize($)
|
||||||
|
{
|
||||||
|
my ($hash) = @_;
|
||||||
|
LoadModule("CUL");
|
||||||
|
|
||||||
|
$hash->{Match} = "^\\*";
|
||||||
|
$hash->{DefFn} = "STACKABLE_CC_Define";
|
||||||
|
$hash->{UndefFn} = "STACKABLE_CC_Undef";
|
||||||
|
$hash->{ParseFn} = "STACKABLE_CC_Parse";
|
||||||
|
$hash->{AttrFn} = "CUL_Attr";
|
||||||
|
$hash->{AttrList} = "IODev ignore:0,1 ".$modules{CUL}{AttrList};
|
||||||
|
|
||||||
|
$hash->{WriteFn} = "STACKABLE_CC_Write";
|
||||||
|
$hash->{GetFn} = "CUL_Get";
|
||||||
|
$hash->{SetFn} = "CUL_Set";
|
||||||
|
$hash->{AddPrefix} = "STACKABLE_CC_AddPrefix";
|
||||||
|
$hash->{DelPrefix} = "STACKABLE_CC_DelPrefix";
|
||||||
|
$hash->{noRawInform} = 1; # Our message was already sent as raw.
|
||||||
|
$hash->{noAutocreatedFilelog} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
sub
|
||||||
|
STACKABLE_CC_Define($$)
|
||||||
|
{
|
||||||
|
my ($hash, $def) = @_;
|
||||||
|
my @a = split("[ \t][ \t]*", $def);
|
||||||
|
|
||||||
|
return "wrong syntax: define <name> STACKABLE_CC [CUL|SCC]"
|
||||||
|
if(int(@a) != 3);
|
||||||
|
|
||||||
|
my $io = $defs{$a[2]};
|
||||||
|
return "$a[2] is not a CUL/STACKABLE_CC"
|
||||||
|
if(!$io || !($io->{TYPE} eq "CUL" || $io->{TYPE} eq "STACKABLE_CC"));
|
||||||
|
|
||||||
|
return "$io->{NAME} has alread a stacked device: $io->{STACKED}"
|
||||||
|
if($io->{STACKED});
|
||||||
|
|
||||||
|
$io->{STACKED} = $hash->{NAME};
|
||||||
|
$hash->{IODev} = $io;
|
||||||
|
delete($io->{".clientArray"}); # Force a recompute
|
||||||
|
$hash->{initString} = $io->{initString};
|
||||||
|
$hash->{CMDS} = "";
|
||||||
|
$hash->{Clients} = $io->{Clients};
|
||||||
|
$hash->{MatchList} = $io->{MatchList};
|
||||||
|
$hash->{StackLevel} = $io->{StackLevel} ? $io->{StackLevel}+1 : 1;
|
||||||
|
$hash->{STATE} = "Defined";
|
||||||
|
|
||||||
|
CUL_DoInit($hash);
|
||||||
|
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
sub
|
||||||
|
STACKABLE_CC_Write($$)
|
||||||
|
{
|
||||||
|
my ($hash,$fn,$msg) = @_;
|
||||||
|
|
||||||
|
($fn, $msg) = CUL_WriteTranslate($hash, $fn, $msg);
|
||||||
|
return if(!defined($fn));
|
||||||
|
IOWrite($hash, "", "*$fn$msg"); # No more translations
|
||||||
|
}
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
sub
|
||||||
|
STACKABLE_CC_Parse($$)
|
||||||
|
{
|
||||||
|
my ($iohash,$msg) = @_;
|
||||||
|
|
||||||
|
$msg =~ s/^.//; # Cut off prefix *
|
||||||
|
my $name = $iohash->{STACKED} ? $iohash->{STACKED} : "";
|
||||||
|
|
||||||
|
my $id = $iohash->{StackLevel} ? $iohash->{StackLevel}+1 : 1;
|
||||||
|
return "UNDEFINED STACKABLE_CC_$id STACKABLE_CC $iohash->{NAME}"
|
||||||
|
if(!$name);
|
||||||
|
|
||||||
|
return "" if(IsIgnored($name));
|
||||||
|
|
||||||
|
CUL_Parse($defs{$name}, $iohash, $name, $msg);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
STACKABLE_CC_DelPrefix($)
|
||||||
|
{
|
||||||
|
my ($hash, $msg) = @_;
|
||||||
|
$msg =~ s/^.//;
|
||||||
|
return $msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
STACKABLE_CC_AddPrefix($$)
|
||||||
|
{
|
||||||
|
my ($hash, $msg) = @_;
|
||||||
|
return "*$msg";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
STACKABLE_CC_Undef($$)
|
||||||
|
{
|
||||||
|
my ($hash, $arg) = @_;
|
||||||
|
CUL_SimpleWrite($hash, "X00");
|
||||||
|
delete $hash->{IODev}{STACKED};
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
|
||||||
|
=pod
|
||||||
|
=begin html
|
||||||
|
|
||||||
|
<a name="STACKABLE_CC"></a>
|
||||||
|
<h3>STACKABLE_CC</h3>
|
||||||
|
<ul>
|
||||||
|
This module handles the stackable CC1101 devices for the Raspberry PI from
|
||||||
|
busware.de. You can attach a lot of CUL-Type devices to a single RPi this way.
|
||||||
|
The first device is defined as a CUL, the rest of them as STACKABLE_CC.
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<a name="STACKABLE_CCdefine"></a>
|
||||||
|
<b>Define</b>
|
||||||
|
<ul>
|
||||||
|
<code>define <name> STACKABLE_CC <Base-Device-Name></code> <br>
|
||||||
|
<br>
|
||||||
|
<Base-Device-Name> is the name of the device, which this device is
|
||||||
|
attached on, the first one has to be defined as a CUL device<br>
|
||||||
|
Example:
|
||||||
|
<ul><code>
|
||||||
|
define SCC0 CUL /dev/ttyAMA0@38400<br>
|
||||||
|
attr SCC0 rfmode SlowRF<br>
|
||||||
|
define SCC1 STACKABLE_CC CUL<br>
|
||||||
|
attr SCC1 rfmode HomeMatic<br>
|
||||||
|
define SCC2 STACKABLE_CC CUL<br>
|
||||||
|
attr SCC2 rfmode Max<br>
|
||||||
|
</code></ul>
|
||||||
|
<b>Important:</b>
|
||||||
|
<ul>
|
||||||
|
<li>The rfmode has to be specified explicitely (valid for the STACKABLE_CC
|
||||||
|
types only, not for the first, which is defined as a CUL).</li>
|
||||||
|
<li>In case of SlowRF, the FHTID has to be specified explicitely with the
|
||||||
|
command "set SCCX raw T01HHHH". Again, this is valid for the STACKABLE_CC
|
||||||
|
types only.</li>
|
||||||
|
<li>If you rename the base CUL or a STACKABLE_CC, which is a base for
|
||||||
|
another one, the define of the next one has to be adjusted, and FHEM has to be
|
||||||
|
restarted.</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<a name="STACKABLE_CCset"></a>
|
||||||
|
<b>Set</b> <ul>Same as for the <a href="#CULset">CUL</a>.</ul><br>
|
||||||
|
|
||||||
|
<a name="STACKABLE_CCget"></a>
|
||||||
|
<b>Get</b> <ul>Same as for the <a href="#CULget">CUL</a>.</ul><br>
|
||||||
|
|
||||||
|
<a name="STACKABLE_CCattr"></a>
|
||||||
|
<b>Attributes</b>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#IODev">IODev</a></li><br>
|
||||||
|
<li><a href="#ignore">ignore</a></li><br>
|
||||||
|
The rest of the attributes is the same as for the <a href="#CULattr">CUL</a>.
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
=end html
|
||||||
|
|
||||||
|
=begin html_DE
|
||||||
|
|
||||||
|
<a name="STACKABLE_CC"></a>
|
||||||
|
<h3>STACKABLE_CC</h3>
|
||||||
|
<ul>
|
||||||
|
Mit Hilfe dieses Moduls kann man die "Stackable CC" Geräte von busware.de in
|
||||||
|
FHEM integrieren. Diese Geräte ermöglichen eine Menge von CULs an einem RPi
|
||||||
|
anzuschliessen.
|
||||||
|
Das erste Gerät wird als CUL definiert, alle nachfolgenden als STACKABLE_CC.
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
<a name="STACKABLE_CCdefine"></a>
|
||||||
|
<b>Define</b>
|
||||||
|
<ul>
|
||||||
|
<code>define <name> STACKABLE_CC <Base-Device-Name></code> <br>
|
||||||
|
<br>
|
||||||
|
<Base-Device-Name> ist der Name des Gerätes, der als Basis für das
|
||||||
|
aktuelle Gerät dient.<br>
|
||||||
|
Beispiel:
|
||||||
|
<ul><code>
|
||||||
|
define SCC0 CUL /dev/ttyAMA0@38400<br>
|
||||||
|
attr SCC0 rfmode SlowRF<br>
|
||||||
|
define SCC1 STACKABLE_CC CUL<br>
|
||||||
|
attr SCC1 rfmode HomeMatic<br>
|
||||||
|
define SCC2 STACKABLE_CC CUL<br>
|
||||||
|
attr SCC2 rfmode Max<br>
|
||||||
|
</code></ul>
|
||||||
|
<b>Wichtig:</b>
|
||||||
|
<ul>
|
||||||
|
<li>Das rfmode Attribut muss explizit spezifiziert werden. Das gilt nur
|
||||||
|
für die STACKABLE_CC Definitionen, und nicht für die erste, die
|
||||||
|
als CUL definiert wurde.</li>
|
||||||
|
<li>Falls SlowRF spezifiziert wurde, dann muss das FHTID explizit gesetzt
|
||||||
|
werden, mit folgendem Kommando: "set SCCX raw T01HHHH". Auch das ist nur
|
||||||
|
für die STACKABLE_CC nötig.</li>
|
||||||
|
<li>Falls ein Gerät umbenannt wird, was als Basis für ein STACKABLE_CC
|
||||||
|
dient, dann muss es auch in der Definition des abhängigen Gerätes
|
||||||
|
umbenannt werden, und FHEM muss neugestartet werden.</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<a name="STACKABLE_CCset"></a>
|
||||||
|
<b>Set</b> <ul>Die gleichen wie für das <a href="#CULset">CUL</a>.</ul><br>
|
||||||
|
|
||||||
|
<a name="STACKABLE_CCget"></a>
|
||||||
|
<b>Get</b> <ul>Die gleichen wie für das <a href="#CULget">CUL</a>.</ul><br>
|
||||||
|
|
||||||
|
<a name="STACKABLE_CCattr"></a>
|
||||||
|
<b>Attributes</b>
|
||||||
|
<ul>
|
||||||
|
<li><a href="#IODev">IODev</a></li><br>
|
||||||
|
<li><a href="#ignore">ignore</a></li><br>
|
||||||
|
Die anderen Attribute sind die gleichen wie für das <a href="#CULattr">CUL</a>.
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
=end html_DE
|
||||||
|
|
||||||
|
=cut
|
@ -56,6 +56,7 @@ FHEM/14_CUL_TX.pm rudolfkoenig http://forum.fhem.de SlowRF
|
|||||||
FHEM/14_CUL_WS.pm rudolfkoenig http://forum.fhem.de SlowRF
|
FHEM/14_CUL_WS.pm rudolfkoenig http://forum.fhem.de SlowRF
|
||||||
FHEM/15_CUL_EM.pm rudolfkoenig http://forum.fhem.de SlowRF
|
FHEM/15_CUL_EM.pm rudolfkoenig http://forum.fhem.de SlowRF
|
||||||
FHEM/16_CUL_RFR.pm rudolfkoenig http://forum.fhem.de SlowRF
|
FHEM/16_CUL_RFR.pm rudolfkoenig http://forum.fhem.de SlowRF
|
||||||
|
FHEM/16_STACKABLE_CC.pm rudolfkoenig http://forum.fhem.de SlowRF
|
||||||
FHEM/17_EGPM2LAN.pm alexus http://forum.fhem.de Sonstiges
|
FHEM/17_EGPM2LAN.pm alexus http://forum.fhem.de Sonstiges
|
||||||
FHEM/17_SIS_PMS.pm painseeker http://forum.fhem.de Sonstiges
|
FHEM/17_SIS_PMS.pm painseeker http://forum.fhem.de Sonstiges
|
||||||
FHEM/18_CUL_HOERMANN.pm rudolfkoenig http://forum.fhem.de SlowRF
|
FHEM/18_CUL_HOERMANN.pm rudolfkoenig http://forum.fhem.de SlowRF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user