mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
10_IT: add tamper switch for model itswitch_CHN
Fix ITv3 Dim0% userV1setCodes used for receive 14_CUL_TCM97001: Add new attribute max-diff-rain, with 0 (default) the query of the rain difference between 2 measured values is deactivated Correction of the calculation of windSpeed, windGuest and windDirection. New attribute windDirectionInverse if the anemometer was installed the wrong way round. New model "Auriol_IAN" (NC-3982, ADE WS 1503, Tchibo 65 722) added, New model "TCM218943" added - New attribute "negation-batt", so that battery reading can be inverted Some checksum routines optimized and Log outputs standardized and optimized. There is now an alternative device code (DEF) for the Prologue protocol in which the 2nd and 3rd hex digits are used as longID. For example, with s916001A0A000 (Prologue) the DEF CUL_TCM97001_9_22 and with s5DEA06615000 (NC_WS) the DEF CUL_TCM97001_5_222 model Auriol Z31743B added git-svn-id: https://svn.fhem.de/fhem/trunk@20839 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d4e1365e76
commit
f9529a41eb
@ -20,7 +20,7 @@ use SetExtensions;
|
|||||||
my %codes = (
|
my %codes = (
|
||||||
"XMIToff" => "off",
|
"XMIToff" => "off",
|
||||||
"XMITon" => "on", # Set to previous dim value (before switching it off)
|
"XMITon" => "on", # Set to previous dim value (before switching it off)
|
||||||
"00" => "off",
|
"00" => "dim00%", # alt off
|
||||||
"01" => "dim06%",
|
"01" => "dim06%",
|
||||||
"02" => "dim12%",
|
"02" => "dim12%",
|
||||||
"03" => "dim18%",
|
"03" => "dim18%",
|
||||||
@ -184,14 +184,13 @@ IT_Set($@)
|
|||||||
return "Dummydevice $hash->{NAME}: will not set data" if(IsDummy($hash->{NAME}));
|
return "Dummydevice $hash->{NAME}: will not set data" if(IsDummy($hash->{NAME}));
|
||||||
|
|
||||||
my $list = "";
|
my $list = "";
|
||||||
$list .= "off:noArg on:noArg " if( AttrVal($name, "model", "") ne "itremote" && AttrVal($name, "model", "") ne "itswitch_CHN");
|
if( AttrVal($name, "model", "") ne "itremote" && AttrVal($name, "model", "") ne "itswitch_CHN") {
|
||||||
|
$list .= "off:noArg on:noArg ";
|
||||||
if ($hash->{userV1setCodes}) {
|
if ($hash->{userV1setCodes} && ($hash->{READINGS}{protocol}{VAL} eq "EV1527" || $hash->{READINGS}{protocol}{VAL} eq "V1")) {
|
||||||
if ($hash->{READINGS}{protocol}{VAL} eq "EV1527" || $hash->{READINGS}{protocol}{VAL} eq "V1") {
|
foreach my $setCode (keys %{$hash->{userV1setCodes}}) {
|
||||||
foreach my $setCode (keys %{$hash->{userV1setCodes}}) {
|
$list .= "$setCode:noArg ";
|
||||||
$list .= "$setCode:noArg ";
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $c = $it_c2b{$a[0]};
|
my $c = $it_c2b{$a[0]};
|
||||||
@ -638,13 +637,17 @@ IT_Set($@)
|
|||||||
} else {
|
} else {
|
||||||
if ($hash->{READINGS}{protocol}{VAL} eq "V3") {
|
if ($hash->{READINGS}{protocol}{VAL} eq "V3") {
|
||||||
$protocolId = 'P17#';
|
$protocolId = 'P17#';
|
||||||
|
} elsif ($hash->{READINGS}{protocol}{VAL} eq "HE800") { # HomeEasy HE800
|
||||||
|
$protocolId = 'P35#';
|
||||||
|
} elsif ($hash->{READINGS}{protocol}{VAL} eq "HE_EU") { # HomeEasy HE_EU
|
||||||
|
$protocolId = 'P65#';
|
||||||
} else {
|
} else {
|
||||||
$protocolId = 'P3#'; # IT V1
|
$protocolId = 'P3#'; # IT V1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($hash->{READINGS}{protocol}{VAL} ne "EV1527" && $hash->{READINGS}{protocol}{VAL} ne "V1" && $hash->{READINGS}{protocol}{VAL} ne 'SBC_FreeTec') { # bei ITv1, SBC_FreeTec und EV1527 wird das "is" am Anfang nicht entfernt
|
if ($hash->{READINGS}{protocol}{VAL} ne "EV1527" && $hash->{READINGS}{protocol}{VAL} ne "V1" && $hash->{READINGS}{protocol}{VAL} ne 'SBC_FreeTec') { # bei ITv1, SBC_FreeTec und EV1527 wird das "is" am Anfang nicht entfernt
|
||||||
$message = substr($message,2);
|
$message =~ s/^is//;
|
||||||
if (substr($message,0,1) eq "h") { # h entfernen falls am am Anfang
|
if ($message =~ m/^[he]/) { # h oder e entfernen, falls am Anfang
|
||||||
$message = substr($message,1);
|
$message = substr($message,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -771,7 +774,7 @@ IT_Define($$)
|
|||||||
#Log3 $hash,2,"ITdefine 1527: $name a3=" . $a[3];
|
#Log3 $hash,2,"ITdefine 1527: $name a3=" . $a[3];
|
||||||
$housecode = $a[2];
|
$housecode = $a[2];
|
||||||
if (substr($housecode,0,4) eq '1527') {
|
if (substr($housecode,0,4) eq '1527') {
|
||||||
my $evcode;
|
my $evcode = "";
|
||||||
my $bincode = sprintf("%020b",hex(substr($housecode,5)));
|
my $bincode = sprintf("%020b",hex(substr($housecode,5)));
|
||||||
for (my $n=0; $n<20; $n=$n+2) {
|
for (my $n=0; $n<20; $n=$n+2) {
|
||||||
$evcode = $evcode . $bintotristate{substr($bincode,$n,2)};
|
$evcode = $evcode . $bintotristate{substr($bincode,$n,2)};
|
||||||
@ -1152,7 +1155,20 @@ IT_Parse($$)
|
|||||||
$def->{$name}->{READINGS}{protocol}{VAL} = 'EV1527';
|
$def->{$name}->{READINGS}{protocol}{VAL} = 'EV1527';
|
||||||
Log3 $hash,4,"$ioname IT EV1527: " . $def->{$name}{NAME} . ', on code=' . $def->{$name}->{$it_c2b{"on"}} . ", Switch code=$onoffcode";
|
Log3 $hash,4,"$ioname IT EV1527: " . $def->{$name}{NAME} . ', on code=' . $def->{$name}->{$it_c2b{"on"}} . ", Switch code=$onoffcode";
|
||||||
}
|
}
|
||||||
if ($def->{$name}->{READINGS}{protocol}{VAL} eq 'HE800') {
|
$newstate = "";
|
||||||
|
if ($def->{$name}{userV1setCodes} && ($def->{$name}->{READINGS}{protocol}{VAL} eq "EV1527" || $def->{$name}->{READINGS}{protocol}{VAL} eq "V1")) {
|
||||||
|
foreach my $usercode (keys %{$def->{$name}{userV1setCodes}}) {
|
||||||
|
if ($def->{$name}{userV1setCodes}{$usercode} eq $onoffcode) {
|
||||||
|
$newstate = $usercode;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($newstate eq "") {
|
||||||
|
Log3 $def->{$name}{NAME},3,"$ioname IT: Code $onoffcode not found in userV1setCodes, try XMIT";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($newstate eq "") {
|
||||||
|
if ($def->{$name}->{READINGS}{protocol}{VAL} eq 'HE800') {
|
||||||
|
|
||||||
my %he800MapingTable = (
|
my %he800MapingTable = (
|
||||||
2 => 12,
|
2 => 12,
|
||||||
@ -1200,7 +1216,7 @@ IT_Parse($$)
|
|||||||
$newstate="off";
|
$newstate="off";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elsif ($def->{$name}->{$it_c2b{"on"}} eq lc($onoffcode)) {
|
} elsif ($def->{$name}->{$it_c2b{"on"}} eq lc($onoffcode)) {
|
||||||
$newstate="on";
|
$newstate="on";
|
||||||
if( AttrVal($name, "model", "") eq "itdimmer" ) {
|
if( AttrVal($name, "model", "") eq "itdimmer" ) {
|
||||||
my $lastDimVal = $def->{$name}->{READINGS}{lastDimValue}{VAL};
|
my $lastDimVal = $def->{$name}->{READINGS}{lastDimValue}{VAL};
|
||||||
@ -1211,25 +1227,23 @@ IT_Parse($$)
|
|||||||
} else {
|
} else {
|
||||||
readingsSingleUpdate($def->{$name},"dim",100,1);
|
readingsSingleUpdate($def->{$name},"dim",100,1);
|
||||||
}
|
}
|
||||||
} elsif ( AttrVal($name, "model", "") eq "itswitch_CHN" ) {
|
}
|
||||||
$newstate="closed";
|
} elsif ($def->{$name}->{$it_c2b{"off"}} eq lc($onoffcode)) {
|
||||||
}
|
|
||||||
} elsif ($def->{$name}->{$it_c2b{"off"}} eq lc($onoffcode)) {
|
|
||||||
$newstate="off";
|
$newstate="off";
|
||||||
if( AttrVal($name, "model", "") eq "itdimmer" ) {
|
if( AttrVal($name, "model", "") eq "itdimmer" ) {
|
||||||
readingsSingleUpdate($def->{$name},"dim",0,1);
|
readingsSingleUpdate($def->{$name},"dim",0,1);
|
||||||
}
|
}
|
||||||
} elsif ($def->{$name}->{$it_c2b{"dimup"}} eq lc($onoffcode)) {
|
} elsif ($def->{$name}->{$it_c2b{"dimup"}} eq lc($onoffcode)) {
|
||||||
$newstate="dimup";
|
$newstate="dimup";
|
||||||
if( AttrVal($name, "model", "") eq "itdimmer" ) {
|
if( AttrVal($name, "model", "") eq "itdimmer" ) {
|
||||||
readingsSingleUpdate($def->{$name},"dim","dimup",1);
|
readingsSingleUpdate($def->{$name},"dim","dimup",1);
|
||||||
}
|
}
|
||||||
} elsif ($def->{$name}->{$it_c2b{"dimdown"}} eq lc($onoffcode)) {
|
} elsif ($def->{$name}->{$it_c2b{"dimdown"}} eq lc($onoffcode)) {
|
||||||
$newstate="dimdown";
|
$newstate="dimdown";
|
||||||
if( AttrVal($name, "model", "") eq "itdimmer" ) {
|
if( AttrVal($name, "model", "") eq "itdimmer" ) {
|
||||||
readingsSingleUpdate($def->{$name},"dim","dimdown",1);
|
readingsSingleUpdate($def->{$name},"dim","dimdown",1);
|
||||||
}
|
}
|
||||||
} elsif ('d' eq lc($onoffcode)) {
|
} elsif ('d' eq lc($onoffcode)) {
|
||||||
# dim
|
# dim
|
||||||
my $binVal = ((bin2dec($dimCode)+1)*100)/16;
|
my $binVal = ((bin2dec($dimCode)+1)*100)/16;
|
||||||
$binVal = int($binVal);
|
$binVal = int($binVal);
|
||||||
@ -1241,12 +1255,11 @@ IT_Parse($$)
|
|||||||
$newstate="on";
|
$newstate="on";
|
||||||
} elsif ($binVal == 0) {
|
} elsif ($binVal == 0) {
|
||||||
$newstate="off";
|
$newstate="off";
|
||||||
}
|
}
|
||||||
} elsif ( AttrVal($name, "model", "") eq "itswitch_CHN" ) {
|
} else {
|
||||||
$newstate="open";
|
|
||||||
} else {
|
|
||||||
Log3 $def->{$name}{NAME},3,"$ioname IT: Code $onoffcode not supported by $def->{$name}{NAME}.";
|
Log3 $def->{$name}{NAME},3,"$ioname IT: Code $onoffcode not supported by $def->{$name}{NAME}.";
|
||||||
next;
|
next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Log3 $def->{$name}{NAME},3,"$ioname IT: $def->{$name}{NAME} ".$def->{$name}->{STATE}."->".$newstate;
|
Log3 $def->{$name}{NAME},3,"$ioname IT: $def->{$name}{NAME} ".$def->{$name}->{STATE}."->".$newstate;
|
||||||
push(@list,$def->{$name}{NAME});
|
push(@list,$def->{$name}{NAME});
|
||||||
@ -1264,9 +1277,16 @@ sub IT_Attr(@)
|
|||||||
|
|
||||||
#Log3 $hash, 4, "$name IT_Attr: Calling Getting Attr sub with args: $cmd $aName = $aVal";
|
#Log3 $hash, 4, "$name IT_Attr: Calling Getting Attr sub with args: $cmd $aName = $aVal";
|
||||||
|
|
||||||
if( $aName eq 'model' && $aVal eq 'ev1527') {
|
if( $aName eq 'model') {
|
||||||
#Log3 $hash, 4, "$name IT_Attr: ev1527";
|
if ($aVal eq 'ev1527') {
|
||||||
$hash->{READINGS}{protocol}{VAL} = 'EV1527';
|
#Log3 $hash, 4, "$name IT_Attr: ev1527";
|
||||||
|
$hash->{READINGS}{protocol}{VAL} = 'EV1527';
|
||||||
|
} elsif ($aVal eq 'itswitch_CHN') {
|
||||||
|
$hash->{userV1setCodes} = undef;
|
||||||
|
$hash->{userV1setCodes}{open} = "1010";
|
||||||
|
$hash->{userV1setCodes}{closed} = "1110";
|
||||||
|
$hash->{userV1setCodes}{tamper} = "0111";
|
||||||
|
}
|
||||||
} elsif ( $aName eq 'userV1setCodes') {
|
} elsif ( $aName eq 'userV1setCodes') {
|
||||||
my @array = split(" ",$aVal);
|
my @array = split(" ",$aVal);
|
||||||
$hash->{userV1setCodes} = undef;
|
$hash->{userV1setCodes} = undef;
|
||||||
@ -1351,6 +1371,7 @@ sub IT_Attr(@)
|
|||||||
<li>optional <code><dimup-code> <dimdown-code></code> 2 numbers in quad state format (0/1/F/D),
|
<li>optional <code><dimup-code> <dimdown-code></code> 2 numbers in quad state format (0/1/F/D),
|
||||||
contains the command for dimming;
|
contains the command for dimming;
|
||||||
this number is added to the <housecode> to define tha actual 12-number sending command.</li>
|
this number is added to the <housecode> to define tha actual 12-number sending command.</li>
|
||||||
|
<li>If the attribute userV1setCodes exists, these codes are also used for reception, the userV1setCodes have priority over the XMIT Codes.</li>
|
||||||
<li>Notice: orginal ITv1 devices are only defined using the on command.</li>
|
<li>Notice: orginal ITv1 devices are only defined using the on command.</li>
|
||||||
<li>Devices which are nt orignal ITv1 devices cen be defined as follows:</li><br>
|
<li>Devices which are nt orignal ITv1 devices cen be defined as follows:</li><br>
|
||||||
To autocreate press twice "on" within 30 seconds. The Log gives:<br>
|
To autocreate press twice "on" within 30 seconds. The Log gives:<br>
|
||||||
@ -1513,8 +1534,8 @@ Examples:
|
|||||||
|
|
||||||
<b>Dimmer</b>: itdimmer<br>
|
<b>Dimmer</b>: itdimmer<br>
|
||||||
|
|
||||||
<b>door/window contact (china)</b>: itswitch_CHN<br>
|
<b>door/window contact (china)</b>: itswitch_CHN (closed:1110 open:1010 tamper:0111)<br>
|
||||||
|
|
||||||
<b>Receiver/Actor</b>: itswitch<br>
|
<b>Receiver/Actor</b>: itswitch<br>
|
||||||
|
|
||||||
<b>EV1527</b>: ev1527
|
<b>EV1527</b>: ev1527
|
||||||
@ -1556,10 +1577,13 @@ Examples:
|
|||||||
|
|
||||||
<a name="userV1setCodes"></a>
|
<a name="userV1setCodes"></a>
|
||||||
<li>userV1setCodes<br>
|
<li>userV1setCodes<br>
|
||||||
If an ITv1 protocol is used indivual setcodes can be added. Example:
|
If an ITv1 protocol is used indivual setcodes can be added.<br>
|
||||||
|
The setcodes are also used for reception, the userV1setCodes have priority over the XMIT Codes.<br>
|
||||||
|
Example:
|
||||||
<ul><code>
|
<ul><code>
|
||||||
attr lamp userV1setCodes red:FD blue:1F<br>
|
attr lamp userV1setCodes red:FD blue:1F<br>
|
||||||
attr lamp userV1setCodes up:1001 down:1000 stop:1011
|
attr lamp userV1setCodes up:1001 down:1000 stop:1011<br>
|
||||||
|
attr IT_1527x12345 userV1setCodes closed:0111 open:1110 tamper:1011 lowVoltage:1111 # Kerui magnetic contact sensors
|
||||||
</code></ul>
|
</code></ul>
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
@ -1645,6 +1669,7 @@ Examples:
|
|||||||
<li>optional <code><dimup-code> <dimdown-code></code> jeweils 2 Ziffern lange quad-State-Zahl (0/1/F/D),
|
<li>optional <code><dimup-code> <dimdown-code></code> jeweils 2 Ziffern lange quad-State-Zahl (0/1/F/D),
|
||||||
die den Befehl zum Herauf- und Herunterregeln enthält;
|
die den Befehl zum Herauf- und Herunterregeln enthält;
|
||||||
die Zahl wird an den <housecode> angefügt, um den 12-stelligen IT-Sendebefehl zu bilden.</li>
|
die Zahl wird an den <housecode> angefügt, um den 12-stelligen IT-Sendebefehl zu bilden.</li>
|
||||||
|
<li>Falls es das Attribut userV1setCodes gibt, werden diese Codes auch für den Empfang verwendet, dabei haben die userV1setCodes Vorrang vor den XMIT Codes.</li>
|
||||||
<li>Hinweis: orginal ITv1 devices werden nur beim on Befehl angelegt.</li>
|
<li>Hinweis: orginal ITv1 devices werden nur beim on Befehl angelegt.</li>
|
||||||
<li>Die nicht orginal ITv1 devices können wie folgt angelegt werden:</li><br>
|
<li>Die nicht orginal ITv1 devices können wie folgt angelegt werden:</li><br>
|
||||||
Zum anlegen mit autocreate 2 mal auf "on" drücken:<br>
|
Zum anlegen mit autocreate 2 mal auf "on" drücken:<br>
|
||||||
@ -1802,8 +1827,8 @@ Beispiele:
|
|||||||
|
|
||||||
<b>Dimmer</b>: itdimmer<br>
|
<b>Dimmer</b>: itdimmer<br>
|
||||||
|
|
||||||
<b>Tür/Fensterkontakt (China)</b>: itswitch_CHN<br>
|
<b>Tür/Fensterkontakt (China)</b>: itswitch_CHN (closed:1110 open:1010 tamper:0111)<br>
|
||||||
|
|
||||||
<b>Empfänger/Actor</b>: itswitch<br>
|
<b>Empfänger/Actor</b>: itswitch<br>
|
||||||
|
|
||||||
<b>EV1527</b>: ev1527
|
<b>EV1527</b>: ev1527
|
||||||
@ -1845,10 +1870,13 @@ Beispiele:
|
|||||||
|
|
||||||
<a name="userV1setCodes"></a>
|
<a name="userV1setCodes"></a>
|
||||||
<li>userV1setCodes<br>
|
<li>userV1setCodes<br>
|
||||||
Damit können beim ITv1 Protokoll eigene setcodes zugefügt werden. Beispiele:
|
Damit können beim ITv1 Protokoll eigene setcodes zugefügt werden.<br>
|
||||||
|
Die setcodes werden auch für den Empfang verwendet, dabei haben die userV1setCodes Vorrang vor den XMIT Codes.<br>
|
||||||
|
Beispiele:
|
||||||
<ul><code>
|
<ul><code>
|
||||||
attr lamp userV1setCodes rot:FD blau:1F<br>
|
attr lamp userV1setCodes rot:FD blau:1F<br>
|
||||||
attr lamp userV1setCodes hoch:1001 runter:1000 stop:1011
|
attr lamp userV1setCodes hoch:1001 runter:1000 stop:1011<br>
|
||||||
|
attr IT_1527x12345 userV1setCodes closed:0111 open:1110 tamper:1011 lowVoltage:1111 # Kerui Fensterkontakt
|
||||||
</code></ul>
|
</code></ul>
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user