Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

14_SD_BELL.pm - Adjusted little things #937

Merged
merged 35 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
babc4b2
Merge pull request #6 from RFD-FHEM/master
HomeAutoUser Dec 30, 2019
ed19edb
Merge branch 'master' of https://github.com/HomeAutoUser/RFFHEM
HomeAutoUser Jan 20, 2021
891fea1
Merge remote-tracking branch 'upstream/master'
HomeAutoUser Jan 20, 2021
5e23384
Merge remote-tracking branch 'upstream/master'
HomeAutoUser Feb 1, 2021
2a6a715
Bump shogo82148/actions-setup-perl from v1.9.7 to v1.10.0
dependabot[bot] Feb 4, 2021
4145754
Update 14_SD_BELL.pm
HomeAutoUser Feb 4, 2021
a1293af
Automatic updated controls and CHANGED
actions-user Feb 4, 2021
1a9f026
Merge pull request #15 from HomeAutoUser/dependabot/github_actions/sh…
HomeAutoUser Feb 4, 2021
e7f0006
Update 14_SD_BELL.pm
HomeAutoUser Feb 4, 2021
66bb05f
Automatic updated controls and CHANGED
actions-user Feb 4, 2021
3155ab8
Update 14_SD_BELL.pm
HomeAutoUser Feb 4, 2021
ca931da
Automatic updated controls and CHANGED
actions-user Feb 4, 2021
f6e5949
Merge remote-tracking branch 'upstream/master'
HomeAutoUser Feb 5, 2021
fdd7b43
Merge branch 'master' into master_SD_BELL
HomeAutoUser Feb 5, 2021
08ea351
Merge remote-tracking branch 'upstream/master'
HomeAutoUser Feb 27, 2021
a8ce515
Merge remote-tracking branch 'upstream/master'
HomeAutoUser Mar 17, 2021
aee5ccf
Merge branch 'master' into master_SD_BELL
HomeAutoUser Mar 17, 2021
7da4fa7
Update 14_SD_BELL.pm
HomeAutoUser Mar 17, 2021
65b1e0c
Automatic updated controls and CHANGED
actions-user Mar 17, 2021
98e0f08
Update CHANGED
HomeAutoUser Mar 17, 2021
8114203
Merge remote-tracking branch 'upstream/master'
HomeAutoUser Mar 19, 2021
35a6753
Merge branch 'master' into master_SD_BELL
HomeAutoUser Mar 19, 2021
60bc67e
Update 14_SD_BELL.pm
HomeAutoUser Mar 22, 2021
b621a44
Automatic updated controls and CHANGED
actions-user Mar 22, 2021
0b99c0d
Update 14_SD_BELL.pm
HomeAutoUser Mar 22, 2021
57707ba
Automatic updated controls and CHANGED
actions-user Mar 22, 2021
12d8d06
Update CHANGED
HomeAutoUser Mar 22, 2021
9ebc83c
Update 14_SD_BELL.pm
HomeAutoUser Mar 22, 2021
1185452
Automatic updated controls and CHANGED
actions-user Mar 22, 2021
05ad303
Update 14_SD_BELL.pm
HomeAutoUser Mar 22, 2021
e94b96c
Merge branch 'master_SD_BELL' of https://github.com/HomeAutoUser/RFFH…
HomeAutoUser Mar 22, 2021
d88cbd3
Automatic updated controls and CHANGED
actions-user Mar 22, 2021
4bd2bc9
Update 14_SD_BELL.pm
HomeAutoUser Mar 22, 2021
c0224fc
Automatic updated controls and CHANGED
actions-user Mar 22, 2021
f462452
Update CHANGED
HomeAutoUser Mar 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGED
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2021-02-04 - Update 14_SD_BELL.pm

* added useful informations
2021-02-04 - Update 14_SD_BELL.pm

* remove modification (! ... not work)
2021-02-04 - Update 14_SD_BELL.pm

* revised code for PerlCritic
* revised comments
* remove fixed room allocation
2021-01-28 - Remote control SEAV BeSmart S4 (#933)

* new protocol for BeSmart S4 remote control
Expand Down
126 changes: 70 additions & 56 deletions FHEM/14_SD_BELL.pm
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
##############################################################################
# $Id: 14_SD_BELL.pm 22449 2020-07-22 15:58:29Z HomeAuto_User $
# $Id: 14_SD_BELL.pm 0 2021-02-04 21:27:08Z HomeAuto_User $
#
# The file is part of the SIGNALduino project.
# The purpose of this module is to support many wireless BELL devices.
#
# 2018-2020 - HomeAuto_User, elektron-bbs
# 2018-2021 - HomeAuto_User, elektron-bbs
#
####################################################################################################################################
# - wireless doorbell TCM_234759 Tchibo [Protocol 15] length 12-20 (3-5)
####################################################################################################################################
# - FreeTec PE-6946 [Protocol 32] length 24 (6)
# get sduino_dummy raw MU;;P0=146;;P1=245;;P3=571;;P4=-708;;P5=-284;;P7=-6689;;D=14351435143514143535353535353535353535350704040435043504350435040435353535353535353535353507040404350435043504350404353535353535353535353535070404043504350435043504043535353535353535353535350704040435043504350435040435353535353535353535353507040404350435;;CP=3;;R=0;;O;;
# MU;P0=146;P1=245;P3=571;P4=-708;P5=-284;P7=-6689;D=14351435143514143535353535353535353535350704040435043504350435040435353535353535353535353507040404350435043504350404353535353535353535353535070404043504350435043504043535353535353535353535350704040435043504350435040435353535353535353535353507040404350435;CP=3;R=0;O;
####################################################################################################################################
# - Elro (Smartwares) Doorbell DB200 / 16 melodies - unitec Modell:98156+98YK [Protocol 41] length 32 (8) doubleCode
# get sduino_dummy raw MS;;P0=-526;;P1=1450;;P2=467;;P3=-6949;;P4=-1519;;D=231010101010242424242424102424101010102410241024101024241024241010;;CP=2;;SP=3;;O;;
# MS;P0=-526;P1=1450;P2=467;P3=-6949;P4=-1519;D=231010101010242424242424102424101010102410241024101024241024241010;CP=2;SP=3;O;
# - KANGTAI Doorbell (Pollin 94-550405) [Protocol 41] length 32 (8)
# get sduino_dummy raw MS;;P0=1399;;P1=-604;;P2=397;;P3=-1602;;P4=-7090;;D=240123010101230123232301230123232301232323230123010101230123230101;;CP=2;;SP=4;;R=248;;O;;m1;;
# MS;P0=1399;P1=-604;P2=397;P3=-1602;P4=-7090;D=240123010101230123232301230123232301232323230123010101230123230101;CP=2;SP=4;R=248;O;m1;
####################################################################################################################################
# - Glocke Pollin 551227 [Protocol 42] length 28 (7)
# get sduino_dummy raw MU;;P0=-491;;P1=471;;P2=1445;;D=0101010101010101010102020202010101010101010101010202020201010101010101010101020202020101010101010101010102020202010101;;CP=1;;R=67;;
# MU;P0=-491;P1=471;P2=1445;D=0101010101010101010102020202010101010101010101010202020201010101010101010101020202020101010101010101010102020202010101;CP=1;R=67;
####################################################################################################################################
# - m-e doorbell fuer FG- und Basic-Serie [Protocol 57] length 21-24 (6)
# get sduino_dummy raw MC;;LL=-653;;LH=665;;SL=-317;;SH=348;;D=D55B58;;C=330;;L=21;;
# MC;LL=-653;LH=665;SL=-317;SH=348;D=D55B58;C=330;L=21;
####################################################################################################################################
# - VTX-BELL_Funkklingel [Protocol 79] length 12 (3)
# get sduino_dummy raw MU;;P0=656;;P1=-656;;P2=335;;P3=-326;;P4=-5024;;D=01230121230123030303012423012301212301230303030124230123012123012303030301242301230121230123030303012423012301212301230303030124230123012123012303030301242301230121230123030303012423012301212301230303030124230123012123012303030301242301230121230123030303;;CP=2;;O;;
# - BELL-201-TX, VTX-BELL_Funkklingel [Protocol 79] length 12 (3) --> Heidemann_|_Heidemann_HX_|_VTX-BELL
# VTX-BELL, @Ralf9
# MU;P0=656;P1=-656;P2=335;P3=-326;P4=-5024;D=01230121230123030303012423012301212301230303030124230123012123012303030301242301230121230123030303012423012301212301230303030124230123012123012303030301242301230121230123030303012423012301212301230303030124230123012123012303030301242301230121230123030303;CP=2;O;
# BELL-201-TX, @a13xde
# MU;P0=-7152;P1=872;P2=-593;P3=323;P4=-296;P5=622;P6=-4650;D=0123452323232323454545236345234523232323234545452363452345232323232345454523634523452323232323454545236345234523232323234545452363452345232323232345454523634523452323232323454545236345234523232323234545452363452345232323232345454523634523452323232323454;CP=3;R=26;O;
####################################################################################################################################
# - GEA-028DB [Protocol 98] length 16 (4)
# get sduino_dummy raw MU;P0=1488;P1=-585;P2=520;P3=-1509;P4=1949;P5=-5468;CP=2;R=38;D=01232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501;O;
# MU;P0=1488;P1=-585;P2=520;P3=-1509;P4=1949;P5=-5468;CP=2;R=38;D=01232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501;O;
####################################################################################################################################
# !!! ToDo´s !!!
# - KANGTAI doubleCode must CEHCK | only one Code? - MORE USER MSG needed
Expand Down Expand Up @@ -87,7 +90,7 @@ my %models = (
);


sub SD_BELL_Initialize($) {
sub SD_BELL_Initialize {
my ($hash) = @_;
$hash->{Match} = '^P(?:15|32|41|42|57|79|96|98)#.*';
$hash->{DefFn} = 'SD_BELL::Define';
Expand All @@ -97,6 +100,8 @@ sub SD_BELL_Initialize($) {
$hash->{AttrFn} = 'SD_BELL::Attr';
$hash->{AttrList} = 'repeats:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,20,25,30 IODev do_not_notify:1,0 ignore:0,1 showtime:1,0 model:'.join(',', sort keys %models) . " $main::readingFnAttributes";
$hash->{AutoCreate} = {'SD_BELL.*' => {FILTER => '%NAME', autocreateThreshold => '4:180', GPLOT => ''}};

return;
}

### unterer Teil ###
Expand All @@ -108,6 +113,10 @@ use POSIX;

use GPUtils qw(:all); # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt

use constant {
SD_BELL_VERSION => '2021-02-04',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Würde ich nicht nicht als constant ablegen.

Du kannst es ganz gut aus den Metadaten holen oder wenns PERL Style sein soll dann als Variable deklarieren

};

my $missingModul = '';

## Import der FHEM Funktionen
Expand All @@ -131,7 +140,7 @@ BEGIN {


###################################
sub Define($$) {
sub Define {
my ($hash, $def) = @_;
my @a = split("[ \t][ \t]*", $def);
my $hash_name;
Expand All @@ -155,29 +164,32 @@ sub Define($$) {
$doubleCode = $models{$hash_name}{doubleCode}; # read note doubleCode

$hash->{doubleCode} = 'Code alternates between two RAWMSG' if($protocol == 41);
$hash->{lastMSG} = '';
$hash->{bitMSG} = '';
$hash->{lastMSG} = '';
$hash->{version_modul} = SD_BELL_VERSION;

$iodevice = $a[4] if($a[4]);

$modules{SD_BELL}{defptr}{$hash->{DEF}} = $hash;
$ioname = $modules{SD_BELL}{defptr}{ioname} if (exists $modules{SD_BELL}{defptr}{ioname} && not $iodevice);
$ioname = $modules{SD_BELL}{defptr}{ioname} if (exists $modules{SD_BELL}{defptr}{ioname} && !$iodevice);
$iodevice = $ioname if not $iodevice;

### Attributes | model set after codesyntax ###
$attr{$name}{model} = $hash_name if ( not exists($attr{$name}{model}) ); # set model, if only undef --> new def
$attr{$name}{room} = 'SD_BELL' if ( not exists( $attr{$name}{room} ) ); # set room, if only undef --> new def
$attr{$name}{model} = $hash_name if ( not exists($attr{$name}{model}) ); # set model, if only undef --> new def

AssignIoPort($hash, $iodevice);

return;
}

###################################
sub Set($$$@) {
sub Set {
my ( $hash, $name, @a ) = @_;
my $cmd = $a[0];
my $ioname = $hash->{IODev}{NAME};
my $model = AttrVal($name, 'model', 'unknown');
my @split = split(' ', $hash->{DEF});
my @splitCode = ''; # for doubleCode
my @splitCode = ''; # for doubleCode
my $protocol = $split[0];
my $repeats = AttrVal($name,'repeats', '5');
my $doubleCodeCheck;
Expand All @@ -197,14 +209,14 @@ sub Set($$$@) {
$msg .= $id;
my $checksum = sprintf('%02X', ((0x47 + hex(substr($id,0,2)) + hex(substr($id,2,2)) + hex(substr($id,4,2))) & 0xFF));
$msg .= $checksum;
my $model = AttrVal($name,'model', 'Grothe_Mistral_SE_01');
$msg .= '3F' if ($model eq 'Grothe_Mistral_SE_03'); # only Grothe_Mistral_SE_03
$model = AttrVal($name,'model', 'Grothe_Mistral_SE_01');
$msg .= '3F' if ($model eq 'Grothe_Mistral_SE_03'); # only Grothe_Mistral_SE_03
$msg .= ';';
IOWrite($hash, 'raw', $msg);
Log3 $name, 4, "$ioname: $name $msg";
} else {
my $rawDatasend = $split[1]; # hex value from def without protocol
if ($rawDatasend =~ /[0-9a-fA-F]_[0-9a-fA-F]/xms) { # check doubleCode in def
if ($rawDatasend =~ /[0-9a-fA-F]_[0-9a-fA-F]/xms) { # check doubleCode in def
$doubleCodeCheck = 1;
@splitCode = split('_', $rawDatasend);
$rawDatasend = $splitCode[0];
Expand Down Expand Up @@ -235,7 +247,7 @@ sub Set($$$@) {
}

###################################
sub Undef($$) {
sub Undef {
my ($hash, $name) = @_;

if(defined($hash->{DEF}) && defined($modules{SD_BELL}{defptr}{$hash->{DEF}})) {
Expand All @@ -255,7 +267,7 @@ sub Undef($$) {


###################################
sub Parse($$) {
sub Parse {
my ($iohash, $msg) = @_;
my $ioname = $iohash->{NAME};
my ($protocol,$rawData) = split('#',$msg);
Expand Down Expand Up @@ -286,11 +298,11 @@ sub Parse($$) {
$modules{SD_BELL}{defptr}{doubleCode_Time} = 0 if (!exists $modules{SD_BELL}{defptr}{doubleCode_Time});
Log3 $iohash, 4, "$ioname: SD_BELL_Parse Check P$protocol doubleCode - doubleCode_Time_old=".$modules{SD_BELL}{defptr}{doubleCode_Time}.' Time_now='.time().' Diff='.(time()-$modules{SD_BELL}{defptr}{doubleCode_Time});

if ((time() - $modules{SD_BELL}{defptr}{doubleCode_Time} > 15) && $doubleCode_known eq '0') { # max timediff 15 seconds
if ((time() - $modules{SD_BELL}{defptr}{doubleCode_Time} > 15) && $doubleCode_known eq '0') { # max timediff 15 seconds
Log3 $iohash, 4, "$ioname: SD_BELL_Parse Check P$protocol doubleCode - pointer <doubleCode> not exists!" if (not exists $modules{SD_BELL}{defptr}{doubleCode});
Log3 $iohash, 4, "$ioname: SD_BELL_Parse Check P$protocol doubleCode - pointer <doubleCode> ".$modules{SD_BELL}{defptr}{doubleCode}.' deleted! RAWMSG too old!' if (exists $modules{SD_BELL}{defptr}{doubleCode});
delete ($modules{SD_BELL}{defptr}{doubleCode}) if (exists $modules{SD_BELL}{defptr}{doubleCode});
$modules{SD_BELL}{defptr}{doubleCode_Time} = time(); # set time for new RAWMSG
$modules{SD_BELL}{defptr}{doubleCode_Time} = time(); # set time for new RAWMSG
return '';
}

Expand Down Expand Up @@ -420,7 +432,7 @@ sub Parse($$) {
}

###################################
sub Attr(@) {
sub Attr {
my ($cmd, $name, $attrName, $attrValue) = @_;
my $hash = $defs{$name};
my $typ = $hash->{TYPE};
Expand Down Expand Up @@ -458,27 +470,28 @@ sub Attr(@) {
<ul>The module SD_BELL is a universal module of the SIGNALduino for different bells.<br><br>
<u>Currently, the following models are supported:</u>
<ul>
<li>wireless doorbell TCM 234759 Tchibo [Protocol 15]</li>
<li>FreeTec PE-6946 [Protocol 32]</li>
<li>Elro (Smartwares) Doorbell DB200 / 16 melodies - unitec Modell:98156+98YK [Protocol 41]</li>
<li>Pollin 551227 [Protocol 42]</li>
<li>m-e doorbell fuer FG- and Basic-Serie [Protocol 57]</li>
<li>Heidemann | Heidemann HX | VTX-BELL_Funkklingel [Protocol 79]</li>
<li>Grothe Mistral SE 01.1 (40 bit), 03.1 (48 bit) [Protocol 96]</li>
<li>GEA-028DB [Protokoll 98]</li>
<br>
<u><i>Special feature Protocol 41, 2 different codes will be sent one after the other!</u></i>
</ul><br>
<br>
<li>wireless doorbell TCM 234759 Tchibo [Protocol 15]</li>
<li>FreeTec PE-6946 [Protocol 32]</li>
<li>Elro (Smartwares) Doorbell DB200 / 16 melodies - unitec Modell:98156+98YK [Protocol 41]</li>
<li>Pollin 551227 [Protocol 42]</li>
<li>m-e doorbell fuer FG- and Basic-Serie [Protocol 57]</li>
<li>Heidemann | Heidemann HX | VTX-BELL_Funkklingel [Protocol 79]</li>
<li>Grothe Mistral SE 01.1 (40 bit), 03.1 (48 bit) [Protocol 96]</li>
<li>GEA-028DB [Protokoll 98]</li>
<br>
<u><i>Special feature Protocol 41, 2 different codes will be sent one after the other!</u></i>
</ul>
<br><br>

<b>Define</b><br>
<ul><code>define &lt;NAME&gt; SD_BELL &lt;protocol&gt; &lt;hex-adresse&gt;</code><br><br>
<u>Examples:</u>
<ul>
<ul>
define &lt;NAME&gt; SD_BELL 32 68C1DA<br>
define &lt;NAME&gt; SD_BELL 41 754485D3_08E8D593<br>
define &lt;NAME&gt; SD_BELL 79 A3C<br>
</ul></ul><br>
</ul>
</ul><br>

<b>Set</b><br>
<ul>ring</ul><br>
Expand Down Expand Up @@ -506,27 +519,27 @@ sub Attr(@) {
<ul>Das Modul SD_BELL ist ein Universalmodul vom SIGNALduino f&uuml;r verschiedene Klingeln.<br><br>
<u>Derzeit werden folgende Modelle unters&uuml;tzt:</u>
<ul>
<li>wireless doorbell TCM 234759 Tchibo [Protokoll 15]</li>
<li>FreeTec PE-6946 [Protokoll 32]</li>
<li>Elro (Smartwares) Doorbell DB200 / 16 Melodien - unitec Modell:98156+98YK [Protokoll 41]</li>
<li>Pollin 551227 [Protokoll 42]</li>
<li>m-e doorbell f&uuml;r FG- und Basic-Serie [Protokoll 57]</li>
<li>Heidemann | Heidemann HX | VTX-BELL_Funkklingel [Protokoll 79]</li>
<li>Grothe Mistral SE 01.1 (40 bit), 03.1 (48 bit) [Protokoll 96]</li>
<li>GEA-028DB [Protokoll 98]</li>
<br>
<u><i>Besonderheit Protokoll 41, es sendet 2 verschiedene Codes nacheinader!</u></i>
</ul><br>
<br>
<li>wireless doorbell TCM 234759 Tchibo [Protokoll 15]</li>
<li>FreeTec PE-6946 [Protokoll 32]</li>
<li>Elro (Smartwares) Doorbell DB200 / 16 Melodien - unitec Modell:98156+98YK [Protokoll 41]</li>
<li>Pollin 551227 [Protokoll 42]</li>
<li>m-e doorbell f&uuml;r FG- und Basic-Serie [Protokoll 57]</li>
<li>Heidemann | Heidemann HX | VTX-BELL_Funkklingel [Protokoll 79]</li>
<li>Grothe Mistral SE 01.1 (40 bit), 03.1 (48 bit) [Protokoll 96]</li>
<li>GEA-028DB [Protokoll 98]</li>
<br>
<u><i>Besonderheit Protokoll 41, es sendet 2 verschiedene Codes nacheinader!</u></i>
</ul>
<br><br>

<b>Define</b><br>
<ul><code>define &lt;NAME&gt; SD_BELL &lt;Protokoll&gt; &lt;Hex-Adresse&gt;</code><br><br>
<u>Beispiele:</u>
<ul>
<ul>
define &lt;NAME&gt; SD_BELL 32 68C1DA<br>
define &lt;NAME&gt; SD_BELL 41 754485D3_08E8D593<br>
define &lt;NAME&gt; SD_BELL 79 A3C<br>
</ul></ul><br>
</ul></ul><br>

<b>Set</b><br>
<ul>ring</ul><br>
Expand All @@ -543,8 +556,9 @@ sub Attr(@) {
Das Attribut bezeichnet den Modelltyp Ihres Ger&auml;tes.<br></li></ul>
<ul><li><a name="repeats"></a>repeats<br>
Mit diesem Attribut kann angepasst werden, wie viele Wiederholungen gesendet werden. Standard ist 5.<br>
<i>(Bei dem Model Heidemann_|_Heidemann_HX_|_VTX-BELL ist der Wert repeats fest auf 135 gesetzt unabhäning vom eingestellten Attribut!)</i></li></ul><br>
<br>
<i>(Bei dem Model Heidemann_|_Heidemann_HX_|_VTX-BELL ist der Wert repeats fest auf 135 gesetzt unabhäning vom eingestellten Attribut!)</i></li>
</ul>
<br><br>
</ul>
=end html_DE
=cut
2 changes: 1 addition & 1 deletion controls_signalduino.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm
UPD 2020-08-17_22:17:34 13964 FHEM/14_FLAMINGO.pm
UPD 2020-04-13_23:15:56 19347 FHEM/14_Hideki.pm
UPD 2020-10-03_11:48:15 11170 FHEM/14_SD_AS.pm
UPD 2020-07-23_23:16:55 25727 FHEM/14_SD_BELL.pm
UPD 2021-02-04_12:10:04 25959 FHEM/14_SD_BELL.pm
UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm
UPD 2021-01-28_20:20:20 163235 FHEM/14_SD_UT.pm
UPD 2020-09-30_22:58:49 70728 FHEM/14_SD_WS.pm
Expand Down