From 83cdfd1ce99b37f4821a05a2568d7b3b296bf8ee Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Mon, 13 Apr 2020 22:59:15 +0200 Subject: [PATCH 01/35] Bump dev-r34 to v3.4.4 --- FHEM/00_SIGNALduino.pm | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FHEM/00_SIGNALduino.pm b/FHEM/00_SIGNALduino.pm index 78fe00f68..88425313d 100644 --- a/FHEM/00_SIGNALduino.pm +++ b/FHEM/00_SIGNALduino.pm @@ -36,7 +36,7 @@ use lib::SD_Protocols; use constant { - SDUINO_VERSION => "v3.4.3", + SDUINO_VERSION => "v3.4.4_dev+13042020", SDUINO_INIT_WAIT_XQ => 1.5, # wait disable device SDUINO_INIT_WAIT => 2, SDUINO_INIT_MAXRETRY => 3, diff --git a/README.md b/README.md index 62e940d18..bb67eb0c4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -SIGNALduino - FHEM Modules stable Version 3.4.3 +SIGNALduino - FHEM Modules development Version 3.4.4 -[![Coverage Status](https://coveralls.io/repos/github/RFD-FHEM/RFFHEM/badge.svg?branch=master)](https://coveralls.io/github/RFD-FHEM/RFFHEM?branch=master) [![Build Status](https://travis-ci.org/RFD-FHEM/RFFHEM.svg?branch=master)](https://travis-ci.org/RFD-FHEM/RFFHEM) +[![Coverage Status](https://coveralls.io/repos/github/RFD-FHEM/RFFHEM/badge.svg?branch=dev-r34)](https://coveralls.io/github/RFD-FHEM/RFFHEM?branch=dev-r34) [![Build Status](https://travis-ci.org/RFD-FHEM/RFFHEM.svg?branch=dev-r34)](https://travis-ci.org/RFD-FHEM/RFFHEM) Counterpart of SIGNALDuino uC, it's the code for FHEM to work with the data received from the uC @@ -87,7 +87,7 @@ How to install ====== The Perl modules can be loaded directly into your FHEM installation: -```update all https://raw.githubusercontent.com/RFD-FHEM/RFFHEM/master/controls_signalduino.txt``` +```update all https://raw.githubusercontent.com/RFD-FHEM/RFFHEM/dev-r34/controls_signalduino.txt``` Prepare your Arduino nano. Look at http://www.fhemwiki.de/wiki/Datei:Fhemduino_schematic.png for hardware setup. From 97d2e33da552e8e8ff89b52446c7c21d3e60d771 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 13 Apr 2020 20:59:37 +0000 Subject: [PATCH 02/35] Automatic updated controls and CHANGED --- CHANGED | 1 + controls_signalduino.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index e8e4efe97..003bbbcc9 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,4 @@ +2020-04-13 - Bump dev-r34 to v3.4.4 2020-04-13 - Merge remote-tracking branch 'remotes/origin/dev-r34' into v3.4.3 13.04.2020 diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 35e856b9d..18eade5ae 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,4 +1,4 @@ -UPD 2020-04-13_22:53:14 226630 FHEM/00_SIGNALduino.pm +UPD 2020-04-13_22:59:15 226643 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2019-12-26_22:50:15 19839 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm From 11dbc70e46493b6cc0fa9026c1369f4feaeb7cd4 Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Tue, 14 Apr 2020 22:59:03 +0200 Subject: [PATCH 03/35] 00_SIGNALduino.pm Changed stringrefs to coderefs --- FHEM/00_SIGNALduino.pm | 56 +++++++++---------- .../test_firmware_flash_1-definition.txt | 4 +- ...sub_SIGNALduino_Get_delayed-definition.txt | 4 +- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/FHEM/00_SIGNALduino.pm b/FHEM/00_SIGNALduino.pm index 88425313d..2065369d3 100644 --- a/FHEM/00_SIGNALduino.pm +++ b/FHEM/00_SIGNALduino.pm @@ -1,4 +1,4 @@ -# $Id: 00_SIGNALduino.pm v3.4.3 2020-04-07 21:20:33Z Sidey $ +# $Id: 00_SIGNALduino.pm v3.4.4 2020-04-07 21:20:33Z Sidey $ # # v3.4.3 - https://github.com/RFD-FHEM/RFFHEM/tree/dev-r34 # The module is inspired by the FHEMduino project and modified in serval ways for processing the incoming messages @@ -13,7 +13,7 @@ package main; -#use version 0.77; our $VERSION = version->declare('v3.4.3'); +#use version 0.77; our $VERSION = version->declare('v3.4.4'); my $missingModulSIGNALduino=""; @@ -36,7 +36,7 @@ use lib::SD_Protocols; use constant { - SDUINO_VERSION => "v3.4.4_dev+13042020", + SDUINO_VERSION => "v3.4.4_dev+14042020", SDUINO_INIT_WAIT_XQ => 1.5, # wait disable device SDUINO_INIT_WAIT => 2, SDUINO_INIT_MAXRETRY => 3, @@ -384,14 +384,14 @@ sub SIGNALduino_Define($$) { #Debug "hardware: $hardware" if ($debug); - if($dev eq "none") { + if($dev eq 'none') { Log3 $name, 1, "$name: Define, device is none, commands will be echoed only"; $attr{$name}{dummy} = 1; #return undef; } - if ($dev ne "none" && $dev =~ m/[a-zA-Z]/ && $dev !~ m/\@/) { # bei einer IP wird kein \@57600 angehaengt + if ($dev ne 'none' && $dev =~ m/[a-zA-Z]/ && $dev !~ m/\@/) { # bei einer IP wird kein \@57600 angehaengt $dev .= "\@57600"; } @@ -403,18 +403,18 @@ sub SIGNALduino_Define($$) { my $ret=undef; - InternalTimer(gettimeofday(), 'SIGNALduino_IdList',"sduino_IdList:$name",0); # verzoegern bis alle Attribute eingelesen sind + InternalTimer(gettimeofday(), \&SIGNALduino_IdList,"sduino_IdList:$name",0); # verzoegern bis alle Attribute eingelesen sind - if($dev ne "none") { - $ret = DevIo_OpenDev($hash, 0, "SIGNALduino_DoInit", 'SIGNALduino_Connect'); + if($dev ne 'none') { + $ret = DevIo_OpenDev($hash, 0, \&SIGNALduino_DoInit, \&SIGNALduino_Connect); } else { $hash->{DevState} = 'initialized'; - readingsSingleUpdate($hash, "state", "opened", 1); + readingsSingleUpdate($hash, 'state', 'opened', 1); } - $hash->{DMSG}="nothing"; - $hash->{LASTDMSG} = "nothing"; - $hash->{LASTDMSGID} = "nothing"; + $hash->{DMSG}='nothing'; + $hash->{LASTDMSG} = 'nothing'; + $hash->{LASTDMSGID} = 'nothing'; $hash->{TIME}=time(); $hash->{versionmodul} = SDUINO_VERSION; $hash->{versionProtocols} = lib::SD_Protocols::getProtocolVersion(); @@ -518,7 +518,7 @@ sub SIGNALduino_avrdude($) { $hash->{FLASH_RESULT}= "WARNING: avrdude created no log file"; # processed in tests } - DevIo_OpenDev($hash, 0, "SIGNALduino_DoInit", 'SIGNALduino_Connect'); + DevIo_OpenDev($hash, 0, \&SIGNALduino_DoInit, \&SIGNALduino_Connect); $hash->{helper}{avrdudelogs} .= "$name reopen started\n"; return $hash->{FLASH_RESULT}; } @@ -600,7 +600,7 @@ sub SIGNALduino_PrepareFlash { } $hash->{helper}{avrdudecmd} =~ s/\Q[BAUDRATE]\E/$baudrate/; $log .= "command: $hash->{helper}{avrdudecmd}\n\n"; - InternalTimer(gettimeofday() + 1,"SIGNALduino_avrdude",$name); + InternalTimer(gettimeofday() + 1,\&SIGNALduino_avrdude,$name); $hash->{helper}{avrdudelogs} = $log; return undef; } @@ -1034,7 +1034,7 @@ sub SIGNALduino_Get_delayed($) { if (exists($hash->{ucCmd}) && $hash->{ucCmd}->{timenow}+10 > time() ) { $hash->{logMethod}->($hash->{NAME}, 5, "$name: Get_delayed, ".join(" ",@cmds)." delayed"); - main::InternalTimer(main::gettimeofday() + main::SDUINO_GET_CONFIGQUERY_DELAY, "SIGNALduino_Get_delayed", "SIGNALduino_Get_delayed:$name:".join(" ",@cmds), 0); + main::InternalTimer(main::gettimeofday() + main::SDUINO_GET_CONFIGQUERY_DELAY, \&SIGNALduino_Get_delayed, "SIGNALduino_Get_delayed:$name:".join(" ",@cmds), 0); } else { delete($hash->{ucCmd}); $hash->{logMethod}->($hash->{NAME}, 5, "$name: Get_delayed, ".join(" ",@cmds)." executed"); @@ -1165,7 +1165,7 @@ sub SIGNALduino_CheckSendRawResponse #RemoveInternalTimer("HandleWriteQueue:$name"); delete($hash->{ucCmd}); #SIGNALduino_HandleWriteQueue("x:$name"); # Todo #823 on github - InternalTimer(gettimeofday() + 0.1, "SIGNALduino_HandleWriteQueue", "HandleWriteQueue:$name") if (scalar @{$hash->{QUEUE}} > 0 && InternalVal($name,"sendworking",0) == 0); + InternalTimer(gettimeofday() + 0.1, \&SIGNALduino_HandleWriteQueue, "HandleWriteQueue:$name") if (scalar @{$hash->{QUEUE}} > 0 && InternalVal($name,"sendworking",0) == 0); } return (undef); } @@ -1197,14 +1197,14 @@ sub SIGNALduino_ResetDevice($) { # Mit dem Linux-Kommando 'stty' die Port-Einstellungen setzen system("stty -F $dev ospeed 1200 ispeed 1200"); $hash->{helper}{resetInProgress}=1; - InternalTimer(gettimeofday()+10,"SIGNALduino_ResetDevice",$hash); + InternalTimer(gettimeofday()+10,\&SIGNALduino_ResetDevice,$hash); $hash->{logMethod}->($name, 3, "$name: ResetDevice, reopen delayed for 10 second"); return undef; } } else { delete($hash->{helper}{resetInProgress}); } - DevIo_OpenDev($hash, 0, "SIGNALduino_DoInit", 'SIGNALduino_Connect'); + DevIo_OpenDev($hash, 0, \&SIGNALduino_DoInit, \&SIGNALduino_Connect); return undef; } @@ -1243,8 +1243,8 @@ sub SIGNALduino_DoInit($) { RemoveInternalTimer($hash); #SIGNALduino_SimpleWrite($hash, "XQ"); # Disable receiver - InternalTimer(gettimeofday() + SDUINO_INIT_WAIT_XQ, "SIGNALduino_SimpleWrite_XQ", $hash, 0); - InternalTimer(gettimeofday() + SDUINO_INIT_WAIT, "SIGNALduino_StartInit", $hash, 0); + InternalTimer(gettimeofday() + SDUINO_INIT_WAIT_XQ, \&SIGNALduino_SimpleWrite_XQ, $hash, 0); + InternalTimer(gettimeofday() + SDUINO_INIT_WAIT, \&SIGNALduino_StartInit, $hash, 0); } # Reset the counter delete($hash->{XMIT_TIME}); @@ -1294,7 +1294,7 @@ sub SIGNALduino_StartInit($) { #DevIo_SimpleWrite($hash, "V\n",2); $hash->{DevState} = 'waitInit'; RemoveInternalTimer($hash); - InternalTimer(gettimeofday() + SDUINO_CMD_TIMEOUT, "SIGNALduino_CheckVersionResp", $hash, 0); + InternalTimer(gettimeofday() + SDUINO_CMD_TIMEOUT, \&SIGNALduino_CheckVersionResp, $hash, 0); } } @@ -1343,7 +1343,7 @@ sub SIGNALduino_CheckVersionResp # initialize keepalive $hash->{keepalive}{ok} = 0; $hash->{keepalive}{retry} = 0; - InternalTimer(gettimeofday() + SDUINO_KEEPALIVE_TIMEOUT, "SIGNALduino_KeepAlive", $hash, 0); + InternalTimer(gettimeofday() + SDUINO_KEEPALIVE_TIMEOUT, \&SIGNALduino_KeepAlive, $hash, 0); if ($hash->{version} =~ m/cc1101/) { $hash->{cc1101_available} = 1; $hash->{logMethod}->($name, 5, "$name: CheckVersionResp, cc1101 available"); @@ -1392,7 +1392,7 @@ sub SIGNALduino_CheckCmdResp($) { # initialize keepalive $hash->{keepalive}{ok} = 0; $hash->{keepalive}{retry} = 0; - InternalTimer(gettimeofday() + SDUINO_KEEPALIVE_TIMEOUT, "SIGNALduino_KeepAlive", $hash, 0); + InternalTimer(gettimeofday() + SDUINO_KEEPALIVE_TIMEOUT, \&SIGNALduino_KeepAlive, $hash, 0); $hash->{cc1101_available} = 1 if ($ver =~ m/cc1101/); } } @@ -1472,7 +1472,7 @@ sub SIGNALduino_AddSendQueue($$) { #SIGNALduino_Log3 $hash , 5, Dumper($hash->{QUEUE}); $hash->{logMethod}->($hash, 5,"$name: AddSendQueue, " . $hash->{NAME} . ": $msg (" . @{$hash->{QUEUE}} . ")"); - InternalTimer(gettimeofday() + 0.1, "SIGNALduino_HandleWriteQueue", "HandleWriteQueue:$name") if (scalar @{$hash->{QUEUE}} == 1 && InternalVal($name,"sendworking",0) == 0); + InternalTimer(gettimeofday() + 0.1, \&SIGNALduino_HandleWriteQueue, "HandleWriteQueue:$name") if (scalar @{$hash->{QUEUE}} == 1 && InternalVal($name,"sendworking",0) == 0); } ############################# package main @@ -1511,9 +1511,9 @@ sub SIGNALduino_SendFromQueue($$) { # else it will be sent too early by the SIGNALduino, resulting in a collision, or may the last command is not finished if (defined($hash->{ucCmd}->{cmd}) && $hash->{ucCmd}->{cmd} eq 'sendraw') { - InternalTimer(gettimeofday() + SDUINO_WRITEQUEUE_TIMEOUT, "SIGNALduino_HandleWriteQueue", "HandleWriteQueue:$name"); + InternalTimer(gettimeofday() + SDUINO_WRITEQUEUE_TIMEOUT, \&SIGNALduino_HandleWriteQueue, "HandleWriteQueue:$name"); } else { - InternalTimer(gettimeofday() + SDUINO_WRITEQUEUE_NEXT, "SIGNALduino_HandleWriteQueue", "HandleWriteQueue:$name"); + InternalTimer(gettimeofday() + SDUINO_WRITEQUEUE_NEXT, \&SIGNALduino_HandleWriteQueue, "HandleWriteQueue:$name"); } } @@ -1707,7 +1707,7 @@ sub SIGNALduino_KeepAlive($){ } $hash->{keepalive}{ok} = 0; - InternalTimer(gettimeofday() + SDUINO_KEEPALIVE_TIMEOUT, "SIGNALduino_KeepAlive", $hash); + InternalTimer(gettimeofday() + SDUINO_KEEPALIVE_TIMEOUT, \&SIGNALduino_KeepAlive, $hash); } @@ -2773,7 +2773,7 @@ sub SIGNALduino_Ready($) { if ($hash->{STATE} eq 'disconnected') { $hash->{DevState} = 'disconnected'; - return DevIo_OpenDev($hash, 1, "SIGNALduino_DoInit", 'SIGNALduino_Connect') + return DevIo_OpenDev($hash, 1, \&SIGNALduino_DoInit, \&SIGNALduino_Connect) } # This is relevant for windows/USB only diff --git a/UnitTest/tests/test_firmware_flash_1-definition.txt b/UnitTest/tests/test_firmware_flash_1-definition.txt index 836453276..4df79837d 100644 --- a/UnitTest/tests/test_firmware_flash_1-definition.txt +++ b/UnitTest/tests/test_firmware_flash_1-definition.txt @@ -56,7 +56,7 @@ defmod test_firmware_flash_1 UnitTest dummyDuino $IntTimer->unmock; ok($called_args[0] > gettimeofday(), "check arg 1 InternalTimer is called "); - is($called_args[1], "SIGNALduino_avrdude", "check arg 2 InternalTimer is called "); + is($called_args[1], \&SIGNALduino_avrdude, "check arg 2 InternalTimer is called (SIGNALduino_avrdude)"); is($called_args[2], $target, "check arg 3 InternalTimer is called "); $preparedavrdudecmd = $targetHash->{helper}{avrdudecmd}; @@ -127,7 +127,7 @@ defmod test_firmware_flash_1 UnitTest dummyDuino like($targetHash->{helper}{stty_output},qr/^open3: exec of stty -F none ospeed 1200 ispeed 1200 failed/m,"check if stty was called"); ok($called_args[0] > gettimeofday(), "check arg 1 InternalTimer is called "); - is($called_args[1], "SIGNALduino_avrdude", "check arg 2 InternalTimer is called "); + is($called_args[1], \&SIGNALduino_avrdude, "check arg 2 InternalTimer is called (SIGNALduino_avrdude)"); is($called_args[2], $target, "check arg 3 InternalTimer is called "); is($targetHash->{helper}{avrdudecmd},'avrdude -c avr109 -b 57600 -P none -p atmega32u4 -vv -D -U flash:w:./fhem/test.hex 2>[LOGFILE]',"check avrdude cmd"); diff --git a/UnitTest/tests/test_sub_SIGNALduino_Get_delayed-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_Get_delayed-definition.txt index cb2d733dc..afa19a2ea 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_Get_delayed-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_Get_delayed-definition.txt @@ -35,7 +35,7 @@ defmod test_sub_SIGNALduino_Get_delayed UnitTest dummyDuino ok($targetHash->{ucCmd}->{timenow}<=time(),"check timenow is set"); if ($InternalTimer->called) { - is(($InternalTimer->called_with)[1], "SIGNALduino_Get_delayed", "InternalTimer called with SIGNALduino_Get_delayed" ); + is(($InternalTimer->called_with)[1], \&SIGNALduino_Get_delayed, "InternalTimer called with SIGNALduino_Get_delayed" ); is(($InternalTimer->called_with)[2], "SIGNALduino_Get_delayed:$target:dummy_command", "InternalTimer called with SIGNALduino_Get_delayed" ); } $InternalTimer->unmock; @@ -52,7 +52,7 @@ defmod test_sub_SIGNALduino_Get_delayed UnitTest dummyDuino is($targetHash->{ucCmd}->{timenow},$reftimenow,"check timenow isn't changed"); if ($InternalTimer->called) { - is(($InternalTimer->called_with)[1], "SIGNALduino_Get_delayed", "InternalTimer called with SIGNALduino_Get_delayed" ); + is(($InternalTimer->called_with)[1], \&SIGNALduino_Get_delayed, "InternalTimer called with SIGNALduino_Get_delayed" ); is(($InternalTimer->called_with)[2], "SIGNALduino_Get_delayed:$target:dummy_command", "InternalTimer called with SIGNALduino_Get_delayed" ); } $InternalTimer->unmock; From e1a34b7c9b652acf71c4fee03c060b823e8f709a Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 14 Apr 2020 21:10:47 +0000 Subject: [PATCH 04/35] Automatic updated controls and CHANGED --- CHANGED | 3 +++ controls_signalduino.txt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index 003bbbcc9..ff396a2c9 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,6 @@ +2020-04-14 - 00_SIGNALduino.pm + +Changed stringrefs to coderefs 2020-04-13 - Bump dev-r34 to v3.4.4 2020-04-13 - Merge remote-tracking branch 'remotes/origin/dev-r34' into v3.4.3 diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 18eade5ae..ddfc8d4cb 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,4 +1,4 @@ -UPD 2020-04-13_22:59:15 226643 FHEM/00_SIGNALduino.pm +UPD 2020-04-14_23:06:23 226643 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2019-12-26_22:50:15 19839 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm From 9166c0c9249729f07d7c570b540236c10a4e8953 Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Wed, 15 Apr 2020 23:26:20 +0200 Subject: [PATCH 05/35] 00_SIGNALduino.pm some operator fixes #835 --- FHEM/00_SIGNALduino.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/FHEM/00_SIGNALduino.pm b/FHEM/00_SIGNALduino.pm index 2065369d3..22a9ad183 100644 --- a/FHEM/00_SIGNALduino.pm +++ b/FHEM/00_SIGNALduino.pm @@ -3890,7 +3890,7 @@ sub SIGNALduino_OSV2 { } $rvosv2byte =~ tr/10/01/; - if (length($rvosv2byte) eq 8) { + if (length($rvosv2byte) == 8) { $osv2hex=$osv2hex.sprintf('%02X', oct("0b$rvosv2byte")) ; } else { $osv2hex=$osv2hex.sprintf('%X', oct("0b$rvosv2byte")) ; @@ -4002,11 +4002,11 @@ sub SIGNALduino_OSV1() { my $newBitData = "00001010"; # Byte 0: Id1 = 0x0A $newBitData .= "01001101"; # Byte 1: Id2 = 0x4D my $channel = substr($bitData,6,2); # Byte 2 h: Channel - if ($channel == "00") { # in 0 LSB first + if ($channel eq "00") { # in 0 LSB first $newBitData .= "0001"; # out 1 MSB first - } elsif ($channel == "10") { # in 4 LSB first + } elsif ($channel eq "10") { # in 4 LSB first $newBitData .= "0010"; # out 2 MSB first - } elsif ($channel == "01") { # in 4 LSB first + } elsif ($channel eq "01") { # in 4 LSB first $newBitData .= "0011"; # out 3 MSB first } else { # in 8 LSB first return (-1,"$name: OSV1 - ERROR channel not valid: $channel"); From 463eb265f5588c5b8aa6c2f379011473101c448c Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 15 Apr 2020 21:26:48 +0000 Subject: [PATCH 06/35] Automatic updated controls and CHANGED --- CHANGED | 3 +++ controls_signalduino.txt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index ff396a2c9..a8a03f465 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,6 @@ +2020-04-15 - 00_SIGNALduino.pm + +some operator fixes #835 2020-04-14 - 00_SIGNALduino.pm Changed stringrefs to coderefs diff --git a/controls_signalduino.txt b/controls_signalduino.txt index ddfc8d4cb..e9cc07cb6 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,4 +1,4 @@ -UPD 2020-04-14_23:06:23 226643 FHEM/00_SIGNALduino.pm +UPD 2020-04-15_23:26:20 226643 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2019-12-26_22:50:15 19839 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm From f433d0845638534e078744739fbfeeacd9aa462e Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Wed, 15 Apr 2020 23:37:19 +0200 Subject: [PATCH 07/35] 90_SIGNALduino_un.pm Fixed some operators --- FHEM/90_SIGNALduino_un.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FHEM/90_SIGNALduino_un.pm b/FHEM/90_SIGNALduino_un.pm index efcd1adec..832eb45fa 100644 --- a/FHEM/90_SIGNALduino_un.pm +++ b/FHEM/90_SIGNALduino_un.pm @@ -102,7 +102,7 @@ SIGNALduino_un_Parse($$) my $bitData= unpack("B$blen", pack("H$hlen", $rawData)); Log3 $hash, 4, "$name converted to bits: $bitData"; - if ($protocol == "21" && length($bitData)>=32) ##Einhell doorshutter + if ($protocol == 21 && length($bitData)>=32) ##Einhell doorshutter { Log3 $hash, 4, "$name / Einhell doorshutter received"; @@ -115,7 +115,7 @@ SIGNALduino_un_Parse($$) Log3 $hash, 4, "$name found doorshutter from Einhell. id=$id, channel=$channel, direction=$dir"; - } elsif ($protocol == "23" && length($bitData)>=32) ##Perl Sensor + } elsif ($protocol == 23 && length($bitData)>=32) ##Perl Sensor { my $SensorTyp = "perl NC-7367?"; my $id = oct ("0b".substr($bitData,4,4)); From ea7d0da4abfaeb3edef279ce69f82393464bea67 Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Wed, 15 Apr 2020 23:37:36 +0200 Subject: [PATCH 08/35] 14_SD_WS09.pm Fixed some operators --- FHEM/14_SD_WS09.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/FHEM/14_SD_WS09.pm b/FHEM/14_SD_WS09.pm index 324088b25..b2d8ffe80 100644 --- a/FHEM/14_SD_WS09.pm +++ b/FHEM/14_SD_WS09.pm @@ -225,7 +225,7 @@ sub SD_WS09_Parse($$) { Log3 $iohash, 5, "$name: SD_WS09_Parse_0 whid=$whid"; # A Wettermeldungen - if( $whid == "1010" ){ + if( $whid eq '1010' ){ Log3 $iohash, 4, "$name: SD_WS09_Parse_1 msg=$sensdata length:".length($sensdata) ; $model = "WH1080"; $id = SD_WS09_bin2dec(substr($sensdata,4,8)); @@ -244,7 +244,7 @@ sub SD_WS09_Parse($$) { Log3 $iohash, 4, "$name: SD_WS09_Parse_5 ".$model." id:$id, bat:$bat, temp=$temp, hum=$hum, winddir=$windDirection:$windDirectionText wS=$windSpeed, wG=$windguest, rain=$rain"; # B DCF-77 Zeitmeldungen vom Sensor - } elsif ( $whid == "1011" ) { + } elsif ( $whid eq '1011' ) { my $hrs1 = substr($sensdata,16,8); my $hrs; my $mins; @@ -267,7 +267,7 @@ sub SD_WS09_Parse($$) { return $name; # 7 UV/Solar Meldungen vom Sensor - } elsif ( $whid == "0111" ) { + } elsif ( $whid eq '0111' ) { # Fine Offset (Solar Data) message BYTE offsets (within receive buffer) # Examples= FF 75 B0 55 00 97 8E 0E *CRC*OK* # =FF 75 B0 55 00 8F BE 92 *CRC*OK* @@ -289,9 +289,9 @@ sub SD_WS09_Parse($$) { } } else { # es wird eine CTW600 angenommen - $syncpos= index($bitData,"11111110"); #7x1 1x0 preamble + $syncpos= index($bitData,'11111110'); #7x1 1x0 preamble $wh = substr($bitData,0,8); - if ( $wh == "11111110" && length($bitData) > $minL1 ) { + if ( $wh eq '11111110' && length($bitData) > $minL1 ) { Log3 $iohash, 4, "$name: SD_WS09_Parse_11 CTW600 EXIT: msg=$bitData wh:$wh length:".length($bitData) ; $sensdata = substr($bitData,$syncpos+8); Log3 $iohash, 4, "$name: SD_WS09_Parse_12 CTW WH=$wh msg=$sensdata syncp=$syncpos length:".length($sensdata) ; From e994338d0c9b17cbeab20702b9043ee868eda254 Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Wed, 15 Apr 2020 23:37:43 +0200 Subject: [PATCH 09/35] 14_SD_WS.pm Fixed some operators --- FHEM/14_SD_WS.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FHEM/14_SD_WS.pm b/FHEM/14_SD_WS.pm index 3caeb4e6c..b2b4ee0ea 100644 --- a/FHEM/14_SD_WS.pm +++ b/FHEM/14_SD_WS.pm @@ -865,14 +865,14 @@ sub SD_WS_Parse($$) my $bitData = unpack("B$blen", pack("H$hlen", $rawData)); my $temptyp = substr($bitData,0,8); - if( $temptyp == "11111110" ) { + if( $temptyp eq '11111110' ) { $rawData = SD_WS_WH2SHIFT($rawData); $msg = $msg_vor.$rawData; $bitData = unpack("B$blen", pack("H$hlen", $rawData)); Log3 $iohash, 4, "$name: SD_WS_WH2_1 msg=$msg length:".length($bitData) ; Log3 $iohash, 4, "$name: SD_WS_WH2_1 bitdata: $bitData" ; } else{ - if ( $temptyp == "11111101" ) { + if ( $temptyp eq '11111101' ) { $rawData = SD_WS_WH2SHIFT($rawData); $rawData = SD_WS_WH2SHIFT($rawData); $msg = $msg_vor.$rawData; @@ -882,7 +882,7 @@ sub SD_WS_Parse($$) } } - if( $temptyp == "11111111" ) { + if( $temptyp eq '11111111' ) { $vorpre = 8; }else{ Log3 $iohash, 4, "$name: SD_WS_WH2_4 Error kein WH2: Typ: $temptyp" ; From 49578b0898d5bcf3d2db84cc930b29cfbc09b93d Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 15 Apr 2020 21:39:31 +0000 Subject: [PATCH 10/35] Automatic updated controls and CHANGED --- CHANGED | 1 + controls_signalduino.txt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index a8a03f465..8497df776 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,4 @@ +2020-04-15 - Merge branch 'dev-r34_operatorFixes' of github.com:RFD-FHEM/RFFHEM into dev-r34_operatorFixes 2020-04-15 - 00_SIGNALduino.pm some operator fixes #835 diff --git a/controls_signalduino.txt b/controls_signalduino.txt index e9cc07cb6..98aacb037 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -8,11 +8,11 @@ UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2019-12-27_17:45:04 23464 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm UPD 2020-04-08_22:57:45 132733 FHEM/14_SD_UT.pm -UPD 2020-04-12_22:14:20 68829 FHEM/14_SD_WS.pm +UPD 2020-04-15_23:37:43 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm -UPD 2020-04-07_23:43:04 35356 FHEM/14_SD_WS09.pm +UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm -UPD 2020-01-06_21:42:53 15086 FHEM/90_SIGNALduino_un.pm +UPD 2020-04-15_23:37:19 15082 FHEM/90_SIGNALduino_un.pm UPD 2020-03-30_21:01:10 165155 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From d3719d04901f2586c8d070490073d7aacdafb4d1 Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Wed, 15 Apr 2020 23:40:34 +0200 Subject: [PATCH 11/35] 10_SD_GT.pm fixes operator #836 --- FHEM/10_SD_GT.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FHEM/10_SD_GT.pm b/FHEM/10_SD_GT.pm index b8b68279a..6e013900f 100644 --- a/FHEM/10_SD_GT.pm +++ b/FHEM/10_SD_GT.pm @@ -286,7 +286,7 @@ sub Parse($$) { } Log3 $ioname, 4, "$ioname: SD_GT_Parse $rawData, found version $version with systemCode $systemCode"; - if ($version == 0 && $systemCode eq 0) { # Version und systemCode nicht gefunden + if ($version == 0 && $systemCode == 0) { # Version und systemCode nicht gefunden $devicedef = "LEARN"; } else { # Version und systemCode gefunden my $statecode = substr($rawData,4,1); From fc1705736b5c79a41b4bf2079e8d9199e7dbf7f1 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 15 Apr 2020 21:40:57 +0000 Subject: [PATCH 12/35] Automatic updated controls and CHANGED --- CHANGED | 1 + controls_signalduino.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index 8497df776..f42f9f60e 100644 --- a/CHANGED +++ b/CHANGED @@ -1,4 +1,5 @@ 2020-04-15 - Merge branch 'dev-r34_operatorFixes' of github.com:RFD-FHEM/RFFHEM into dev-r34_operatorFixes +2020-04-15 - Merge branch 'dev-r34_operatorFixes' of github.com:RFD-FHEM/RFFHEM into dev-r34_operatorFixes 2020-04-15 - 00_SIGNALduino.pm some operator fixes #835 diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 98aacb037..feb2152b9 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,6 +1,6 @@ UPD 2020-04-15_23:26:20 226643 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm -UPD 2019-12-26_22:50:15 19839 FHEM/10_SD_GT.pm +UPD 2020-04-15_23:40:34 19839 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm UPD 2019-12-27_17:45:04 13627 FHEM/14_FLAMINGO.pm UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm From 4351e39109873bab27eefe703ee8f7b4d79e2786 Mon Sep 17 00:00:00 2001 From: sidey79 <7968127+sidey79@users.noreply.github.com> Date: Thu, 16 Apr 2020 21:15:43 +0200 Subject: [PATCH 13/35] 10_SD_GT.pm Fix compare against string --- FHEM/10_SD_GT.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FHEM/10_SD_GT.pm b/FHEM/10_SD_GT.pm index 6e013900f..df93d7818 100644 --- a/FHEM/10_SD_GT.pm +++ b/FHEM/10_SD_GT.pm @@ -286,7 +286,7 @@ sub Parse($$) { } Log3 $ioname, 4, "$ioname: SD_GT_Parse $rawData, found version $version with systemCode $systemCode"; - if ($version == 0 && $systemCode == 0) { # Version und systemCode nicht gefunden + if ($version == 0 && $systemCode eq '0') { # Version und systemCode nicht gefunden $devicedef = "LEARN"; } else { # Version und systemCode gefunden my $statecode = substr($rawData,4,1); From 40a83b8264ba75585be7706def62f07a9dd5f160 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 16 Apr 2020 19:16:09 +0000 Subject: [PATCH 14/35] Automatic updated controls and CHANGED --- CHANGED | 3 +++ controls_signalduino.txt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index f42f9f60e..eb6b56950 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,6 @@ +2020-04-16 - 10_SD_GT.pm + +Fix compare against string 2020-04-15 - Merge branch 'dev-r34_operatorFixes' of github.com:RFD-FHEM/RFFHEM into dev-r34_operatorFixes 2020-04-15 - Merge branch 'dev-r34_operatorFixes' of github.com:RFD-FHEM/RFFHEM into dev-r34_operatorFixes 2020-04-15 - 00_SIGNALduino.pm diff --git a/controls_signalduino.txt b/controls_signalduino.txt index feb2152b9..6388fba7e 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,6 +1,6 @@ UPD 2020-04-15_23:26:20 226643 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm -UPD 2020-04-15_23:40:34 19839 FHEM/10_SD_GT.pm +UPD 2020-04-16_21:15:43 19841 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm UPD 2019-12-27_17:45:04 13627 FHEM/14_FLAMINGO.pm UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm From b6536d3035ad961b69a6e26cb5a368b70aa6aa6f Mon Sep 17 00:00:00 2001 From: HomeAutoUser Date: Thu, 16 Apr 2020 22:08:52 +0200 Subject: [PATCH 15/35] dev-r34 revised tests to V2 (#837) tests revised to Test2 --- UnitTest/tests/test_1-definition.txt | 9 +-- UnitTest/tests/test_3-definition.txt | 7 ++- UnitTest/tests/test_MS_2-definition.txt | 5 +- .../tests/test_SD_Protocols-definition.txt | 29 +++++---- UnitTest/tests/test_SD_RSL-definition.txt | 12 ++-- .../tests/test_SD_WS07_devices-definition.txt | 16 ++--- .../tests/test_defineDefaults-definition.txt | 7 ++- .../tests/test_developid_1-definition.txt | 53 ++++++++-------- .../test_firmware_download_1-definition.txt | 26 ++++---- .../test_firmware_flash_1-definition.txt | 61 +++++++++---------- .../test_get_availableFirmware-definition.txt | 5 +- UnitTest/tests/test_logging-definition.txt | 8 ++- .../tests/test_module_devices-template.txt | 2 +- .../tests/test_modulematch_1-definition.txt | 9 ++- UnitTest/tests/test_modules-definition.txt | 7 ++- UnitTest/tests/test_mu_1-definition.txt | 5 +- UnitTest/tests/test_reset_1-definition.txt | 33 +++++----- ...NALduino_CheckCcregResponse-definition.txt | 13 ++-- ...ub_SIGNALduino_CheckCmdResp-definition.txt | 39 ++++++------ ...GNALduino_CheckCmdsResponse-definition.txt | 5 +- ...ALduino_CheckUptimeResponse-definition.txt | 10 +-- ...IGNALduino_CheckVersionResp-definition.txt | 15 +++-- ...ALduino_CheckccConfResponse-definition.txt | 7 ++- ...uino_CheckccPatableResponse-definition.txt | 22 +++---- ...st_sub_SIGNALduino_Dispatch-definition.txt | 3 + ...b_SIGNALduino_FingerprintFn-definition.txt | 5 +- ...no_GetResponseUpdateReading-definition.txt | 7 ++- ...IGNALduino_LoadProtocolHash-definition.txt | 18 +++--- .../test_sub_SIGNALduino_MCTFA-definition.txt | 15 +++-- .../test_sub_SIGNALduino_OSV2-definition.txt | 15 ++--- ...st_sub_SIGNALduino_Parse_MC-definition.txt | 13 ++-- ...st_sub_SIGNALduino_Parse_MU-definition.txt | 3 + ...t_sub_SIGNALduino_StartInit-definition.txt | 24 ++++---- ...t_sub_SIGNALduino_callsub_1-definition.txt | 19 +++--- ...NALduino_getAttrDevelopment-definition.txt | 22 ++++--- 35 files changed, 309 insertions(+), 240 deletions(-) diff --git a/UnitTest/tests/test_1-definition.txt b/UnitTest/tests/test_1-definition.txt index 97c9184eb..bc01db9d4 100644 --- a/UnitTest/tests/test_1-definition.txt +++ b/UnitTest/tests/test_1-definition.txt @@ -1,9 +1,12 @@ defmod test_1 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{is}; + my $rmsg="MS;P1=502;P2=-9212;P3=-1939;P4=-3669;D=1234;CP=1;SP=2;"; my %signal_parts=SIGNALduino_Split_Message($rmsg,$targetHash->{NAME}); - + is( $signal_parts{messagetype}, "MS", "SIGNALduino_Split_Message check MS messagetype" ); is( $signal_parts{rawData}, "1234", "SIGNALduino_Split_Message check MS rawData" ); is( $signal_parts{syncidx}, "2", "SIGNALduino_Split_Message check MS syncIdx" ); @@ -15,14 +18,12 @@ defmod test_1 UnitTest dummyDuino is( $signal_parts{messagetype}, "MU", "SIGNALduino_Split_Message check MU messagetype" ); is( $signal_parts{rawData}, "1234", "SIGNALduino_Split_Message check MU rawData" ); is( $signal_parts{pattern}{1}, "502", "SIGNALduino_Split_Message check MU pattern 1"); - + $rmsg="MC;LL=-1074;LH=889;SL=-599;SH=368;D=55AB;C=488;L=168;R=246;"; %signal_parts=SIGNALduino_Split_Message($rmsg,$targetHash->{NAME}); is( $signal_parts{messagetype}, "MC", "SIGNALduino_Split_Message check MC messagetype" ); is( $signal_parts{rawData}, "55AB", "SIGNALduino_Split_Message check MC rawData" ); is( $signal_parts{pattern}{LH}, "889", "SIGNALduino_Split_Message check MC pattern LH" ); is( $signal_parts{pattern}{SL}, "-599", "SIGNALduino_Split_Message check MC pattern SH" ); - - } ); diff --git a/UnitTest/tests/test_3-definition.txt b/UnitTest/tests/test_3-definition.txt index b231eaa11..dee3a0303 100644 --- a/UnitTest/tests/test_3-definition.txt +++ b/UnitTest/tests/test_3-definition.txt @@ -1,10 +1,13 @@ defmod test_3 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{is}; + my $mock; $mock = Mock::Sub->new; my $Dispatch; - $Dispatch = $mock->mock("Dispatch"); + $Dispatch = $mock->mock("Dispatch"); my $rmsg="MS;P1=502;P2=-9212;P3=-1939;P4=-3669;D=12131413141414131313131313141313131313131314141414141413131313141413131413;CP=1;SP=2;"; my %signal_parts=SIGNALduino_Split_Message($rmsg,$targetHash->{NAME}); @@ -14,6 +17,6 @@ defmod test_3 UnitTest dummyDuino if ($Dispatch->called_count){ my @called_args = $Dispatch->called_with; is( $called_args[1], "s5C080FC32000", "Parse_MS dispatched message for Module CUL_TCM_97001" ); - } + } } ); diff --git a/UnitTest/tests/test_MS_2-definition.txt b/UnitTest/tests/test_MS_2-definition.txt index b89925617..3bf83b381 100644 --- a/UnitTest/tests/test_MS_2-definition.txt +++ b/UnitTest/tests/test_MS_2-definition.txt @@ -1,5 +1,8 @@ defmod test_MS_2 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is isnt }; + my $mock = Mock::Sub->new; my $SD_Dispatch = $mock->mock("SIGNALduno_Dispatch"); @@ -18,7 +21,7 @@ defmod test_MS_2 UnitTest dummyDuino ( $SD_Dispatch->reset(); my $rmsg=$testData->{input}; - plan tests => scalar @{$testData->{output}}; + plan(scalar @{$testData->{output}}); my %signal_parts=SIGNALduino_Split_Message($rmsg,$targetHash->{NAME}); is(SIGNALduino_Parse_MS($targetHash, $targetHash, $targetHash->{NAME}, $rmsg,%signal_parts),$testData->{output}[0] ,"check return code SIGNALduino_Parse_MS") if (defined($testData->{output}[0])); is($SD_Dispatch->called_count, $testData->{output}[1], "check number of dispatch attempts") if (defined($testData->{output}[1])); diff --git a/UnitTest/tests/test_SD_Protocols-definition.txt b/UnitTest/tests/test_SD_Protocols-definition.txt index db32bed50..a7bac2bc3 100644 --- a/UnitTest/tests/test_SD_Protocols-definition.txt +++ b/UnitTest/tests/test_SD_Protocols-definition.txt @@ -3,10 +3,12 @@ defmod test_SD_Protocols UnitTest dummyDuino { require_ok('lib::SD_Protocols'); require lib::SD_Protocols; + use Test2::V0; + use Test2::Tools::Compare qw{ is isnt like }; subtest 'lib SD_Prococols test sub LoadHash() ' => sub { - plan tests => 5; + plan(5); my $ret; $ret=lib::SD_Protocols::LoadHash("./dummy.pm"); @@ -19,52 +21,49 @@ defmod test_SD_Protocols UnitTest dummyDuino like($ret->{9999}{name},qr/Unittest/,"valid element hashref"); is($ret->{error},undef,"valid file error check"); - }; subtest 'lib SD_Prococols test sub new() ' => sub { - plan tests => 3; + plan(3); isnt(lib::SD_Protocols::new("dummy.pm"),undef," not existing filename provided "); isnt(lib::SD_Protocols::new("$attr{global}{modpath}/FHEM/lib/test_loadprotohash-nok.pm"),undef,"file with syntax error "); is(lib::SD_Protocols::new("$attr{global}{modpath}/FHEM/lib/test_loadprotohash-ok.pm"),undef,"valid file checked "); }; - subtest 'lib SD_Prococols test sub exists() ' => sub { - plan tests => 2; + plan(2); ok(lib::SD_Protocols::exists(9999),"exists() check existing protocol "); ok(!lib::SD_Protocols::exists(0),"exists() check not existing protocol "); }; - + subtest 'lib SD_Prococols test sub getKeys() ' => sub { - plan tests => 3; + plan(3); cmp_ok( lib::SD_Protocols::getKeys(),'>=',"9",' more than 8 keys returnd' ); like(join(",",lib::SD_Protocols::getKeys()), qr/9999/, 'protocol id 9999 is in keys'); ok( !grep(/^0$/, lib::SD_Protocols::getKeys()), 'protocol id 0 is not in keys' ); - }; - + subtest 'lib SD_Prococols test sub checkProperty() ' => sub { - plan tests => 3; + plan(3); is(lib::SD_Protocols::checkProperty(9999,"developId"), 'm', 'check existing property developID'); is(lib::SD_Protocols::checkProperty(9999,"clockabs"), undef, 'check missing property clockabs'); is(lib::SD_Protocols::checkProperty(9999,"clockabs",200), 200, 'check missing property clockabs with default'); }; subtest 'lib SD_Prococols test sub getProperty() ' => sub { - plan tests => 2; + plan(2); is(lib::SD_Protocols::getProperty(9999,"developId"), 'm', 'check existing property developID'); is(lib::SD_Protocols::getProperty(9999,"clockabs"), undef, 'check missing property clockabs'); }; - + subtest 'lib SD_Prococols test sub setDefaults() ' => sub { - plan tests => 2; + plan(2); is_deeply(lib::SD_Protocols::getProperty(9990,"method"), \&lib::SD_Protocols::MCRAW, 'check if default for method is applied '); is(defined(&{lib::SD_Protocols::getProperty(9989,"method")}), '', 'check if default does not override existing method '); }; - + subtest 'lib SD_Prococols test sub MCRAW() ' => sub { - plan tests => 2; + plan(2); TODO: { local $TODO = "Syntax fix needed"; } diff --git a/UnitTest/tests/test_SD_RSL-definition.txt b/UnitTest/tests/test_SD_RSL-definition.txt index 243c5e89b..5c0c16936 100644 --- a/UnitTest/tests/test_SD_RSL-definition.txt +++ b/UnitTest/tests/test_SD_RSL-definition.txt @@ -6,9 +6,12 @@ setstate RSL_411B11_0_0 off;; setstate RSL_411B11_0_0 2018-06-14 18:24:38 state off;; defmod test_SD_RSL UnitTest RSL_411B11_0_0 ( -{ +{ + use Test2::V0; + use Test2::Tools::Compare qw{ is like }; + subtest 'Test set questionmark' => sub { - plan tests => 4; + plan(4); my $ret=SD_RSL_Set($targetHash,"RSL_411B11_0_0","?"); like($ret,qr/^Unknown argument ?.*/,"check return Unknown argument"); like($ret,qr/on/,"check return contains on command"); @@ -17,14 +20,13 @@ defmod test_SD_RSL UnitTest RSL_411B11_0_0 ( }; subtest 'Test set to less args' => sub { - plan tests => 1; + plan(1); my $ret=SD_RSL_Set($targetHash,"RSL_411B11_0_0"); like($ret,qr/needs at least one argument$/,"check return Unknown argument"); }; - subtest 'Test set on/off/toggle cmds' => sub { - plan tests => 3; + plan(3); my $ret=SD_RSL_Set($targetHash,"RSL_411B11_0_0","on"); is(ReadingsVal($target,"state","undef"),"on","check reading state for on after on"); diff --git a/UnitTest/tests/test_SD_WS07_devices-definition.txt b/UnitTest/tests/test_SD_WS07_devices-definition.txt index 7574e37d2..c62e9cf8c 100644 --- a/UnitTest/tests/test_SD_WS07_devices-definition.txt +++ b/UnitTest/tests/test_SD_WS07_devices-definition.txt @@ -2,7 +2,8 @@ defmod test_SD_WS07_devices UnitTest dummyDuino ( { use Test2::V0; use Test2::Tools::Compare qw{is}; - use JSON; + use JSON; + ## for online testsytem: defmod test_SD_WS07_devices UnitTest dummyDuino ## my $testDataArray; @@ -11,7 +12,7 @@ defmod test_SD_WS07_devices UnitTest dummyDuino ( my $sensorname="SD_WS07_TH_1"; subtest "Check autocreate $sensorname" => sub { - plan tests => 3; + plan(3); Dispatch($targetHash,"P7#6300C6F0B"); ok(!IsDevice($sensorname), "check sensor not created with single dispatch"); sleep 2; @@ -20,10 +21,10 @@ defmod test_SD_WS07_devices UnitTest dummyDuino ( CommandDelete(undef,$sensorname); ok(!IsDevice($sensorname), "check sensor deleted correctly"); }; - + sleep 2; subtest "Check Dispatch() with existing definition only channel $sensorname" => sub { - plan tests => 4 ; + plan(4); ok(!IsDevice($sensorname), "check sensor deleted correctly"); CommandDefine(undef,"$sensorname SD_WS07 1"); ok(IsDevice($sensorname), "check sensor not created with single dispatch"); @@ -34,8 +35,8 @@ defmod test_SD_WS07_devices UnitTest dummyDuino ( }; sleep 2; - subtest "Check Dispatch() with existing definition model_channel $sensorname" => sub { - plan tests => 4; + subtest "Check Dispatch() with existing definition model_channel $sensorname" => sub { + plan(4); ok(!IsDevice($sensorname), "check sensor deleted correctly"); CommandDefine(undef,"$sensorname SD_WS07 SD_WS07_TH_1"); @@ -50,7 +51,7 @@ defmod test_SD_WS07_devices UnitTest dummyDuino ( sleep 2; subtest "Check autocreate with longid $sensorname" => sub { CommandAttr(undef,"$target longids 1"); - plan tests => 4; + plan(4); Dispatch($targetHash,"P7#6300C6F0B"); ok(!IsDevice($sensorname), "check sensor not created with single dispatch"); @@ -92,7 +93,6 @@ defmod test_SD_WS07_devices UnitTest dummyDuino ( #diag explain $tData; subtest "Checking module: $testSet->{module} device: $testSet->{name} TestNo: $tID " => sub { - if (IsDevice($tData->{internals}{NAME})) { plan(2); # one for readings and one for internals note("device is already defined on system, clearing readings"); diff --git a/UnitTest/tests/test_defineDefaults-definition.txt b/UnitTest/tests/test_defineDefaults-definition.txt index 234c11e21..f8d77c8d3 100644 --- a/UnitTest/tests/test_defineDefaults-definition.txt +++ b/UnitTest/tests/test_defineDefaults-definition.txt @@ -1,12 +1,14 @@ defmod test_defineDefaults UnitTest dummyDuino ( { - CommandDefMod(undef,"-temporary testDuino SIGNALduino none"); + use Test2::V0; + use Test2::Tools::Compare qw{is}; + CommandDefMod(undef,"-temporary testDuino SIGNALduino none"); subtest 'Check internal defaults ' => sub { plan tests => 5; my $name ="testDuino"; - + use lib::SD_Protocols; is(InternalVal($name,"DeviceName", undef),"none","check DeviceName"); @@ -15,6 +17,5 @@ defmod test_defineDefaults UnitTest dummyDuino ( is(InternalVal($name,"versionmodul", undef),SDUINO_VERSION,"check versionmodul"); is(InternalVal($name,"versionProtocols", undef),lib::SD_Protocols::getProtocolVersion(),"check versionProtocols"); }; - }; ); diff --git a/UnitTest/tests/test_developid_1-definition.txt b/UnitTest/tests/test_developid_1-definition.txt index 9ec5b9e4d..8e7e1ff6e 100644 --- a/UnitTest/tests/test_developid_1-definition.txt +++ b/UnitTest/tests/test_developid_1-definition.txt @@ -1,10 +1,12 @@ defmod test_developid_1 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{is isnt}; my %ProtocolListTest = SIGNALduino_LoadProtocolHash("$attr{global}{modpath}/FHEM/lib/test_loadprotohash-ok.pm"); is($ProtocolListTest{error},undef,"load test protocol hash "); - + foreach my $id (qw/9999 9998 9997 9996/) { is($ProtocolListTest{$id}{id},$id,"id $id exists"); @@ -16,7 +18,7 @@ defmod test_developid_1 UnitTest dummyDuino ( } %{$local_ProtocolListSIGNALduino} = ( %ProtocolListTest); - + my $msg; my $regex; my $regex_matched=0; @@ -37,7 +39,7 @@ defmod test_developid_1 UnitTest dummyDuino ( my $subTestName='SIGNALduino_IdList developid "m" skip scenarios'; subtest $subTestName => sub { Log3 $name, 3 ,$subTestName." |->"; - plan tests => 3; + plan(3); $regex_matched=0; $regex=$ProtocolListTest{'9999'}{id}; @@ -61,7 +63,7 @@ defmod test_developid_1 UnitTest dummyDuino ( $subTestName='SIGNALduino_IdList developid "y" skip scenarios'; subtest $subTestName => sub { Log3 $name, 3 ,$subTestName." |->"; - plan tests => 4; + plan(4); $regex_matched=0; $regex=$ProtocolListTest{'9997'}{id}; @@ -92,7 +94,7 @@ defmod test_developid_1 UnitTest dummyDuino ( subtest $subTestName => sub { Log3 $name, 3 ,$subTestName." |->"; - plan tests => 4; + plan(4); $regex=$ProtocolListTest{'9996'}{id}; $msg="attr whitelist=\"\", development=\"\"" ; @@ -124,15 +126,15 @@ defmod test_developid_1 UnitTest dummyDuino ( $subTestName='SIGNALduino_IdList developid "m" not skipped scenarios'; subtest $subTestName => sub { Log3 $name, 3 ,$subTestName." |->"; - plan tests => 2; + plan(2); $regex_matched=0; $regex=$ProtocolListTest{'9999'}{id}; - + $msg="attr whitelist=\"\", development=\"m9999\"" ; SIGNALduino_IdList("x:$target","","","m9999"); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id 9999, they should not be there"); $regex_matched=0; - + $msg="attr whitelist=\"\", development=\"75 m9999 u73\"" ; SIGNALduino_IdList("x:$target","","","m75 m9999 u73"); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id 9999, they should not be there"); @@ -144,70 +146,65 @@ defmod test_developid_1 UnitTest dummyDuino ( $subTestName='SIGNALduino_IdList developid "y" not skipped scenarios'; subtest $subTestName => sub { Log3 $name, 3 ,$subTestName." |->"; - plan tests => 5; + plan(5); $regex_matched=0; $regex=$ProtocolListTest{'9997'}{id}; - + $msg="attr whitelist=\"\", development=\"1\"" ; SIGNALduino_IdList("x:$target","","","1"); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id 9997, they should not be there"); $regex_matched=0; - + $msg="attr whitelist=\"\", development=\"y\"" ; SIGNALduino_IdList("x:$target","","","y"); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id 9997, they should not be there"); $regex_matched=0; - + $msg="attr whitelist=\"\", development=\"y9997\"" ; SIGNALduino_IdList("x:$target","","","y9997"); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id 9997, they should not be there"); $regex_matched=0; - + $msg="attr whitelist=\"\", development=\"m75 y9997 u73\"" ; SIGNALduino_IdList("x:$target","","","m75 y9997 u73"); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id 9997, they should not be there"); $regex_matched=0; - + $msg="attr whitelist=\"9999\", development=\"\"" ; SIGNALduino_IdList("x:$target","9997","",""); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id 9997, they should not be there"); $regex_matched=0; - + $regex_matched=0; Log3 $name, 3 ,$subTestName." <--|"; - }; $subTestName='SIGNALduino_IdList multiple development statements'; subtest $subTestName => sub { Log3 $name, 3 ,$subTestName." |->"; - - - plan tests => 2; + + plan(2); $regex_matched=0; $regex=$ProtocolListTest{'9997'}{id}; - + $msg="attr whitelist=\"\", development=\"y m9999\"" ; SIGNALduino_IdList("x:$target","","","y m9999"); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id $regex, this should not be skipped"); $regex_matched=0; - + $regex=$ProtocolListTest{'9999'}{id}; SIGNALduino_IdList("x:$target","","","y m9999"); isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id $regex, this should not be skipped"); $regex_matched=0; Log3 $name, 3 ,$subTestName." <--|"; - - }; - }; $subTestName='SIGNALduino_IdList developid "p" not skipped scenarios'; subtest $subTestName => sub { Log3 $name, 3 ,$subTestName." |->"; $ProtocolListTest{'9996'}{developId}="p"; - plan tests => 2; + plan(2); $regex_matched=0; $regex=$ProtocolListTest{'9996'}{id}; @@ -221,16 +218,14 @@ defmod test_developid_1 UnitTest dummyDuino ( isnt($regex_matched,1,$msg) or diag("check log entrys for skipped with id 9996, they should not be there"); $regex_matched=0; Log3 $name, 3 ,$subTestName." <--|"; - }; - $subTestName='SIGNALduino_IdList developId "m" dispatch enabled/disabled tests'; subtest $subTestName => sub { Log3 $name, 3 ,$subTestName." |->"; $logfilter="IdList, development protocol is active"; - plan tests => 2; + plan(2); $regex_matched=0; $regex=$ProtocolListTest{'9999'}{id}; @@ -241,7 +236,7 @@ defmod test_developid_1 UnitTest dummyDuino ( SKIP : { skip "attribute development not supported in stable version", 1 if (index($targetHash->{versionmodule},"dev") == -1); - + $msg="attr whitelist=\"\", development=\"m9999\"" ; SIGNALduino_IdList("x:$target","","","m9999"); isnt($regex_matched,1,$msg) or diag("check log entrys for development protocol is active with id $regex, there shouldn't be a note"); diff --git a/UnitTest/tests/test_firmware_download_1-definition.txt b/UnitTest/tests/test_firmware_download_1-definition.txt index 5f2e7e013..6e2fbb17c 100644 --- a/UnitTest/tests/test_firmware_download_1-definition.txt +++ b/UnitTest/tests/test_firmware_download_1-definition.txt @@ -1,6 +1,9 @@ defmod test_firmware_download_1 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{is like unlike}; + my $mock = Mock::Sub->new; Log3 $name , 3, "Test starting"; @@ -8,7 +11,7 @@ defmod test_firmware_download_1 UnitTest dummyDuino $targetHash->{additionalSets}{flash} = "r1.2.4"; subtest 'flash without hardware parameter set' => sub { - plan tests => 2; + plan(2); $attr{$target}{hardware} = undef; my $ret = SIGNALduino_Set($targetHash, $target, "flash" ,"r1.2.4"); like($ret,qr/Please define your hardware/,"return value fromSIGNALduino_Set"); @@ -16,7 +19,7 @@ defmod test_firmware_download_1 UnitTest dummyDuino }; subtest 'flash with esp8266cc1101 hardware parameter set' => sub { - plan tests => 3; + plan(3); $HTTP_CALL->reset; $attr{$target}{hardware} = "ESP8266cc1101"; my $ret = SIGNALduino_Set($targetHash, $target, "flash" ,"r1.2.4"); @@ -27,7 +30,7 @@ defmod test_firmware_download_1 UnitTest dummyDuino }; subtest 'flash with esp8266 hardware parameter set' => sub { - plan tests => 3; + plan(3); $attr{$target}{hardware} = "ESP8266"; $HTTP_CALL->reset; my $ret = SIGNALduino_Set($targetHash, $target, "flash" ,"r1.2.4"); @@ -38,7 +41,7 @@ defmod test_firmware_download_1 UnitTest dummyDuino }; subtest 'flash with nano hardware parameter set' => sub { - plan tests => 3; + plan(3); $HTTP_CALL->reset; $attr{$target}{hardware} = "nano328"; my $ret = SIGNALduino_Set($targetHash, $target, "flash" ,"r1.2.4"); @@ -49,7 +52,7 @@ defmod test_firmware_download_1 UnitTest dummyDuino }; subtest 'flash via url parameter' => sub { - plan tests => 3; + plan(3); $HTTP_CALL->reset; $attr{$target}{hardware} = "nano328"; my $ret = SIGNALduino_Set($targetHash, $target, "flash","https://github.com/RFD-FHEM/SIGNALDuino/releases/download/3.3.1/SIGNALDuino_nano3283.3.1.hex"); @@ -62,7 +65,7 @@ defmod test_firmware_download_1 UnitTest dummyDuino $HTTP_CALL->unmock; subtest 'check prerelease without hardware parameter set' => sub { - plan tests => 2; + plan(2); my $param = { hash => $targetHash, command => "queryReleases" @@ -83,7 +86,7 @@ defmod test_firmware_download_1 UnitTest dummyDuino }; subtest 'check prerelease with hardware parameter set to nano' => sub { - plan tests => 1; + plan(1); my $param = { hash => $targetHash, command => "queryReleases" @@ -101,8 +104,9 @@ defmod test_firmware_download_1 UnitTest dummyDuino diag("open json firmware file was not possible $error"); } }; + subtest 'check prerelease with hardware parameter set to ESP8266' => sub { - plan tests => 1; + plan(1); my $param = { hash => $targetHash, command => "queryReleases" @@ -122,7 +126,7 @@ defmod test_firmware_download_1 UnitTest dummyDuino }; subtest 'check stable with hardware parameter set to nanocc1101' => sub { - plan tests => 1; + plan(1); my $param = { hash => $targetHash, command => "queryReleases" @@ -140,8 +144,9 @@ defmod test_firmware_download_1 UnitTest dummyDuino diag("open json firmware file was not possible $error"); } }; + subtest 'check stable with hardware parameter set to nano' => sub { - plan tests => 1; + plan(1); my $param = { hash => $targetHash, command => "queryReleases" @@ -160,6 +165,5 @@ defmod test_firmware_download_1 UnitTest dummyDuino } }; - } ) diff --git a/UnitTest/tests/test_firmware_flash_1-definition.txt b/UnitTest/tests/test_firmware_flash_1-definition.txt index 4df79837d..ef8249281 100644 --- a/UnitTest/tests/test_firmware_flash_1-definition.txt +++ b/UnitTest/tests/test_firmware_flash_1-definition.txt @@ -3,13 +3,13 @@ defmod test_firmware_flash_1 UnitTest dummyDuino { use Test2::V0; - use Test2::Tools::Compare qw{ is like isnt unlike }; - - + use Test2::Tools::Compare qw{ is like }; + + my $mock; my $system_call; my $OpenDev; - + BEGIN { $mock = Mock::Sub->new; $system_call = $mock->mock('system'); @@ -19,30 +19,30 @@ defmod test_firmware_flash_1 UnitTest dummyDuino my $path = $ENV{'PATH'}; my $logdir = AttrVal("global", "logdir", "./log/"); my $preparedavrdudecmd; - + subtest 'set flash without hardware parameter set' => sub { - plan tests => 1; + plan(1); $attr{$target}{hardware} = ""; my $ret = SIGNALduino_Set($targetHash, $target, "flash" ,""); like( $ret, qr/^Please define your hardware!/, "check return value without hardware"); }; - + subtest 'set flash without argument passed (nano328)' => sub { - plan tests => 1; + plan(1); $attr{$target}{hardware} = "nano328"; my $ret = SIGNALduino_Set($targetHash, $target, "flash" ,""); like( $ret, qr/^ERROR: argument failed! flash/, "check return value without argument"); }; - + subtest 'set flash without avrdude installed (nano328)' => sub { - plan tests => 1; + plan(1); $attr{$target}{hardware} = "nano328"; my $ret = SIGNALduino_Set($targetHash, $target, "flash" ,"./fhem/test.hex"); like( $ret, qr/^avrdude is not installed./, "check return value without avrdude installed"); }; subtest 'set flash avrdude installed (nano328)' => sub { - plan tests => 5; + plan(5); $attr{$target}{hardware} ="nano328"; my $IntTimer = $mock->mock('main::InternalTimer'); @@ -54,26 +54,26 @@ defmod test_firmware_flash_1 UnitTest dummyDuino is($IntTimer->called_count, 1, "check if InternalTimer is called once"); my @called_args=$IntTimer->called_with; $IntTimer->unmock; - + ok($called_args[0] > gettimeofday(), "check arg 1 InternalTimer is called "); is($called_args[1], \&SIGNALduino_avrdude, "check arg 2 InternalTimer is called (SIGNALduino_avrdude)"); is($called_args[2], $target, "check arg 3 InternalTimer is called "); - + $preparedavrdudecmd = $targetHash->{helper}{avrdudecmd}; }; - + subtest 'SIGNALduino_avrdude called not installed avrdude (nano328)' => sub { - plan tests => 12; + plan(12); $attr{$target}{hardware} ="nano328"; $OpenDev->remock; - + $targetHash->{helper}{stty_pid} = "999494"; my $ret = SIGNALduino_avrdude($target); - + is($ret, "ERROR: avrdude exited with error", "check return value"); is($targetHash->{FLASH_RESULT},$ret, "check internal value"); is($targetHash->{helper}{stty_pid}, undef, "check stty_pid value"); - + is(ReadingsVal($target,"state",""),"FIRMWARE UPDATE with error","check reading state"); is($targetHash->{helper}{avrdudecmd},'avrdude -c arduino -b 57600 -P none -p atmega328p -vv -U flash:w:./fhem/test.hex 2>./log/SIGNALduino-Flash.log || avrdude -c arduino -b 115200 -P none -p atmega328p -vv -U flash:w:./fhem/test.hex 2>./log/SIGNALduino-Flash.log',"check avrdude cmd"); is($OpenDev->called_count, 1, "check if DevIO_OpenDev is called once"); @@ -82,11 +82,11 @@ defmod test_firmware_flash_1 UnitTest dummyDuino CommandAttr(undef,"global logdir ./jiddsidio/log/"); $ret = SIGNALduino_avrdude($target); - + is($ret, "WARNING: avrdude created no log file", "check return value"); is($targetHash->{FLASH_RESULT},$ret, "check internal value"); is($targetHash->{helper}{stty_pid}, undef, "check stty_pid value"); - + is(ReadingsVal($target,"state",""),"FIRMWARE UPDATE with error","check reading state"); is($targetHash->{helper}{avrdudecmd},'avrdude -c arduino -b 57600 -P none -p atmega328p -vv -U flash:w:./fhem/test.hex 2>./jiddsidio/log/SIGNALduino-Flash.log || avrdude -c arduino -b 115200 -P none -p atmega328p -vv -U flash:w:./fhem/test.hex 2>./jiddsidio/log/SIGNALduino-Flash.log',"check avrdude cmd"); is($OpenDev->called_count, 2, "check if DevIO_OpenDev is called once"); @@ -95,30 +95,27 @@ defmod test_firmware_flash_1 UnitTest dummyDuino $targetHash->{helper}{avrdudecmd} = $preparedavrdudecmd; }; - subtest 'SIGNALduino_avrdude called installed avrdude (nano328)' => sub { - plan tests => 4; + plan(4); $attr{$target}{hardware} ="nano328"; $OpenDev->remock; $targetHash->{FLASH_RESULT} = "some dummy message"; $ENV{'PATH'}="/opt/fhem/contrib"; my $ret = SIGNALduino_avrdude($target); $ENV{'PATH'}=$path; - + is($ret, undef, "check return value"); is($targetHash->{FLASH_RESULT},undef, "check internal value"); is(ReadingsVal($target,"state",""),"FIRMWARE UPDATE successfull","check reading state"); is($OpenDev->called_count, 1, "check if DevIO_OpenDev is called once"); $OpenDev->unmock; }; - - subtest 'set flash avrdude installed (radinoCC1101)' => sub { - plan tests => 9; + plan(9); $attr{$target}{hardware} ="radinoCC1101"; my $IntTimer = $mock->mock('main::InternalTimer'); - + $ENV{'PATH'}="/opt/fhem/contrib"; my $ret = SIGNALduino_Set($targetHash, $target, "flash" ,"./fhem/test.hex"); is($ret, undef, "check return value with avrdude installed"); @@ -130,20 +127,20 @@ defmod test_firmware_flash_1 UnitTest dummyDuino is($called_args[1], \&SIGNALduino_avrdude, "check arg 2 InternalTimer is called (SIGNALduino_avrdude)"); is($called_args[2], $target, "check arg 3 InternalTimer is called "); is($targetHash->{helper}{avrdudecmd},'avrdude -c avr109 -b 57600 -P none -p atmega32u4 -vv -D -U flash:w:./fhem/test.hex 2>[LOGFILE]',"check avrdude cmd"); - + $targetHash->{DeviceName}='/dev/serial/by-id/usb-Unknown_radino_CC1101-if00@57600'; $ret = SIGNALduino_Set($targetHash, $target, "flash" ,"./fhem/test.hex"); $ENV{'PATH'}=$path; is($ret, undef, "check SIGNALduino_Set return value"); - + is($targetHash->{helper}{avrdudecmd},'avrdude -c avr109 -b 57600 -P /dev/serial/by-id/usb-In-Circuit_radino_CC1101-if00 -p atmega32u4 -vv -D -U flash:w:./fhem/test.hex 2>[LOGFILE]',"check avrdude cmd"); $targetHash->{DeviceName}='none'; $IntTimer->unmock; }; - + subtest 'set flash avrdude installed (esp8266,esp32)' => sub { - plan tests => 2; + plan(2); $ENV{'PATH'}="/opt/fhem/contrib"; $attr{$target}{hardware} ="ESP8266"; @@ -157,7 +154,7 @@ defmod test_firmware_flash_1 UnitTest dummyDuino $ENV{'PATH'}=$path; }; - + CommandDefMod(undef,"$target $targetHash->{TYPE} $targetHash->{DEF}"); } diff --git a/UnitTest/tests/test_get_availableFirmware-definition.txt b/UnitTest/tests/test_get_availableFirmware-definition.txt index 2052acdde..e09e34da5 100644 --- a/UnitTest/tests/test_get_availableFirmware-definition.txt +++ b/UnitTest/tests/test_get_availableFirmware-definition.txt @@ -1,8 +1,11 @@ defmod test_get_availableFirmware UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is like }; + subtest 'Test get availableFirmware' => sub { - plan tests => 2; + plan(2); $attr{$target}{updateChannelFW} = "stable"; $attr{$target}{hardware} = "0"; delete($targetHash->{ucCmd}); diff --git a/UnitTest/tests/test_logging-definition.txt b/UnitTest/tests/test_logging-definition.txt index 554c19644..13d05d3e7 100644 --- a/UnitTest/tests/test_logging-definition.txt +++ b/UnitTest/tests/test_logging-definition.txt @@ -1,5 +1,8 @@ defmod test_logging UnitTest dummyDuino ( -{ +{ +use Test2::V0; +use Test2::Tools::Compare qw{ is }; + my $mock = Mock::Sub->new; my $DoTrigger = $mock->mock("DoTrigger"); @@ -11,8 +14,8 @@ subtest "Check logMethod with with attr eventlogging 0" => sub { $targetHash->{logMethod}->($targetHash, 2, $logmsg); is($DoTrigger->called_count, 0, "check if DoTrigger is not called from Log3 "); }; -subtest "Check logMethod with attr eventlogging 1" => sub { +subtest "Check logMethod with attr eventlogging 1" => sub { CommandAttr(undef,"$target eventlogging 1"); my $logmsg = "check with eventlogging=1"; is ($targetHash->{logMethod},\&::SIGNALduino_Log3,"Check {logMethod} points to ::SIGNALduino_Log3"); @@ -21,6 +24,7 @@ subtest "Check logMethod with attr eventlogging 1" => sub { is($DoTrigger->called_count, 1, "check if DoTrigger is called from SIGNALduino_Log3"); }; + $DoTrigger->unmock(); CommandAttr(undef,"$target eventlogging 0"); } diff --git a/UnitTest/tests/test_module_devices-template.txt b/UnitTest/tests/test_module_devices-template.txt index ae6d6ee04..133c2da75 100644 --- a/UnitTest/tests/test_module_devices-template.txt +++ b/UnitTest/tests/test_module_devices-template.txt @@ -1,7 +1,7 @@ defmod test_module_devices UnitTest dummyDuino ( { use Test2::V0; - use Test2::Tools::Compare qw{is isnt unlike}; + use Test2::Tools::Compare qw{ is }; use Data::Dumper; use JSON; diff --git a/UnitTest/tests/test_modulematch_1-definition.txt b/UnitTest/tests/test_modulematch_1-definition.txt index 68c2e0ad2..105156b22 100644 --- a/UnitTest/tests/test_modulematch_1-definition.txt +++ b/UnitTest/tests/test_modulematch_1-definition.txt @@ -1,5 +1,8 @@ defmod test_modulematch_1 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is isnt }; + my %ProtocolListTest = SIGNALduino_LoadProtocolHash("$attr{global}{modpath}/FHEM/lib/test_loadprotohash-ok.pm"); is($ProtocolListTest{error},undef,"load test protocol hash "); @@ -18,7 +21,7 @@ defmod test_modulematch_1 UnitTest dummyDuino ( subtest 'SIGNALduino_moduleMatch scenarios without whitlistIDs and development attr' => sub { - plan tests => 4; + plan(4); $local_ProtocolListSIGNALduino->{'9999'}{developId}="m"; SIGNALduino_IdList("x:$target","","",""); @@ -32,7 +35,7 @@ defmod test_modulematch_1 UnitTest dummyDuino ( subtest 'SIGNALduino_moduleMatch scenarios with whitlistIDs, whithout development attr' => sub { - plan tests => 4; + plan(4); SIGNALduino_IdList("x:$target","9999","",""); is(SIGNALduino_moduleMatch($target,'9999',"X3332222"),1,"check returncode without modulematch"); @@ -47,7 +50,7 @@ defmod test_modulematch_1 UnitTest dummyDuino ( }; subtest 'SIGNALduino_moduleMatch scenarios without whitlistIDs but development attr' => sub { - plan tests => 3; + plan(3); SIGNALduino_IdList("x:$target","","","m"); is(SIGNALduino_moduleMatch($target,'9999',"X3332222"),-1,"check returncode with matching modulematch but wrong development attr"); diff --git a/UnitTest/tests/test_modules-definition.txt b/UnitTest/tests/test_modules-definition.txt index 3a46f12a2..768477a3f 100644 --- a/UnitTest/tests/test_modules-definition.txt +++ b/UnitTest/tests/test_modules-definition.txt @@ -1,9 +1,12 @@ defmod test_modules UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + my @modulesToTest=qw/00_SIGNALduino 10_FS10 10_SD_GT 14_BresserTemeo 14_FLAMINGO 14_Hideki 14_SD_AS 14_SD_BELL 14_SD_UT 14_SD_RSL 14_SD_WS 14_SD_WS_Maverick 14_SD_WS07 14_SD_WS09 41_OREGON 90_SIGNALduino_un 98_Dooya/; - + subtest 'Syntax Check Modules ' => sub { - plan tests => scalar @modulesToTest; + plan(scalar @modulesToTest); for my $module (@modulesToTest) { my $returncode = CommandReload(undef,$module); diff --git a/UnitTest/tests/test_mu_1-definition.txt b/UnitTest/tests/test_mu_1-definition.txt index 1efa09ad7..586a95e35 100644 --- a/UnitTest/tests/test_mu_1-definition.txt +++ b/UnitTest/tests/test_mu_1-definition.txt @@ -1,5 +1,8 @@ defmod test_mu_1 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is isnt }; + my $mock = Mock::Sub->new; my $SD_Dispatch = $mock->mock("SIGNALduno_Dispatch"); @@ -17,7 +20,7 @@ defmod test_mu_1 UnitTest dummyDuino ( $SD_Dispatch->reset(); my $rmsg=$testData->{input}; - plan tests => scalar @{$testData->{output}}; + plan(scalar @{$testData->{output}}); my %signal_parts=SIGNALduino_Split_Message($rmsg,$targetHash->{NAME}); is(SIGNALduino_Parse_MU($targetHash, $targetHash, $targetHash->{NAME}, $rmsg, %signal_parts),$testData->{output}[0] ,"check return code SIGNALduino_Parse_MU") if (defined($testData->{output}[0])); is($SD_Dispatch->called_count, $testData->{output}[1], "check number of dispatch attempts") if (defined($testData->{output}[1])); diff --git a/UnitTest/tests/test_reset_1-definition.txt b/UnitTest/tests/test_reset_1-definition.txt index 61349c9ee..7fe2e5443 100644 --- a/UnitTest/tests/test_reset_1-definition.txt +++ b/UnitTest/tests/test_reset_1-definition.txt @@ -1,6 +1,9 @@ defmod test_reset_1 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + my $mock; my $SD_connect; my $IntTimer; @@ -10,9 +13,9 @@ defmod test_reset_1 UnitTest dummyDuino $IntTimer = $mock->mock('main::InternalTimer'); $IntTimer->unmock; } - + subtest 'reset without hardware parameter set' => sub { - plan tests => 3; + plan(3); $attr{$target}{dummy} = 0; is (AttrVal($target, "dummy", 0),0,"check attrib dummy is 0"); $attr{$target}{hardware} = ""; @@ -22,9 +25,8 @@ defmod test_reset_1 UnitTest dummyDuino is (ReadingsVal($target,"state",""),"disconnected","check state"); }; - subtest 'reset with hardware parameter set (nano328)' => sub { - plan tests => 3; + plan(3); $attr{$target}{hardware} = "nano328"; $SD_connect->remock; my $ret = SIGNALduino_Set($targetHash, $target, "reset" ,""); @@ -33,12 +35,12 @@ defmod test_reset_1 UnitTest dummyDuino is (ReadingsVal($target,"state",""),"disconnected","check state"); is ($targetHash->{helper}{resetInProgress},undef,"check reset in progress"); }; - + subtest 'reset with hardware parameter set (radinoCC1101)' => sub { - plan tests => 5; + plan(5); $attr{$target}{hardware} = "radinoCC1101"; $IntTimer->remock; - + $SD_connect->remock; my $ret = SIGNALduino_Set($targetHash, $target, "reset" ,""); is ($SD_connect->called_count,0,"check if SIGNALduino_Connect is not called"); @@ -49,36 +51,35 @@ defmod test_reset_1 UnitTest dummyDuino ok($called_args[0] > gettimeofday(), "check arg 1 width InternalTimer is called "); is (ReadingsVal($target,"state",""),"disconnected","check state"); is ($targetHash->{helper}{resetInProgress},1,"check reset in progress"); - }; - + subtest 'reset with specialReset flag set' => sub { - plan tests => 3; + plan(3); $targetHash->{helper}{resetInProgress}=1; $IntTimer->remock; $SD_connect->remock; SIGNALduino_ResetDevice($targetHash); - + is ($SD_connect->called_count,1,"check if SIGNALduino_Connect is called once"); $SD_connect->unmock; - + is ($IntTimer->called_count,0,"check if InternalTimer is not called once"); $IntTimer->unmock; - + is ($targetHash->{helper}{resetInProgress},undef,"check reset in progress flag deleted"); }; subtest 'reset for dummy device' => sub { - plan tests => 3; + plan(3); $attr{$target}{dummy} = 1; is (AttrVal($target, "dummy", 0),1,"check dummy attrib dummy is 1"); is (ReadingsVal($target,"state",""),"disconnected","check dummy state disconnected"); - + SIGNALduino_ResetDevice($targetHash); is (ReadingsVal($target,"state",""),"opened","check dummy state opened"); }; - CommandDefMod(undef,"$target $targetHash->{TYPE} $targetHash->{DEF}"); + CommandDefMod(undef,"$target $targetHash->{TYPE} $targetHash->{DEF}"); } ) diff --git a/UnitTest/tests/test_sub_SIGNALduino_CheckCcregResponse-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_CheckCcregResponse-definition.txt index 45362751f..8a696bff7 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_CheckCcregResponse-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_CheckCcregResponse-definition.txt @@ -1,8 +1,11 @@ defmod test_sub_SIGNALduino_CheckCcregResponse UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ like unlike }; + subtest 'Test ccregAll response' => sub { - plan tests => 6; - + plan(6); + my ($ret)=SIGNALduino_CheckCcregResponse($targetHash,"ccreg 00: 0D 2E 2D 47 D3 91 3D 04 32 00 00 06 00 10 B0 71 ccreg 10: 57 C4 30 23 B9 00 07 00 18 14 6C 07 00 91 87 6B ccreg 20: F8 B6 11 EF 0C 3C 1F 41"); like($ret,qr/^0D 2E 2D 47 D3 91/m,"check begin of return message"); unlike($ret,qr/^ccreg/m,"check removed ccreg in return"); @@ -11,10 +14,10 @@ defmod test_sub_SIGNALduino_CheckCcregResponse UnitTest dummyDuino ( like($ret,qr/MDMCFG2/m,"check registername in output"); like($ret,qr/Configuration/m,"check heading - Detail part of return message"); }; - + subtest 'Test ccreg 12 response (C12 = 30)' => sub { - plan tests => 4; - + plan(4); + my ($ret)=SIGNALduino_CheckCcregResponse($targetHash,"C12 = 30"); like($ret,qr/^Configuration Register Detail address/m,"check begin of return message"); like($ret,qr/^0x12/m,"begin of detail line in output"); diff --git a/UnitTest/tests/test_sub_SIGNALduino_CheckCmdResp-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_CheckCmdResp-definition.txt index 7c5e84d30..ff6d8f68b 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_CheckCmdResp-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_CheckCmdResp-definition.txt @@ -1,26 +1,29 @@ defmod test_sub_SIGNALduino_CheckCmdResp UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + subtest 'Test with unset version' => sub { - plan tests => 2; - + plan(2); + my $mock = Mock::Sub->new; my $SD_StartInit = $mock->mock('SIGNALduino_StartInit'); delete($targetHash->{version}); $targetHash->{ucCmd}->{cmd} = "version"; - + my $ret=SIGNALduino_CheckCmdResp($targetHash); is($SD_StartInit->called,1,"Version not found and SIGNALduino_StartInit called"); is($targetHash->{ucCmd}->{cmd},undef,"ucCmd removed"); - + $SD_StartInit->unmock; }; subtest 'Test with wrong version' => sub { - plan tests => 3; - + plan(3); + $targetHash->{version} = "SIGNALdummy"; $targetHash->{ucCmd}->{cmd} = "version"; - + my $ret=SIGNALduino_CheckCmdResp($targetHash); is(ReadingsVal($target,"state",undef),"closed","SIGNALDuino not found"); is($targetHash->{ucCmd}->{cmd},"version","ucCmd not removed"); @@ -28,11 +31,11 @@ defmod test_sub_SIGNALduino_CheckCmdResp UnitTest dummyDuino ( }; subtest 'Test with old version' => sub { - plan tests => 3; - + plan(3); + $targetHash->{version} = "V 3.1.2 SIGNALduino cc1101 (chip CC1101) - compiled at Sep 22 2019 22:53:27"; $targetHash->{ucCmd}->{cmd} = "version"; - + my $ret=SIGNALduino_CheckCmdResp($targetHash); is(ReadingsVal($target,"state",undef),"closed","SIGNALDuino Firmware to old"); is($targetHash->{ucCmd}->{cmd},"version","ucCmd not removed"); @@ -40,11 +43,11 @@ defmod test_sub_SIGNALduino_CheckCmdResp UnitTest dummyDuino ( }; subtest 'Test with good version without cc1101' => sub { - plan tests => 5; - + plan(5); + my $mock = Mock::Sub->new; my $SD_SimpleWrite = $mock->mock('SIGNALduino_SimpleWrite'); - + $targetHash->{version} = "V 3.3.1 SIGNALduino - compiled at Sep 22 2019 22:53:27"; $targetHash->{ucCmd}->{cmd} = "version"; my $ret=SIGNALduino_CheckCmdResp($targetHash); @@ -58,11 +61,11 @@ defmod test_sub_SIGNALduino_CheckCmdResp UnitTest dummyDuino ( }; subtest 'Test with good version' => sub { - plan tests => 5; - + plan(5); + my $mock = Mock::Sub->new; my $SD_SimpleWrite = $mock->mock('SIGNALduino_SimpleWrite'); - + $targetHash->{version} = "V 3.3.1 SIGNALduino cc1101 (chip CC1101) - compiled at Sep 22 2019 22:53:27"; $targetHash->{ucCmd}->{cmd} = "version"; my $ret=SIGNALduino_CheckCmdResp($targetHash); @@ -72,10 +75,8 @@ defmod test_sub_SIGNALduino_CheckCmdResp UnitTest dummyDuino ( is($targetHash->{ucCmd}->{cmd},"version","ucCmd not removed"); is($targetHash->{DevState},"initialized","check DevState"); is($targetHash->{cc1101_available},1,"check internal cc1101_available"); - + $SD_SimpleWrite->unmock; }; - - } ) \ No newline at end of file diff --git a/UnitTest/tests/test_sub_SIGNALduino_CheckCmdsResponse-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_CheckCmdsResponse-definition.txt index 38056ae7a..0cf19ea69 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_CheckCmdsResponse-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_CheckCmdsResponse-definition.txt @@ -1,7 +1,10 @@ defmod test_sub_SIGNALduino_CheckCmdsResponse UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + subtest 'Test SIGNALduino_CheckCmdsResponse ' => sub { - plan tests => 1; + plan(1); my ($ret,undef)=SIGNALduino_CheckCmdsResponse($targetHash,"$target cmds => .*Use one of V R t X S P C r W s x e"); is($ret," V R t X S P C r W s x e","check return value"); }; diff --git a/UnitTest/tests/test_sub_SIGNALduino_CheckUptimeResponse-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_CheckUptimeResponse-definition.txt index 009882b43..1356baabb 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_CheckUptimeResponse-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_CheckUptimeResponse-definition.txt @@ -1,22 +1,24 @@ defmod test_sub_SIGNALduino_CheckUptimeResponse UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + subtest 'Test SIGNALduino_CheckUptimeResponse (uptime 86410) ' => sub { - plan tests => 1; + plan(1); my ($ret,undef)=SIGNALduino_CheckUptimeResponse($targetHash,"86410"); is($ret,"1 00:00:10","check return message"); }; subtest 'Test SIGNALduino_CheckUptimeResponse (uptime 10) ' => sub { - plan tests => 1; + plan(1); my ($ret,undef)=SIGNALduino_CheckUptimeResponse($targetHash,"10"); is($ret,"0 00:00:10","check return message"); }; subtest 'Test SIGNALduino_CheckUptimeResponse (uptime 8641000) ' => sub { - plan tests => 1; + plan(1); my ($ret,undef)=SIGNALduino_CheckUptimeResponse($targetHash,"8641001"); is($ret,"100 00:16:41","check return message"); }; - } ) diff --git a/UnitTest/tests/test_sub_SIGNALduino_CheckVersionResp-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_CheckVersionResp-definition.txt index 84e201dfb..a5a074606 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_CheckVersionResp-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_CheckVersionResp-definition.txt @@ -1,42 +1,45 @@ defmod test_sub_SIGNALduino_CheckVersionResp UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is like }; + subtest 'Test SIGNALduino_CheckVersionResp ' => sub { - plan tests => 1; + plan(1); $targetHash->{ucCmd}->{cmd} = "version"; my ($ret,undef)=SIGNALduino_CheckVersionResp($targetHash,"V 3.4.0-dev SIGNALESP cc1101 (chip CC1101) - compiled at Dec 4 2019 22:01:01"); is($ret,"V 3.4.0-dev SIGNALESP cc1101 (chip CC1101) - compiled at Dec 4 2019 22:01:01","check return message"); }; subtest 'Test SIGNALduino_CheckVersionResp with incomplete MU before' => sub { - plan tests => 1; + plan(1); $targetHash->{ucCmd}->{cmd} = "version"; my ($ret,undef)=SIGNALduino_CheckVersionResp($targetHash,"MU;P0-100;V 3.4.0-dev SIGNALESP cc1101 (chip CC1101) - compiled at Dec 4 2019 22:01:01"); is($ret,"V 3.4.0-dev SIGNALESP cc1101 (chip CC1101) - compiled at Dec 4 2019 22:01:01","check return message"); }; subtest 'Test SIGNALduino_CheckVersionResp with stuff after' => sub { - plan tests => 1; + plan(1); $targetHash->{ucCmd}->{cmd} = "version"; my ($ret,undef)=SIGNALduino_CheckVersionResp($targetHash,"V 3.4.0-dev SIGNALESP cc1101 (chip CC1101) - compiled at Dec 4 2019 22:01:01 STUFF HERE"); is($ret,"V 3.4.0-dev SIGNALESP cc1101 (chip CC1101) - compiled at Dec 4 2019 22:01:01","check return message"); }; subtest 'Test SIGNALduino_CheckVersionResp with to old version' => sub { - plan tests => 1; + plan(1); $targetHash->{ucCmd}->{cmd} = "version"; my ($ret,undef)=SIGNALduino_CheckVersionResp($targetHash,"V 3.1.0 SIGNALduino - compiled at Dec 4 2019 22:01:01"); like($ret,qr/^$target: CheckVersionResp, Version of your arduino is not compatible, please flash new firmware. \(device closed\) Got for V: V 3\.1\.0.*/,"check return message"); }; subtest 'Test SIGNALduino_CheckVersionResp with no version' => sub { - plan tests => 1; + plan(1); $targetHash->{ucCmd}->{cmd} = "version"; my ($ret,undef)=SIGNALduino_CheckVersionResp($targetHash,"no version from device"); like($ret,qr/^$target: CheckVersionResp, Not an SIGNALduino device, got for V: no version from device/,"check return message"); }; subtest 'Test SIGNALduino_CheckVersionResp timeout' => sub { - plan tests => 1; + plan(1); # mock like SIGNALduino_StartInit $hash->{DevState} = 'waitInit'; $hash->{ucCmd}->{responseSub} = \&SIGNALduino_CheckVersionResp; diff --git a/UnitTest/tests/test_sub_SIGNALduino_CheckccConfResponse-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_CheckccConfResponse-definition.txt index 89950eaeb..13d76bf29 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_CheckccConfResponse-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_CheckccConfResponse-definition.txt @@ -1,8 +1,11 @@ defmod test_sub_SIGNALduino_CheckccConfResponse UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + subtest 'Test cconf response (C0Dn11=10B07157C43023B900070018146C070091)' => sub { - plan tests => 3; - + plan(3); + my ($ret)=SIGNALduino_CheckccConfResponse($targetHash,"C0Dn11=10B07157C43023B900070018146C070091"); is($ret,"Freq: 433.920 MHz, Bandwidth: 325 KHz, rAmpl: 42 dB, sens: 8 dB, DataRate: 5603.79 Baud, Modulation: ASK/OOK, Syncmod: No preamble/sync","check return message"); is(ReadingsVal($target,"cc1101_config",undef),"Freq: 433.920 MHz, Bandwidth: 325 KHz, rAmpl: 42 dB, sens: 8 dB, DataRate: 5603.79 Baud","check reading cc1101_config value"); diff --git a/UnitTest/tests/test_sub_SIGNALduino_CheckccPatableResponse-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_CheckccPatableResponse-definition.txt index 22fdddaee..e49595853 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_CheckccPatableResponse-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_CheckccPatableResponse-definition.txt @@ -1,22 +1,23 @@ defmod test_sub_SIGNALduino_CheckccPatableResponse UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + my $savedFreq = AttrVal($target,"cc1101_frequency",undef); - plan tests => 3; - - + plan(3); + subtest 'Test ccPatable response default Mhz (C3E = 00 84 00 00 00 00 00 00)' => sub { - plan tests => 2; + plan(2); delete($attr{$target}{cc1101_frequency}); my ($ret)=SIGNALduino_CheckccPatableResponse ($targetHash,"C3E = 00 84 00 00 00 00 00 00"); is($ret,"C3E = 00 84 00 00 00 00 00 00 => 5_dBm","check return value"); is (ReadingsVal($target,"cc1101_patable",undef),"C3E = 00 84 00 00 00 00 00 00 => 5_dBm", "check reading value"); }; - subtest "Test ccPatable 433 Mhz Range " => sub { foreach my $i (433..435) { subtest "Test ccPatable response $i Mhz (C3E = 00 84 00 00 00 00 00 00)" => sub { - plan tests => 2; + plan(2); $attr{$target}{cc1101_frequency} = $i; my ($ret)=SIGNALduino_CheckccPatableResponse ($targetHash,"C3E = 00 84 00 00 00 00 00 00"); @@ -29,7 +30,7 @@ defmod test_sub_SIGNALduino_CheckccPatableResponse UnitTest dummyDuino ( subtest "Test ccPatable 868 Mhz Range " => sub { foreach my $i (863..870) { subtest "Test ccPatable response $i Mhz (C3E = 00 67 00 00 00 00 00 00)" => sub { - plan tests => 2; + plan(2); $attr{$target}{cc1101_frequency} = $i; my ($ret)=SIGNALduino_CheckccPatableResponse ($targetHash,"C3E = 00 67 00 00 00 00 00 00"); @@ -38,11 +39,10 @@ defmod test_sub_SIGNALduino_CheckccPatableResponse UnitTest dummyDuino ( }; }; }; - + subtest "Test ccPatable unsupported values " => sub { - subtest 'Test ccPatable 900 Mhz ' => sub { - plan tests => 2; + plan(2); $attr{$target}{cc1101_frequency} = 900; my ($ret)=SIGNALduino_CheckccPatableResponse ($targetHash,"C3E = 00 84 00 00 00 00 00 00"); is($ret,"C3E = 00 84 00 00 00 00 00 00","check return value"); @@ -52,6 +52,6 @@ defmod test_sub_SIGNALduino_CheckccPatableResponse UnitTest dummyDuino ( $attr{$target}{cc1101_frequency} = $savedFreq if(defined($savedFreq)); delete($attr{$target}{cc1101_frequency}) if(! defined($savedFreq)); - + } ) diff --git a/UnitTest/tests/test_sub_SIGNALduino_Dispatch-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_Dispatch-definition.txt index 5bb388dea..58f59b406 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_Dispatch-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_Dispatch-definition.txt @@ -1,5 +1,8 @@ defmod test_sub_SIGNALduino_Dispatch UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + note("Test can be extended to JSON MU data"); my $mock = Mock::Sub->new; diff --git a/UnitTest/tests/test_sub_SIGNALduino_FingerprintFn-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_FingerprintFn-definition.txt index 61e39a13d..68fe933d9 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_FingerprintFn-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_FingerprintFn-definition.txt @@ -1,5 +1,8 @@ defmod test_sub_SIGNALduino_FingerprintFn UnitTest dummyDuino ( -{ +{ + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + my $dmsg ="W84#FE42004526"; my ($ret_name,$ret_dmsg) = SIGNALduino_FingerprintFn($targetHash->{NAME},$dmsg); is($ret_name ,"","check FingerprintFN name return"); diff --git a/UnitTest/tests/test_sub_SIGNALduino_GetResponseUpdateReading-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_GetResponseUpdateReading-definition.txt index 463f290be..b3379248d 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_GetResponseUpdateReading-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_GetResponseUpdateReading-definition.txt @@ -1,10 +1,13 @@ defmod test_sub_SIGNALduino_GetResponseUpdateReading UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + subtest 'Test SIGNALduino_GetResponseUpdateReading (ping OK) ' => sub { - plan tests => 1; + plan(1); my ($ret,undef)=SIGNALduino_GetResponseUpdateReading($targetHash,"OK"); is($ret,"OK","check return message"); }; - + } ) diff --git a/UnitTest/tests/test_sub_SIGNALduino_LoadProtocolHash-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_LoadProtocolHash-definition.txt index c7af67c15..cfd9c4809 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_LoadProtocolHash-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_LoadProtocolHash-definition.txt @@ -1,25 +1,29 @@ defmod test_sub_SIGNALduino_LoadProtocolHash UnitTest dummyDuino ( { - plan tests => 3; + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + + plan(3); my %ret= SIGNALduino_LoadProtocolHash("dummy.hash"); ok(exists($ret{error}),"check with wrong filename"); - - subtest 'Good SD_PROTOCL_DATA' => sub { - plan tests => 1; + + subtest 'Good SD_PROTOCL_DATA' => sub { + plan(1); %ret= SIGNALduino_LoadProtocolHash("$attr{global}{modpath}/FHEM/lib/test_loadprotohash-ok.pm"); is($ret{error},undef,"check filename and syntax ok "); }; - + subtest 'Bad SD_PROTOCL_DATA' => sub { - plan tests => 1; + plan(1); %ret= SIGNALduino_LoadProtocolHash("$attr{global}{modpath}/FHEM/lib/test_loadprotohash-nok.pm"); ok(exists($ret{error}),"check filename and syntax not ok "); }; + our %ProtocolListSIGNALduino = SIGNALduino_LoadProtocolHash("$attr{global}{modpath}/FHEM/lib/SD_ProtocolData.pm"); - + SIGNALduino_IdList("x:$target","","",""); } ); diff --git a/UnitTest/tests/test_sub_SIGNALduino_MCTFA-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_MCTFA-definition.txt index ce7e17f17..758809cb2 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_MCTFA-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_MCTFA-definition.txt @@ -1,30 +1,36 @@ defmod test_sub_SIGNALduino_MCTFA UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is like }; + my $id=58; subtest 'MCTFA single transmission' => sub { - plan tests => 2; + plan(2); my ($rcode,$hexresult); my $bitdata="1111111111010100010111001000000101000100001101001110110010010000"; ($rcode,$hexresult)=SIGNALduino_MCTFA($target,$bitdata,$id,length $bitdata); is($rcode,-1,"check returncode "); is($hexresult," no duplicate found","check result message"); }; + subtest 'MCTFA double transmission' => sub { - plan tests => 2; + plan(2); my ($rcode,$hexresult); my $bitdata="111111111101010001011100100000010100010000110100111011001001000011111111111010100010111001000000101000100001101001110110010010000"; ($rcode,$hexresult)=SIGNALduino_MCTFA($target,$bitdata,$id,length $bitdata); is($rcode,1,"check returncode"); is($hexresult,"45C814434EC90","check result message"); }; + subtest 'MCTFA double+ transmission ' => sub { - plan tests => 2; + plan(2); my ($rcode,$hexresult); my $bitdata="1111111111010100010111001000000101000100001101001110110010010000111111111110101000101110010000001010001000011010011101100100100001111111111101010001011100100001"; ($rcode,$hexresult)=SIGNALduino_MCTFA($target,$bitdata,$id,length $bitdata); is($rcode,1,"check returncode"); is($hexresult,"45C814434EC90","check result message"); }; + subtest 'MCTFA double to short' => sub { my ($rcode,$hexresult); my $bitdata="1111111111010100010111001000010000000011111111111010100010111001000010000000"; @@ -32,6 +38,7 @@ defmod test_sub_SIGNALduino_MCTFA UnitTest dummyDuino ( is($rcode,-1,"check returncode"); like($hexresult,qr/message is to short/,"check result message"); }; + subtest 'MCTFA double to short' => sub { local $TODO = "need code change to test this correct"; my ($rcode,$hexresult); @@ -40,7 +47,5 @@ defmod test_sub_SIGNALduino_MCTFA UnitTest dummyDuino ( is($rcode,-1,"check returncode"); like($hexresult,qr/message is to long/,"check result message"); }; - - } ) \ No newline at end of file diff --git a/UnitTest/tests/test_sub_SIGNALduino_OSV2-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_OSV2-definition.txt index 00ffd8ca9..f9e4e6b2f 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_OSV2-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_OSV2-definition.txt @@ -1,10 +1,11 @@ defmod test_sub_SIGNALduino_OSV2 UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is isnt }; + subtest 'OSV2 Tests' => sub { - plan tests => 2; + plan(6); my ($rcode,$hexresult); - - my $id=10; my $bitdata="1010101010101010101010101010101011001100101011001101001010110010101011010011001100101101001101010101001101001011001101001011010101010101010100110101001100101011001101010111"; ($rcode,$hexresult)=SIGNALduino_OSV2($target,$bitdata,$id,length $bitdata); @@ -23,11 +24,11 @@ defmod test_sub_SIGNALduino_OSV2 UnitTest dummyDuino ( ($rcode,$hexresult)=SIGNALduino_OSV2($target,$bitdata,$id,length $bitdata); is($rcode,1,"check returncode for double OSV2 transmission"); is($hexresult,"44BADC5313641940741","check result for double OSV2 transmission"); - + } }; subtest 'OSV3 Tests' => sub { - plan tests => 12; + plan(12); my $id=10; my ($rcode,$hexresult); @@ -57,6 +58,7 @@ defmod test_sub_SIGNALduino_OSV2 UnitTest dummyDuino ( ($rcode,$hexresult)=SIGNALduino_OSV2($target,$bitdata,$id,length $bitdata); is($rcode,-1,"check result first preamble to short second message to short"); isnt($hexresult,"50FA281441302020042E31","check result first preamble to short second message to short"); + TODO: { local $TODO = "codechange needed to detect second message"; $bitdata="11111111111111010111110001010000101000100011001111111111111111111111110101111100010100001010001000001000001100000001000000010000100000011101001000110011"; @@ -65,6 +67,5 @@ defmod test_sub_SIGNALduino_OSV2 UnitTest dummyDuino ( is($hexresult,"50FA281441302020042E31","heck result first transmission to short second message is okay"); } }; - -} +} ) \ No newline at end of file diff --git a/UnitTest/tests/test_sub_SIGNALduino_Parse_MC-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_Parse_MC-definition.txt index cf5ff11e2..9a15082b0 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_Parse_MC-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_Parse_MC-definition.txt @@ -1,9 +1,12 @@ defmod test_sub_SIGNALduino_Parse_MC UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + my $mock = Mock::Sub->new; subtest 'SIGNALduino_parse_MC maxlength' => sub { - plan tests => 1; + plan(1); my $rmsg="MC;LL=-762;LH=544;SL=-402;SH=345;D=DB6D5B54;C=342;L=30;R=32;"; my %signal_parts=SIGNALduino_Split_Message($rmsg,$targetHash->{NAME}); @@ -12,8 +15,8 @@ defmod test_sub_SIGNALduino_Parse_MC UnitTest dummyDuino ( }; subtest 'SIGNALduino_parse_MC minlenth' => sub { - plan tests => 1; - + plan(1); + my $rmsg="MC;LL=-762;LH=544;SL=-402;SH=345;D=DB6;C=342;L=12;R=32;"; my %signal_parts=SIGNALduino_Split_Message($rmsg,$targetHash->{NAME}); @@ -23,8 +26,8 @@ defmod test_sub_SIGNALduino_Parse_MC UnitTest dummyDuino ( subtest 'SIGNALduino_parse_MC good message' => sub { note("Test can be extended to JSON MC data"); subtest 'Test Protocol 57 - MC Data good message' => sub { - plan tests => 1; - + plan(1); + my $rmsg="MC;LL=-653;LH=679;SL=-310;SH=351;D=D55B58;C=332;L=21;"; my %signal_parts=SIGNALduino_Split_Message($rmsg,$targetHash->{NAME}); my $SD_Dispatch = $mock->mock("SIGNALduno_Dispatch"); diff --git a/UnitTest/tests/test_sub_SIGNALduino_Parse_MU-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_Parse_MU-definition.txt index 6c890336d..5192faead 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_Parse_MU-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_Parse_MU-definition.txt @@ -1,5 +1,8 @@ defmod test_sub_SIGNALduino_Parse_MU UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + my $whitelist_IDs = AttrVal($target,"whitelist_IDs",undef); # save whitelist_IDs to set back note("attribute whitelist_IDs save from system"); diff --git a/UnitTest/tests/test_sub_SIGNALduino_StartInit-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_StartInit-definition.txt index 502d3b589..3a68f1235 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_StartInit-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_StartInit-definition.txt @@ -1,44 +1,44 @@ defmod test_sub_SIGNALduino_StartInit UnitTest dummyDuino ( -{ +{ + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + subtest 'Test with initretry=1' => sub { - plan tests => 4; - + plan(4); + my $mock = Mock::Sub->new; my $SD_SimpleWrite = $mock->mock('SIGNALduino_SimpleWrite'); $targetHash->{initretry} = 1; - + my $ret=SIGNALduino_StartInit($targetHash); is($SD_SimpleWrite->called,1,"SIGNALduino_SimpleWrite called"); my @called_args = $SD_SimpleWrite->called_with; is( $called_args[1], "V", "SIGNALduino_SimpleWrite called with V" ); is($targetHash->{ucCmd}->{cmd},"version","ucCmd is version"); is($targetHash->{DevState},"waitInit","check DevState"); - + $SD_SimpleWrite->unmock; }; subtest 'Test with initretry=3' => sub { - plan tests => 5; - + plan(5); + my $mock = Mock::Sub->new; my $SD_ResetDevice = $mock->mock('SIGNALduino_ResetDevice'); $targetHash->{initretry} = 3; - + is($targetHash->{initResetFlag},undef,"check initResetFlag before beginning"); my $ret=SIGNALduino_StartInit($targetHash); is($SD_ResetDevice->called,1,"SIGNALduino_ResetDevice called"); is($targetHash->{DevState},"INACTIVE","check DevState"); is($targetHash->{initResetFlag},1,"check initResetFlag"); $SD_ResetDevice->unmock; - + my $SD_CloseDevice = $mock->mock('SIGNALduino_CloseDevice'); my $ret=SIGNALduino_StartInit($targetHash); is($SD_CloseDevice->called,1,"SIGNALduino_CloseDevice called"); $SD_CloseDevice->unmock; - - }; - } ) \ No newline at end of file diff --git a/UnitTest/tests/test_sub_SIGNALduino_callsub_1-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_callsub_1-definition.txt index a5594e387..08538c6bd 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_callsub_1-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_callsub_1-definition.txt @@ -1,4 +1,7 @@ -defmod test_sub_SIGNALduino_callsub_1 UnitTest dummyDuino ( { +defmod test_sub_SIGNALduino_callsub_1 UnitTest dummyDuino ( +{ + use Test2::V0; + use Test2::Tools::Compare qw{ is }; my $bad_testmethod = sub { my ($name, @bit_msg) = @_; return 1,"bad var"; }; my $good_testmethod = sub { my ($name, @bit_msg) = @_; return 1,qw(0 1 0 1); }; @@ -6,7 +9,7 @@ defmod test_sub_SIGNALduino_callsub_1 UnitTest dummyDuino ( { my @expected_bit_msg = qw /0 1 0 1/; subtest 'SIGNALduino_callsub scenario good sub without eval check' => sub { - plan tests => 4; + plan(4); my ($rcode,@retvalue) = SIGNALduino_callsub('testMethod',$good_testmethod,undef,"dummyDuino",@bit_msg); is ($rcode,1,"Check returncode of SIGNALduino_callsub"); is_deeply( \@retvalue, \@expected_bit_msg, "Check return values of SIGNALduino_callsub"); @@ -17,7 +20,7 @@ defmod test_sub_SIGNALduino_callsub_1 UnitTest dummyDuino ( { }; subtest 'SIGNALduino_callsub scenario good sub with eval check' => sub { - plan tests => 2; + plan(2); my ($rcode,@retvalue) = SIGNALduino_callsub('testMethod',$good_testmethod,1,$target,@bit_msg); is ($rcode,1,"Check returncode of SIGNALduino_callsub"); @@ -25,19 +28,19 @@ defmod test_sub_SIGNALduino_callsub_1 UnitTest dummyDuino ( { }; subtest 'SIGNALduino_callsub scenario bad sub with eval check' => sub { - plan tests => 2; + plan(2); my ($rcode,@retvalue) = SIGNALduino_callsub('testMethod',$bad_testmethod,1,$target,@bit_msg); is ($rcode,0,"Check if returncode of SIGNALduino_callsub "); is ($retvalue[0],undef,"Check returnvalue of SIGNALduino_callsub "); }; + subtest 'SIGNALduino_callsub scenario bad sub without eval check' => sub { - plan tests => 2; + plan(2); my ($rcode,@retvalue) = SIGNALduino_callsub('testMethod',$bad_testmethod,undef,$target,@bit_msg); is ($rcode,1,"Check if returncode of SIGNALduino_callsub "); is ($retvalue[0],"bad var","Check returnvalue of SIGNALduino_callsub "); }; - - -}); \ No newline at end of file +} +); \ No newline at end of file diff --git a/UnitTest/tests/test_sub_SIGNALduino_getAttrDevelopment-definition.txt b/UnitTest/tests/test_sub_SIGNALduino_getAttrDevelopment-definition.txt index ec80d855a..22e5e5bdf 100644 --- a/UnitTest/tests/test_sub_SIGNALduino_getAttrDevelopment-definition.txt +++ b/UnitTest/tests/test_sub_SIGNALduino_getAttrDevelopment-definition.txt @@ -1,38 +1,43 @@ defmod test_sub_SIGNALduino_getAttrDevelopment UnitTest dummyDuino ( { + use Test2::V0; + use Test2::Tools::Compare qw{ is }; + CommandAttr(undef,"$target Whitelist_IDs 1,2,3"); subtest 'development attr set to 0' => sub { - plan tests => 2; - + plan(2); + CommandAttr(undef,"$target development 0"); my ($attrDevelop,$devflag)=SIGNALduino_getAttrDevelopment($target); is($attrDevelop,0,"check develop attr"); is($devflag,0,"check develop flag"); }; - + SKIP: { skip "attribute development not supported in stable version", 2 if (index($targetHash->{versionmodule},"dev") == -1); subtest 'development attr set to 1' => sub { - plan tests => 2; - + plan(2); + CommandAttr(undef,"$target development 1"); my ($attrDevelop,$devflag)=SIGNALduino_getAttrDevelopment($target); is($attrDevelop,1,"check develop attr"); is($devflag,1,"check develop flag"); }; + subtest 'development attr set to y' => sub { - plan tests => 2; - + plan(2); + CommandAttr(undef,"$target development y"); my ($attrDevelop,$devflag)=SIGNALduino_getAttrDevelopment($target); is($attrDevelop,"y","check develop attr"); is($devflag,1,"check develop flag"); }; }; + subtest 'development attr set to y58' => sub { - plan tests => 2; + plan(2); CommandAttr(undef,"$target development y58"); my ($attrDevelop,$devflag)=SIGNALduino_getAttrDevelopment($target); @@ -43,6 +48,5 @@ defmod test_sub_SIGNALduino_getAttrDevelopment UnitTest dummyDuino ( is($devflag,0,"check develop flag"); }; - } ) \ No newline at end of file From 23d302021f4bc6e9b50bd77748e4fa9c99d79da2 Mon Sep 17 00:00:00 2001 From: Udo Date: Tue, 21 Apr 2020 16:14:38 +0200 Subject: [PATCH 16/35] new protocol 98 for wireless door bell GEA-028DB (#839) --- CHANGED | 3 +++ FHEM/00_SIGNALduino.pm | 2 +- FHEM/14_SD_BELL.pm | 43 ++++++++++++++++++++++--------------- FHEM/lib/SD_ProtocolData.pm | 22 ++++++++++++++++++- README.md | 1 + controls_signalduino.txt | 6 +++--- 6 files changed, 55 insertions(+), 22 deletions(-) diff --git a/CHANGED b/CHANGED index ff396a2c9..6efb00423 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,6 @@ +2020-04-20 - Merge branch 'dev-r34' into dev-r34_GEA-028DB +2020-04-20 - new protocol 98 for wireless door bell GEA-028DB + 2020-04-14 - 00_SIGNALduino.pm Changed stringrefs to coderefs diff --git a/FHEM/00_SIGNALduino.pm b/FHEM/00_SIGNALduino.pm index 2065369d3..3abed60df 100644 --- a/FHEM/00_SIGNALduino.pm +++ b/FHEM/00_SIGNALduino.pm @@ -248,7 +248,7 @@ my %matchListSIGNALduino = ( "24:FS20" => "^81..(04|0c)..0101a001", "25:CUL_EM" => "^E0.................", "26:Fernotron" => '^P82#.*', - "27:SD_BELL" => '^P(?:15|32|41|42|57|79|96)#.*', + "27:SD_BELL" => '^P(?:15|32|41|42|57|79|96|98)#.*', "28:SD_Keeloq" => '^P(?:87|88)#.*', "29:SD_GT" => '^P49#[A-Fa-f0-9]+', "X:SIGNALduino_un" => '^[u]\d+#.*', diff --git a/FHEM/14_SD_BELL.pm b/FHEM/14_SD_BELL.pm index 751bd0fbf..2de5ffefa 100644 --- a/FHEM/14_SD_BELL.pm +++ b/FHEM/14_SD_BELL.pm @@ -3,7 +3,7 @@ # # The file is part of the SIGNALduino project. # The purpose of this module is to support many wireless BELL devices. -# 2018 / 2019 - HomeAuto_User & elektron-bbs +# 2018 - 2020 - HomeAuto_User & elektron-bbs # #################################################################################################################################### # - wireless doorbell TCM_234759 Tchibo [Protocol 15] length 12-20 (3-5) @@ -25,6 +25,9 @@ # - 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;; #################################################################################################################################### +# - 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; +#################################################################################################################################### # !!! ToDo´s !!! # - KANGTAI doubleCode must CEHCK | only one Code? - MORE USER MSG needed # - @@ -76,12 +79,16 @@ my %models = ( Protocol => "96", doubleCode => "no" }, + "GEA-028DB" => { hex_lengh => "4", + Protocol => "98", + doubleCode => "no" + }, ); sub SD_BELL_Initialize($) { my ($hash) = @_; - $hash->{Match} = "^P(?:15|32|41|42|57|79|96)#.*"; + $hash->{Match} = "^P(?:15|32|41|42|57|79|96|98)#.*"; $hash->{DefFn} = "SD_BELL::Define"; $hash->{UndefFn} = "SD_BELL::Undef"; $hash->{ParseFn} = "SD_BELL::Parse"; @@ -137,7 +144,7 @@ sub Define($$) { # Argument 0 1 2 3 4 return "SD_BELL: wrong syntax: define SD_BELL " if(int(@a) < 3 || int(@a) > 5); ### checks - doubleCode yes ### - return "SD_BELL: wrong $a[2]" if not($a[2] =~ /^(?:15|32|41|42|57|79|96)/s); + return "SD_BELL: wrong $a[2]" if not($a[2] =~ /^(?:15|32|41|42|57|79|96|98)/s); return "SD_BELL: wrong HEX-Value! Protocol $a[2] HEX-Value <$a[3]> not HEX (0-9 | a-f | A-F)" if (($protocol != 41) && not $a[3] =~ /^[0-9a-fA-F]*$/s); return "SD_BELL: wrong HEX-Value! Protocol $a[2] HEX-Value <$a[3]> not HEX (0-9 | a-f | A-F) or length wrong!" if (($protocol == 41) && not $a[3] =~ /^[0-9a-fA-F]{8}_[0-9a-fA-F]{8}$/s); @@ -198,24 +205,24 @@ sub Set($$$@) { $doubleCodeCheck = 1; @splitCode = split("_", $rawDatasend); $rawDatasend = $splitCode[0]; - } else { - $doubleCodeCheck = 0; - } + } else { + $doubleCodeCheck = 0; + } - Log3 $name, 4, "$ioname: SD_BELL_Set_doubleCodeCheck doubleCodeCheck=$doubleCodeCheck splitCode[0]=$rawDatasend"; + Log3 $name, 4, "$ioname: SD_BELL_Set_doubleCodeCheck doubleCodeCheck=$doubleCodeCheck splitCode[0]=$rawDatasend"; - my $hlen = length($rawDatasend); - my $blen = $hlen * 4; - my $bitData = unpack("B$blen", pack("H$hlen", $rawDatasend)); - my $msg = "P$protocol#" . $bitData; + my $hlen = length($rawDatasend); + my $blen = $hlen * 4; + my $bitData = unpack("B$blen", pack("H$hlen", $rawDatasend)); + my $msg = "P$protocol#" . $bitData; - if ($model eq "Heidemann_|_Heidemann_HX_|_VTX-BELL") { - $msg .= "#R135"; - } else { - $msg .= "#R$repeats"; - } + if ($model eq "Heidemann_|_Heidemann_HX_|_VTX-BELL") { + $msg .= "#R135"; + } else { + $msg .= "#R$repeats"; + } - Log3 $name, 3, "$ioname: $name sendMsg=$msg"; + Log3 $name, 4, "$ioname: $name sendMsg=$msg"; IOWrite($hash, 'sendMsg', $msg); } } @@ -445,6 +452,7 @@ sub Attr(@) {
  • m-e doorbell fuer FG- and Basic-Serie [Protocol 57]
  • Heidemann | Heidemann HX | VTX-BELL_Funkklingel [Protocol 79]
  • Grothe Mistral SE 01.1 (40 bit), 03.1 (48 bit) [Protocol 96]
  • +
  • GEA-028DB [Protokoll 98]

  • Special feature Protocol 41, 2 different codes will be sent one after the other!
    @@ -492,6 +500,7 @@ sub Attr(@) {
  • m-e doorbell für FG- und Basic-Serie [Protokoll 57]
  • Heidemann | Heidemann HX | VTX-BELL_Funkklingel [Protokoll 79]
  • Grothe Mistral SE 01.1 (40 bit), 03.1 (48 bit) [Protokoll 96]
  • +
  • GEA-028DB [Protokoll 98]

  • Besonderheit Protokoll 41, es sendet 2 verschiedene Codes nacheinader!
    diff --git a/FHEM/lib/SD_ProtocolData.pm b/FHEM/lib/SD_ProtocolData.pm index d274c6f52..2407cd486 100644 --- a/FHEM/lib/SD_ProtocolData.pm +++ b/FHEM/lib/SD_ProtocolData.pm @@ -69,7 +69,7 @@ package lib::SD_ProtocolData; use strict; use warnings; - our $VERSION = '1.17'; + our $VERSION = '1.18'; our %protocols = ( "0" => ## various weather sensors (500 | 9100) # Mebus | Id:237 Ch:1 T: 1.9 Bat:low MS;P0=-9298;P1=495;P2=-1980;P3=-4239;D=1012121312131313121313121312121212121212131212131312131212;CP=1;SP=0;R=223;O;m2; @@ -2613,6 +2613,26 @@ package lib::SD_ProtocolData; length_min => '40', length_max => '40', }, + "98" => # Funk-Tuer-Gong: Modell GEA-028DB, Ningbo Rui Xiang Electrical Co.,Ltd., Vertrieb durch Walter Werkzeuge Salzburg GmbH, Art. Nr. K612021A + # https://forum.fhem.de/index.php/topic,109952.0.html 2020-04-12 + # SD_BELL_6A2C MU;P0=1488;P1=-585;P2=520;P3=-1509;P4=1949;P5=-5468;CP=2;R=38;D=01232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501232301230123010101230123230101454501;O; + # SD_BELL_6A2C MU;P0=-296;P1=-1542;P2=1428;P3=-665;P4=483;P5=1927;P6=-5495;P7=92;CP=4;R=31;D=1234141232356562341412341234123232341234141232356562341412341234123232341234141232356562341412341234123232341234141232356562341412341234123232341234141232356562341412341234123232341234141232356562341412341234123232341234141232370;e;i; + { + name => 'GEA-028DB', + comment => 'Wireless doorbell', + knownFreqs => '433.92', + id => '98', + one => [1,-3], + zero => [3,-1], + start => [4,-11,4,-11], + clockabs => 500, + format => 'twostate', + clientmodule => 'SD_BELL', + modulematch => '^P98#', + preamble => 'P98#', + length_min => '16', + length_max => '16', + }, ######################################################################## #### ### old information from incomplete implemented protocols #### #### diff --git a/README.md b/README.md index bb67eb0c4..30ac97464 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Supported Devices / Protocols |FT0073 | Weather sensors| |FreeTec PE-6946 | wireless bell | |Froggit FT007T, FT007TP, FT007TH | Thermo-Hygrometer, Thermometer | +|GEA-028DB | Radio door chime | |GEIGER GF0x01, GF0x02, GF0x03 | Remote control (compatible to Tedsen) | |Grothe Mistral SE 03.1| wireless gong | |GT-9000| Remote control based on protocol GT-9000 with encoding (EASY HOME RCT DS1, Tec Star)| diff --git a/controls_signalduino.txt b/controls_signalduino.txt index ddfc8d4cb..83b0ce8c1 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,11 +1,11 @@ -UPD 2020-04-14_23:06:23 226643 FHEM/00_SIGNALduino.pm +UPD 2020-04-20_16:32:48 226646 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2019-12-26_22:50:15 19839 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm UPD 2019-12-27_17:45:04 13627 FHEM/14_FLAMINGO.pm UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm -UPD 2019-12-27_17:45:04 23464 FHEM/14_SD_BELL.pm +UPD 2020-04-13_14:19:08 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm UPD 2020-04-08_22:57:45 132733 FHEM/14_SD_UT.pm UPD 2020-04-12_22:14:20 68829 FHEM/14_SD_WS.pm @@ -14,5 +14,5 @@ UPD 2020-04-07_23:43:04 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm UPD 2020-01-06_21:42:53 15086 FHEM/90_SIGNALduino_un.pm -UPD 2020-03-30_21:01:10 165155 FHEM/lib/SD_ProtocolData.pm +UPD 2020-04-19_20:42:39 166530 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From 42e2ad59537564dcf028aaf155c6ad91e227a8e2 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 21 Apr 2020 14:15:38 +0000 Subject: [PATCH 17/35] Automatic updated controls and CHANGED --- CHANGED | 1 + controls_signalduino.txt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 6efb00423..80de81e23 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,4 @@ +2020-04-21 - new protocol 98 for wireless door bell GEA-028DB (#839) 2020-04-20 - Merge branch 'dev-r34' into dev-r34_GEA-028DB 2020-04-20 - new protocol 98 for wireless door bell GEA-028DB diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 83b0ce8c1..0410644f8 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,11 +1,11 @@ -UPD 2020-04-20_16:32:48 226646 FHEM/00_SIGNALduino.pm +UPD 2020-04-21_16:14:38 226646 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2019-12-26_22:50:15 19839 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm UPD 2019-12-27_17:45:04 13627 FHEM/14_FLAMINGO.pm UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm -UPD 2020-04-13_14:19:08 24185 FHEM/14_SD_BELL.pm +UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm UPD 2020-04-08_22:57:45 132733 FHEM/14_SD_UT.pm UPD 2020-04-12_22:14:20 68829 FHEM/14_SD_WS.pm @@ -14,5 +14,5 @@ UPD 2020-04-07_23:43:04 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm UPD 2020-01-06_21:42:53 15086 FHEM/90_SIGNALduino_un.pm -UPD 2020-04-19_20:42:39 166530 FHEM/lib/SD_ProtocolData.pm +UPD 2020-04-21_16:14:38 166530 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From f189170d9b8c88b3bec3d8c8018d3e5197830546 Mon Sep 17 00:00:00 2001 From: Udo Date: Tue, 21 Apr 2020 20:42:48 +0200 Subject: [PATCH 18/35] new protocol 99 NAVARIS touch light switch (#841) --- CHANGED | 4 ++- FHEM/00_SIGNALduino.pm | 2 +- FHEM/14_SD_UT.pm | 54 ++++++++++++++++++++++++++++++------- FHEM/lib/SD_ProtocolData.pm | 20 ++++++++++++++ README.md | 1 + controls_signalduino.txt | 6 ++--- 6 files changed, 73 insertions(+), 14 deletions(-) diff --git a/CHANGED b/CHANGED index 80de81e23..81b4d732e 100644 --- a/CHANGED +++ b/CHANGED @@ -1,10 +1,12 @@ +2020-04-21 - Merge branch 'dev-r34' into dev-r34_Navaris +2020-04-21 - new protocol 99 NAVARIS touch light switch 2020-04-21 - new protocol 98 for wireless door bell GEA-028DB (#839) 2020-04-20 - Merge branch 'dev-r34' into dev-r34_GEA-028DB 2020-04-20 - new protocol 98 for wireless door bell GEA-028DB 2020-04-14 - 00_SIGNALduino.pm - Changed stringrefs to coderefs + 2020-04-13 - Bump dev-r34 to v3.4.4 2020-04-13 - Merge remote-tracking branch 'remotes/origin/dev-r34' into v3.4.3 diff --git a/FHEM/00_SIGNALduino.pm b/FHEM/00_SIGNALduino.pm index 3abed60df..6f92ce5eb 100644 --- a/FHEM/00_SIGNALduino.pm +++ b/FHEM/00_SIGNALduino.pm @@ -238,7 +238,7 @@ my %matchListSIGNALduino = ( "14:Dooya" => '^P16#[A-Fa-f0-9]+', "15:SOMFY" => '^Ys[0-9A-F]+', "16:SD_WS_Maverick" => '^P47#[A-Fa-f0-9]+', - "17:SD_UT" => '^P(?:14|20|26|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95|97)#.*', # universal - more devices with different protocols + "17:SD_UT" => '^P(?:14|20|26|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95|97|99)#.*', # universal - more devices with different protocols "18:FLAMINGO" => '^P13\.?1?#[A-Fa-f0-9]+', # Flamingo Smoke "19:CUL_WS" => '^K[A-Fa-f0-9]{5,}', "20:Revolt" => '^r[A-Fa-f0-9]{22}', diff --git a/FHEM/14_SD_UT.pm b/FHEM/14_SD_UT.pm index 2ed5a98e4..466198eaf 100644 --- a/FHEM/14_SD_UT.pm +++ b/FHEM/14_SD_UT.pm @@ -304,6 +304,13 @@ # Momento_0000064 up MU;P0=-1005;P1=-272;P2=258;P3=5856;P4=-3902;P5=1001;P6=-520;P7=508;D=0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121213456565656565656565656565656565656565656565670705656705656567056565670565670567056345656565656565656565656565656565656565656567070565;CP=2;R=63;O; #} ############################################################################################################################################################################### +# - NAVARIS touch light switch Model No.: 44344.04 [Protocol 99] +#{ elektron-bbs 2020-04-14 +# only one touch button +# Navaris_211073 MU;P0=-302;P1=180;P2=294;P3=-208;P4=419;P5=-423;D=01023101010101023232310102323451010231010101023101010231010101010232323101023234510102310101010231010102310101010102323231010232345101023101010102310101023101010101023232310102323451010231010101023101010231010101010232323101023234510102310101010231010102;CP=1;R=36;O; +# Navaris_13F8E3 MU;P0=406;P1=-294;P2=176;P3=286;P4=-191;P6=-415;D=01212134212134343434343434212121343434212121343406212121342121343434343434342121213434342121213434062121213421213434343434343421212134343421212134340621212134212134343434343434212121343434212121343406212121342121343434343434342121213434342121213434062121;CP=2;R=67;O; +#} +############################################################################################################################################################################### # !!! ToDo´s !!! # - LED lights, counter battery-h reading --> commandref hour_counter module # - @@ -664,6 +671,11 @@ my %models = ( Protocol => "P97", Typ => "remote" }, + "Navaris" => { "0" => "send", + hex_lengh => "6", + Protocol => "P99", + Typ => "remote" + }, "unknown" => { Protocol => "any", hex_lengh => "", Typ => "not_exist" @@ -673,7 +685,7 @@ my %models = ( ############################# sub SD_UT_Initialize($) { my ($hash) = @_; - $hash->{Match} = "^P(?:14|20|26|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95|97)#.*"; + $hash->{Match} = "^P(?:14|20|26|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95|97|99)#.*"; $hash->{DefFn} = "SD_UT_Define"; $hash->{UndefFn} = "SD_UT_Undef"; $hash->{ParseFn} = "SD_UT_Parse"; @@ -744,8 +756,8 @@ sub SD_UT_Define($$) { return "wrong HEX-Value! ($a[3]) $a[2] HEX-Value to short | long or not HEX (0-9 | a-f | A-F){4}_[ABCD]|[all]"; } - ### [6] checks MD_2003R | MD_210R | MD_2018R ### - return "wrong HEX-Value! ($a[3]) $a[2] HEX-Value to short | long or not HEX (0-9 | a-f | A-F){6}" if (($a[2] eq "MD_2003R" || $a[2] eq "MD_210R" || $a[2] eq "MD_2018R") && not $a[3] =~ /^[0-9a-fA-F]{6}/s); + ### [6] checks MD_2003R | MD_210R | MD_2018R | Navaris ### + return "wrong HEX-Value! ($a[3]) $a[2] Hex-value to short or long (must be 6 chars) or not hex (0-9 | a-f | A-F){6}" if (($a[2] eq "MD_2003R" || $a[2] eq "MD_210R" || $a[2] eq "MD_2018R" || $a[2] eq "Navaris") && not $a[3] =~ /^[0-9a-fA-F]{6}/s); ### [7] checks Hoermann HSM4 | Krinner_LUMIX | Momento ### if (($a[2] eq "HSM4" || $a[2] eq "Krinner_LUMIX" || $a[2] eq "Momento") && not $a[3] =~ /^[0-9a-fA-F]{7}/s) { @@ -923,6 +935,11 @@ sub SD_UT_Set($$$@) { my $adr = sprintf( "%028b", hex($definition[1])); # argument 1 - adress to binary with 28 bits $msg = $models{$model}{Protocol} . "#" . $adr; $msgEnd = "#R" . $repeats; + ############ Navaris ############ + } elsif ($model eq "Navaris") { + my $adr = sprintf( "%024b", hex($definition[1])); # argument 1 - adress to binary with 24 bits + $msg = $models{$model}{Protocol} . "#" . $adr; + $msgEnd = "#R" . $repeats; ############ xavax ############ } elsif ($model eq "xavax") { my $adr = sprintf( "%016b", hex($definition[1])); # argument 1 - adress to binary with 16 bits @@ -1193,6 +1210,15 @@ sub SD_UT_Parse($$) { } } + if ($hlen == 6) { + ### Remote control Navaris [P99] ### + if (!$def && $protocol == 99) { + $deviceCode = substr($rawData,0,6); + $devicedef = "Navaris " . $deviceCode; + $def = $modules{SD_UT}{defptr}{$devicedef}; + } + } + if ($hlen == 9) { if ($protocol == 91 || $protocol == 91.1) { ### Atlantic Security with all models [P91] or [P91.1 ] with CHECK ### @@ -1571,6 +1597,9 @@ sub SD_UT_Parse($$) { } elsif ($model eq "Momento" && $protocol == 97) { $state = substr($bitData,28,4); $deviceCode = substr($rawData,0,7); + ############ Navaris ############ Protocol 99 ############ + } elsif ($model eq "Navaris" && $protocol == 99) { + $state = "receive"; ############ unknown ############ } else { readingsBulkUpdate($hash, "state", "???"); @@ -1582,7 +1611,8 @@ sub SD_UT_Parse($$) { Log3 $name, 5, "$ioname: SD_UT_Parse devicedef=$devicedef attr_model=$model protocol=$protocol devicecode=$deviceCode state=$state" if($model ne "unknown" && defined($deviceCode)); Log3 $name, 5, "$ioname: SD_UT_Parse devicedef=$devicedef attr_model=$model typ=".$models{$model}{Typ}." (after check)"; - if ($models{$model}{Typ} eq "remote" && ($model ne "SA_434_1_mini" || $model ne "HS1_868_BS")) { + # only models with more then one button + if ($models{$model}{Typ} eq "remote" && ($model ne "SA_434_1_mini" || $model ne "HS1_868_BS" || $model ne "Navaris")) { ### identify state bits to value from hash ### foreach my $keys (sort keys %{ $models{$model}}) { if ($keys eq $state) { @@ -1756,6 +1786,10 @@ sub SD_UT_Attr(@) { $deviceCode = substr($bitData,0,32); $deviceCode = sprintf("%08X", oct( "0b$deviceCode" ) ); $devicename = $devicemodel."_".$deviceCode; + ############ Navaris ############ + } elsif ($attrName eq "model" && $attrValue eq "Navaris") { + $deviceCode = sprintf("%06X", oct( "0b$bitData" ) ); + $devicename = $devicemodel."_".$deviceCode; ############ unknown ############ } else { $devicename = "unknown_please_select_model"; @@ -1856,6 +1890,7 @@ sub SD_UT_tristate2bin($) {
      - Medion OR28V   (module model: OR28V | protocol 68)
      - mumbi AFS300-s (remote control RC-10 | random code wireless switch RCS-22GS)   (module model: RC_10 | protocol 90)
      - Momento (remote control for wireless digital picture frame)   (module model: Momento | protocol 97)
    +
      - NAVARIS touch light switch Model No.: 44344.04   (module model: Navaris | protocol 99)
      - NEFF or Refsta Topdraft (Tecnowind) kitchen hood   (module model: SF01_01319004 | protocol 86)
      - Novy Cloud 230 kitchen hood   (module model: Novy_840039 | protocol 86)
      - Novy Pureline 6830 kitchen hood   (module model: Novy_840029 | protocol 86)
    @@ -2089,7 +2124,7 @@ sub SD_UT_tristate2bin($) {
    • model
      The attribute indicates the model type of your device.
      - (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)
    • + (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)

    • repeats
      This attribute can be used to adjust how many repetitions are sent. Default is 5.

    @@ -2140,10 +2175,10 @@ sub SD_UT_tristate2bin($) {

    SD_UT

      Das Modul SD_UT ist ein Universalmodul vom SIGNALduino für Geräte oder Sensoren.
      - Nach dem ersten anlegen des Gerätes unknown_please_select_model muss der User das Gerät selber definieren via dem Attribut model.
      + Nach dem ersten Anlegen des Gerätes unknown_please_select_model muss der User das Gerät selbst definieren mittels des Attributes model.
      Bei noch nicht unterstützen Geräten können mit dem unknown_please_select_model Gerät Bitdaten gesammelt werden.

      Hinweis: Sobald das Attribut model eines definieren Gerätes verstellt oder gelöscht wird, so legt das Modul ein Gerät des gewählten Typs neu an und mit Durchlauf einer neuen Nachricht wird das aktuelle Gerät gelöscht. - Das betreiben von Geräten des gleichen oder unterschiedliches Typs mit gleichem deviceCode führt zu Fehlern. BITTE achte stets auf einen unterschiedlichen deviceCode.

      + Das Betreiben von Geräten des gleichen oder unterschiedliches Typs mit gleichem deviceCode führt zu Fehlern. BITTE achte stets auf einen unterschiedlichen deviceCode.

      Es werden bisher folgende Geräte unterstützt:
        - Atlantic Security Sensoren   (Modulmodel: MD-2003R, MD-2018R,MD-210R | Protokoll 91|91.1)
           Hinweis: Das Model MD_230R (water) wird aufgrund von gleicher Hardwarekennung als MD-2018R erkannt!
      @@ -2160,7 +2195,8 @@ sub SD_UT_tristate2bin($) {
        - Manax RCS250   (Modulmodel: RC_10 | Protokoll 90)
        - Medion OR28V   (Modulmodel: OR28V | Protokoll 68)
        - mumbi AFS300-s (remote control RC-10 | random code wireless switch RCS-22GS)   (Modulmodel: RC_10 | Protokoll 90)
      -
        - Momento (Fernbedienung für digitalen Bilderrahmen)   (module model: Momento | protocol 97)
      +
        - Momento (Fernbedienung für digitalen Bilderrahmen)   (Modulmodel: Momento | protocol 97)
      +
        - NAVARIS Funk-Licht-Schalter Model No.: 44344.04   (Modulmodel: Navaris | protocol 99)
        - NEFF oder Refsta Topdraft (Tecnowind) Dunstabzugshaube   (Modulmodel: SF01_01319004 | Protokoll 86)
        - Novy Cloud 230 Dunstabzugshaube   (Modulmodel: Novy_840039 | Protokoll 86)
        - Novy Pureline 6830 Dunstabzugshaube   (Modulmodel: Novy_840029 | Protokoll 86)
      @@ -2394,7 +2430,7 @@ sub SD_UT_tristate2bin($) {
      • model
        Das Attribut bezeichnet den Modelltyp Ihres Gerätes.
        - (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)
      • + (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)

      • repeats
        Mit diesem Attribut kann angepasst werden, wie viele Wiederholungen sendet werden. Standard ist 5.

      diff --git a/FHEM/lib/SD_ProtocolData.pm b/FHEM/lib/SD_ProtocolData.pm index 2407cd486..3b284a124 100644 --- a/FHEM/lib/SD_ProtocolData.pm +++ b/FHEM/lib/SD_ProtocolData.pm @@ -2633,6 +2633,26 @@ package lib::SD_ProtocolData; length_min => '16', length_max => '16', }, + "99" => # NAVARIS touch light switch Model No.: 44344.04 + # https://github.com/RFD-FHEM/RFFHEM/issues/828 + # Navaris_211073 MU;P0=-302;P1=180;P2=294;P3=-208;P4=419;P5=-423;D=01023101010101023232310102323451010231010101023101010231010101010232323101023234510102310101010231010102310101010102323231010232345101023101010102310101023101010101023232310102323451010231010101023101010231010101010232323101023234510102310101010231010102;CP=1;R=36;O; + # Navaris_13F8E3 MU;P0=406;P1=-294;P2=176;P3=286;P4=-191;P6=-415;D=01212134212134343434343434212121343434212121343406212121342121343434343434342121213434342121213434062121213421213434343434343421212134343421212134340621212134212134343434343434212121343434212121343406212121342121343434343434342121213434342121213434062121;CP=2;R=67;O; + { + name => 'Navaris 44344.04', + comment => 'Wireless touch light switch', + knownFreqs => '433.92', + id => '99', + one => [3,-2], + zero => [2,-3], + start => [4,-4], + clockabs => 100, + format => 'twostate', + clientmodule => 'SD_UT', + modulematch => '^P99#', + preamble => 'P99#', + length_min => '24', + length_max => '24', + }, ######################################################################## #### ### old information from incomplete implemented protocols #### #### diff --git a/README.md b/README.md index 30ac97464..79c0cb64f 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Supported Devices / Protocols |Medion OR28V | Remote control | |Momento | Remote control for wireless digital picture frame | |Mumbi m-FS300 | Remote control | +|Navaris 44344.04 | Touch light switch | |NC-3911, NC-3912 | Refrigerator thermometer | |Novy 840029, 840039 | Remote control | |Opus XT300 | Soil moisture sensor | diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 0410644f8..ae16f30dd 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,4 +1,4 @@ -UPD 2020-04-21_16:14:38 226646 FHEM/00_SIGNALduino.pm +UPD 2020-04-21_16:35:39 226649 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2019-12-26_22:50:15 19839 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm @@ -7,12 +7,12 @@ UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm -UPD 2020-04-08_22:57:45 132733 FHEM/14_SD_UT.pm +UPD 2020-04-14_21:10:18 135052 FHEM/14_SD_UT.pm UPD 2020-04-12_22:14:20 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-07_23:43:04 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm UPD 2020-01-06_21:42:53 15086 FHEM/90_SIGNALduino_un.pm -UPD 2020-04-21_16:14:38 166530 FHEM/lib/SD_ProtocolData.pm +UPD 2020-04-21_16:35:39 167811 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From 5fdcf47d4cf360bde7a1b9d0cfeb353fb6bcee0e Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 21 Apr 2020 18:43:04 +0000 Subject: [PATCH 19/35] Automatic updated controls and CHANGED --- CHANGED | 1 + controls_signalduino.txt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 81b4d732e..b3d5d7795 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,4 @@ +2020-04-21 - new protocol 99 NAVARIS touch light switch (#841) 2020-04-21 - Merge branch 'dev-r34' into dev-r34_Navaris 2020-04-21 - new protocol 99 NAVARIS touch light switch 2020-04-21 - new protocol 98 for wireless door bell GEA-028DB (#839) diff --git a/controls_signalduino.txt b/controls_signalduino.txt index ae16f30dd..ed15713d8 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,4 +1,4 @@ -UPD 2020-04-21_16:35:39 226649 FHEM/00_SIGNALduino.pm +UPD 2020-04-21_20:42:48 226649 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2019-12-26_22:50:15 19839 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm @@ -7,12 +7,12 @@ UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm -UPD 2020-04-14_21:10:18 135052 FHEM/14_SD_UT.pm +UPD 2020-04-21_20:42:48 135052 FHEM/14_SD_UT.pm UPD 2020-04-12_22:14:20 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-07_23:43:04 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm UPD 2020-01-06_21:42:53 15086 FHEM/90_SIGNALduino_un.pm -UPD 2020-04-21_16:35:39 167811 FHEM/lib/SD_ProtocolData.pm +UPD 2020-04-21_20:42:48 167811 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From ce67314476a924d80f85ab6b346e1535ad4ab8bf Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 22 Apr 2020 21:23:42 +0000 Subject: [PATCH 20/35] Automatic updated controls and CHANGED --- CHANGED | 1 + controls_signalduino.txt | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index 09df73049..69cc98911 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,4 @@ +2020-04-22 - Merge branch 'dev-r34' into dev-r34_operatorFixes 2020-04-22 - 00_SIGNALduino.pm - some operator fixes #835 2020-04-21 - new protocol 99 NAVARIS touch light switch (#841) 2020-04-21 - Merge branch 'dev-r34' into dev-r34_Navaris diff --git a/controls_signalduino.txt b/controls_signalduino.txt index d733c9685..3a23b3199 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,4 +1,4 @@ -UPD 2020-04-15_23:26:20 226643 FHEM/00_SIGNALduino.pm +UPD 2020-04-22_23:23:26 226649 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2020-04-16_21:15:43 19841 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm @@ -8,11 +8,11 @@ UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm UPD 2020-04-21_20:42:48 135052 FHEM/14_SD_UT.pm -UPD 2020-04-12_22:14:20 68829 FHEM/14_SD_WS.pm +UPD 2020-04-15_23:37:43 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm -UPD 2020-01-06_21:42:53 15086 FHEM/90_SIGNALduino_un.pm +UPD 2020-04-15_23:37:19 15082 FHEM/90_SIGNALduino_un.pm UPD 2020-04-21_20:42:48 167811 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From 0bc3accb6967892fc816077e4adf69c7daede2ad Mon Sep 17 00:00:00 2001 From: Udo Date: Sat, 2 May 2020 21:10:07 +0200 Subject: [PATCH 21/35] new protocol 104 for remote control TR60C-1 (#844) * Update 14_SD_UT.pm --- CHANGED | 6 +- FHEM/00_SIGNALduino.pm | 2 +- FHEM/14_SD_UT.pm | 114 ++++++++++++++++++++++++++++-------- FHEM/lib/SD_ProtocolData.pm | 24 +++++++- README.md | 1 + controls_signalduino.txt | 6 +- 6 files changed, 121 insertions(+), 32 deletions(-) diff --git a/CHANGED b/CHANGED index 69cc98911..def1d82f8 100644 --- a/CHANGED +++ b/CHANGED @@ -1,11 +1,9 @@ +2020-05-02 - Merge branch 'dev-r34' into dev-r34_TR60C-1 +2020-05-02 - new protocol 104 for remote control TR60C-1 2020-04-22 - Merge branch 'dev-r34' into dev-r34_operatorFixes 2020-04-22 - 00_SIGNALduino.pm - some operator fixes #835 2020-04-21 - new protocol 99 NAVARIS touch light switch (#841) -2020-04-21 - Merge branch 'dev-r34' into dev-r34_Navaris -2020-04-21 - new protocol 99 NAVARIS touch light switch 2020-04-21 - new protocol 98 for wireless door bell GEA-028DB (#839) -2020-04-20 - Merge branch 'dev-r34' into dev-r34_GEA-028DB -2020-04-20 - new protocol 98 for wireless door bell GEA-028DB 2020-04-14 - 00_SIGNALduino.pm Changed stringrefs to coderefs diff --git a/FHEM/00_SIGNALduino.pm b/FHEM/00_SIGNALduino.pm index 27ea08e00..60763a386 100644 --- a/FHEM/00_SIGNALduino.pm +++ b/FHEM/00_SIGNALduino.pm @@ -238,7 +238,7 @@ my %matchListSIGNALduino = ( "14:Dooya" => '^P16#[A-Fa-f0-9]+', "15:SOMFY" => '^Ys[0-9A-F]+', "16:SD_WS_Maverick" => '^P47#[A-Fa-f0-9]+', - "17:SD_UT" => '^P(?:14|20|26|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95|97|99)#.*', # universal - more devices with different protocols + "17:SD_UT" => '^P(?:14|20|26|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95|97|99|104)#.*', # universal - more devices with different protocols "18:FLAMINGO" => '^P13\.?1?#[A-Fa-f0-9]+', # Flamingo Smoke "19:CUL_WS" => '^K[A-Fa-f0-9]{5,}', "20:Revolt" => '^r[A-Fa-f0-9]{22}', diff --git a/FHEM/14_SD_UT.pm b/FHEM/14_SD_UT.pm index 466198eaf..cc6146ed0 100644 --- a/FHEM/14_SD_UT.pm +++ b/FHEM/14_SD_UT.pm @@ -25,6 +25,11 @@ # Adresse 8 | 1000 (off|on|on|on): I - fan minimum speed | get sduino_dummy raw MU;;P0=-11250;;P1=-200;;P2=263;;P3=-116;;P4=-374;;P5=578;;P6=-697;;D=1232456245454562626245626262024562454545626262456262620245624545456262624562626202456245454562626245626262024562454545626262456262620245624545456262624562626202456245454562626245626262024562454545626262456262620245624545456262624562626202456245454562626;;CP=2;;R=49;;O;; # Adresse c | 1100 (off|off|on|on): fan_off | get sduino_dummy raw MU;;P0=-720;;P1=235;;P2=-386;;P3=561;;P4=-11254;;D=01230141230101232301010101012301412301012323010101010123014123010123230101010101010141230101232301010101010101412301012323010101010101014123010123230101010101010;;CP=1;;R=242;; #} Adresse c | 1100 (off|off|on|on): fan_off | get sduino_dummy raw MU;;P0=-11230;;P1=258;;P2=-390;;P3=571;;P4=-699;;D=0123414123234141414141234101234141232341414141412341012341412323414141414123410123414123234141414141234101234141232341414141412341012341412323414141414123410123414123234141414141234101234141232341414141412341012341412323414141414123410123414123234141414;;CP=1;;R=246;;O;; +#################################################################################################################################### +# - Deckenventilator mit Licht Westinghouse Bendan (remote control TR60C-1 with touch screen) [Protocol 104] +#{ Adresse 0 | DIP 0000 Licht aus/Ventilator aus | get sduino_dummy raw MU;P0=18280;P1=-737;P2=419;P3=-331;P4=799;P5=-9574;P6=-7080;D=012121234343434341212121212121252121212123434343434121212121212125212121212343434343412121212121212521212121234343434341212121212121252121212123434343434121212121212126;CP=2;R=2; +# Adresse 8 | DIP 1000 Licht an/Ventilator aus | get sduino_dummy raw MU;P0=-2496;P1=778;P2=-755;P3=379;P4=-358;P5=-9582;D=0123232341414141412323234141414153412323234141414141232323414141415341232323414141414123232341414141534123232341414141412323234141414153412323234141414141232323414141415341232323414141414123232341414141;CP=3;R=12; +#} Adresse B | DIP 1011 Licht an/Ventilator aus | get sduino_dummy raw MU;P0=25688;P1=-764;P2=381;P3=-371;P4=773;P5=-9586;P6=-20664;P7=-176;D=012343434343434341212123434343452341234343434343434121212343434345234123434343434343412121234343434523412343434343434341212123434343452341234343434343434121212343434345234123434343434343412121234343434627;CP=4;R=3; ############################################################################################################################################################################### # - Remote control SA-434-1 mini 923301 [Protocol 81] and [additionally Protocol 83 + Protocol 86] #{ one Button, 434 MHz @@ -522,6 +527,27 @@ my %models = ( Protocol => "P83", Typ => "remote" }, + 'TR60C1' => { '111110000000' => 'light_off_fan_off', + '110110000000' => 'light_off_fan_1', + '001110000000' => 'light_off_fan_2', + '101110000000' => 'light_off_fan_3', + '011110000000' => 'light_off_fan_4', + '111110001111' => 'light_on_fan_off', + '110110001111' => 'light_on_fan_1', + '001110001111' => 'light_on_fan_2', + '101110001111' => 'light_on_fan_3', + '011110001111' => 'light_on_fan_4', + '11111000' => 'fan_off', # is not sent directly + '11011000' => 'fan_1', # is not sent directly + '00111000' => 'fan_2', # is not sent directly + '10111000' => 'fan_3', # is not sent directly + '01111000' => 'fan_4', # is not sent directly + '0000' => 'light_off', # is not sent directly + '1111' => 'light_on', # is not sent directly + hex_lengh => '4', + Protocol => 'P104', + Typ => 'remote' + }, "SA_434_1_mini" => { "0" => "send", hex_lengh => "3", Protocol => "P81", @@ -685,7 +711,7 @@ my %models = ( ############################# sub SD_UT_Initialize($) { my ($hash) = @_; - $hash->{Match} = "^P(?:14|20|26|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95|97|99)#.*"; + $hash->{Match} = "^P(?:14|20|26|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95|97|99|104)#.*"; $hash->{DefFn} = "SD_UT_Define"; $hash->{UndefFn} = "SD_UT_Undef"; $hash->{ParseFn} = "SD_UT_Parse"; @@ -719,13 +745,13 @@ sub SD_UT_Define($$) { ### checks unknown ### return "wrong define: $a[2] need no HEX-Value to define!" if($a[2] eq "unknown" && $a[3] && length($a[3]) >= 1); - ### checks Westinghouse_Delancey RH787T & WestinghouseButtons_five ### - if ($a[2] eq "RH787T" || $a[2] eq "Buttons_five") { + ### checks Westinghouse_Delancey RH787T & WestinghouseButtons_five & TR60C-1 ### + if ($a[2] eq "RH787T" || $a[2] eq "Buttons_five" || $a[2] eq 'TR60C1') { if (length($a[3]) > 1) { - return "wrong HEX-Value! $a[2] have one HEX-Value"; + return "Wrong HEX-Value! $a[2] must have one HEX-Value"; } if (not $a[3] =~ /^[0-9a-fA-F]{1}/s) { - return "wrong HEX-Value! ($a[3]) $a[2] HEX-Value are not (0-9 | a-f | A-F)"; + return "Wrong HEX-Value! ($a[3]) $a[2] HEX-Value are not (0-9 | a-f | A-F)"; } } @@ -821,15 +847,32 @@ sub SD_UT_Set($$$@) { my $adr = sprintf( "%04b", hex($definition[1])); # argument 1 - adress to binary with 4 digits $msg = $models{$model}{Protocol} . "#0" . $adr ."1"; $msgEnd = "#R" . $repeats; + ############ Westinghouse TR60C-1 ############ + } elsif ($model eq 'TR60C1') { + my $adr = sprintf( "%04b", hex($definition[1])); # argument 1 - adress to binary with 4 digits + $msg = $models{$model}{Protocol} . "#" . $adr; + if (length($cmd) < 10) { + my @oldstate = split('_',ReadingsVal($name, 'state', 'light_off_fan_off')); + if (scalar(@oldstate) == 4) { + if (length($cmd) < 8) { # fan + $cmd = $oldstate[0] . '_' . $oldstate[1] . '_' . $cmd; + } else { # light + $cmd .= '_' . $oldstate[2] . '_' . $oldstate[3]; + } + Log3 $name, 4, "$ioname: SD_UT_Set $name oldstate=$oldstate[0]_$oldstate[1]_$oldstate[2]_$oldstate[3] newcmd=$cmd"; + } + } + $msgEnd = "#R" . $repeats; ############ Westinghouse Buttons_five ############ } elsif ($model eq "Buttons_five") { my $adr = sprintf( "%04b", hex($definition[1])); # argument 1 - adress to binary with 4 digits $msg = $models{$model}{Protocol} . "#"; $msgEnd .= "11".$adr."#R" . $repeats; - ############ SA_434_1_mini ############ + ############ SA_434_1_mini only one button ############ } elsif ($model eq "SA_434_1_mini") { my $bitData = sprintf( "%012b", hex($definition[1])); # argument 1 - adress to binary with 12 digits $msg = $models{$model}{Protocol} . "#" . $bitData . "#R" . $repeats; + $cmd = 'send'; ############ Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx ############ } elsif ($model eq "Tedsen_SKX1xx" || $model eq "Tedsen_SKX2xx" || $model eq "Tedsen_SKX4xx" || $model eq "Tedsen_SKX6xx") { my $adr = SD_UT_tristate2bin($definition[1]); # argument 1 - adress tristate to bin with 18 bits @@ -866,11 +909,12 @@ sub SD_UT_Set($$$@) { my $adr = sprintf( "%016b", hex($definition[1])); # argument 1 - adress to binary with 16 digits $msg = $models{$model}{Protocol} . "#" . substr($adr,0,14); $msgEnd = "#R" . $repeats; - ############ Hoermann HS1-868-BS ############ + ############ Hoermann HS1-868-BS only 1 button ############ } elsif ($model eq "HS1_868_BS") { my $bitData = "00000000"; $bitData .= sprintf( "%036b", hex($definition[1])); # argument 1 - adress to binary with 36 digits $msg = $models{$model}{Protocol} . "#" . $bitData . "#R" . $repeats; + $cmd = 'send'; ############ Hoermann HSM4 ############ } elsif ($model eq "HSM4") { my $adr = sprintf( "%028b", hex($definition[1])); # argument 1 - adress to binary with 28 digits @@ -935,11 +979,11 @@ sub SD_UT_Set($$$@) { my $adr = sprintf( "%028b", hex($definition[1])); # argument 1 - adress to binary with 28 bits $msg = $models{$model}{Protocol} . "#" . $adr; $msgEnd = "#R" . $repeats; - ############ Navaris ############ + ############ Navaris only one button ############ } elsif ($model eq "Navaris") { my $adr = sprintf( "%024b", hex($definition[1])); # argument 1 - adress to binary with 24 bits - $msg = $models{$model}{Protocol} . "#" . $adr; - $msgEnd = "#R" . $repeats; + $msg = $models{$model}{Protocol} . "#" . $adr . "#R" . $repeats; + $cmd = 'send'; ############ xavax ############ } elsif ($model eq "xavax") { my $adr = sprintf( "%016b", hex($definition[1])); # argument 1 - adress to binary with 16 bits @@ -969,7 +1013,8 @@ sub SD_UT_Set($$$@) { last if ($value eq $cmd); } } - + return "$name Unkown set command!" if ($value ne $cmd); + ############ KL_RF01 ############ if ($model eq "KL_RF01") { my $save2 = $save; @@ -1027,7 +1072,6 @@ sub SD_UT_Set($$$@) { Log3 $name, 3, "$ioname: $name set $cmd"; ## for hex output ## - my @split = split("#", $msg); my $hexvalue = $split[1]; $hexvalue =~ s/P+//g; # if P parameter, replace P with nothing @@ -1136,6 +1180,15 @@ sub SD_UT_Parse($$) { } } + if ($hlen == 4) { + ### Westinghouse TR60C-1 [P104] ### + if (!$def && $protocol == 104) { + $deviceCode = substr($rawData,0,1); + $devicedef = 'TR60C1 ' . $deviceCode; + $def = $modules{SD_UT}{defptr}{$devicedef}; + } + } + if ($hlen == 5) { ### Chilitec_22640 [P14] ### if (!$def && $protocol == 14) { @@ -1193,6 +1246,15 @@ sub SD_UT_Parse($$) { } } + if ($hlen == 6) { + ### Remote control Navaris [P99] ### + if (!$def && $protocol == 99) { + $deviceCode = substr($rawData,0,6); + $devicedef = "Navaris " . $deviceCode; + $def = $modules{SD_UT}{defptr}{$devicedef}; + } + } + if ($hlen == 8) { if (!$def && $protocol == 20) { ### Remote control RCnoName20 [P20] ### @@ -1210,15 +1272,6 @@ sub SD_UT_Parse($$) { } } - if ($hlen == 6) { - ### Remote control Navaris [P99] ### - if (!$def && $protocol == 99) { - $deviceCode = substr($rawData,0,6); - $devicedef = "Navaris " . $deviceCode; - $def = $modules{SD_UT}{defptr}{$devicedef}; - } - } - if ($hlen == 9) { if ($protocol == 91 || $protocol == 91.1) { ### Atlantic Security with all models [P91] or [P91.1 ] with CHECK ### @@ -1600,6 +1653,10 @@ sub SD_UT_Parse($$) { ############ Navaris ############ Protocol 99 ############ } elsif ($model eq "Navaris" && $protocol == 99) { $state = "receive"; + ### Westinghouse TR60C-1 [P104] ### + } elsif ($model eq 'TR60C1' && $protocol == 104) { + $state = substr($bitData,4,12); + $deviceCode = substr($rawData,0,1); ############ unknown ############ } else { readingsBulkUpdate($hash, "state", "???"); @@ -1659,6 +1716,10 @@ sub SD_UT_Attr(@) { my $bitData; my $hex_lengh = length(InternalVal($name, "lastMSG", "0")); + if ($cmd eq "set" && $attrName eq 'repeats' && $attrValue !~ m/^[1-9]$/i) { + return "$name: Unallowed value $attrValue for the attribute repetition (must be 1 - 9)!"; + } + ############ chance device models ############ if ($cmd eq "set" && $attrName eq "model" && $attrValue ne $oldmodel) { @@ -1695,6 +1756,11 @@ sub SD_UT_Attr(@) { $deviceCode = substr($bitData,1,4); $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); $devicename = $devicemodel."_".$deviceCode; + ############ Westinghouse TR60C-1 ############ + } elsif ($attrName eq 'model' && $attrValue eq 'TR60C1') { + $deviceCode = substr($bitData,0,4); + $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; ############ Westinghouse Buttons_five ############ } elsif ($attrName eq "model" && $attrValue eq "Buttons_five") { $deviceCode = substr($bitData,8,4); @@ -1909,6 +1975,7 @@ sub SD_UT_tristate2bin($) {
        - unitec remote door reed switch 47031 (Unitec 47121 | Unitec 47125 | Friedland)   (module model: Unitec_47031 | protocol 30)
        - Westinghouse Delancey ceiling fan (remote, 5 buttons without SET)   (module model: Buttons_five | protocol 29)
        - Westinghouse Delancey ceiling fan (remote, 9 buttons with SET)   (module model: RH787T | protocol 83)
      +
        - Westinghouse ceiling fan Bendan (remote control TR60C-1, touch screen)   (module model: TR60C1 | protocol 104)
        - xavax 00111939 (remote control, 10 buttons)   (Modulmodel: xavax | protocol 26)


      Define
      @@ -2124,7 +2191,7 @@ sub SD_UT_tristate2bin($) {
      • model
        The attribute indicates the model type of your device.
        - (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)
      • + (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, TR60C1, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)

      • repeats
        This attribute can be used to adjust how many repetitions are sent. Default is 5.

      @@ -2214,6 +2281,7 @@ sub SD_UT_tristate2bin($) {
        - unitec remote door reed switch 47031 (Unitec 47121 | Unitec 47125 | Friedland)   (Modulmodel: Unitec_47031 | Protokoll 30)
        - Westinghouse Deckenventilator (Fernbedienung, 5 Tasten ohne SET)   (Modulmodel: Buttons_five | Protokoll 29)
        - Westinghouse Delancey Deckenventilator (Fernbedienung, 9 Tasten mit SET)   (Modulmodel: RH787T | Protokoll 83)
      +
        - Westinghouse Deckenventilator Bendan (Fernbedienung TR60C-1, Touch screen)   (Modulmodel: TR60C1 | Protokoll 104)
        - xavax 00111939 (Fernbedienung, 10 Tasten)   (Modulmodel: xavax | Protokoll 26)


      @@ -2430,7 +2498,7 @@ sub SD_UT_tristate2bin($) {
      • model
        Das Attribut bezeichnet den Modelltyp Ihres Gerätes.
        - (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)
      • + (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, TR60C1, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)

      • repeats
        Mit diesem Attribut kann angepasst werden, wie viele Wiederholungen sendet werden. Standard ist 5.

      diff --git a/FHEM/lib/SD_ProtocolData.pm b/FHEM/lib/SD_ProtocolData.pm index 3b284a124..b107669f5 100644 --- a/FHEM/lib/SD_ProtocolData.pm +++ b/FHEM/lib/SD_ProtocolData.pm @@ -69,7 +69,7 @@ package lib::SD_ProtocolData; use strict; use warnings; - our $VERSION = '1.18'; + our $VERSION = '1.19'; our %protocols = ( "0" => ## various weather sensors (500 | 9100) # Mebus | Id:237 Ch:1 T: 1.9 Bat:low MS;P0=-9298;P1=495;P2=-1980;P3=-4239;D=1012121312131313121313121312121212121212131212131312131212;CP=1;SP=0;R=223;O;m2; @@ -2653,6 +2653,28 @@ package lib::SD_ProtocolData; length_min => '24', length_max => '24', }, + "104" => # Remote control TR60C-1 with touch screen from Satellite Electronic (Zhongshan) Ltd., Importer Westinghouse Lighting for ceiling fan Bendan + # https://forum.fhem.de/index.php?topic=53282.msg1045428#msg1045428 phoenix-anasazi 2020-04-21 + # TR60C1_0 light_off_fan_off MU;P0=18280;P1=-737;P2=419;P3=-331;P4=799;P5=-9574;P6=-7080;D=012121234343434341212121212121252121212123434343434121212121212125212121212343434343412121212121212521212121234343434341212121212121252121212123434343434121212121212126;CP=2;R=2; + # TR60C1_9 light_off_fan_4 MU;P0=14896;P1=-751;P2=394;P3=-370;P4=768;P5=-9572;P6=-21472;D=0121234123434343412121212121212523412123412343434341212121212121252341212341234343434121212121212125234121234123434343412121212121212523412123412343434341212121212121252341212341234343434121212121212126;CP=2;R=4; + # TR60C1_B light_on_fan_2 MU;P0=-96;P1=152;P2=-753;P3=389;P4=-374;P5=769;P6=-9566;P7=-19920;D=012345454523232345454545634523454523234545452323234545454563452345452323454545232323454545456345234545232345454523232345454545634523454523234545452323234545454563452345452323454545232323454545457;CP=3;R=1; + # https://github.com/RFD-FHEM/RFFHEM/issues/842 + { + name => 'TR60C-1', + comment => 'Remote control for example Westinghouse Bendan 77841B', + id => '104', + knownFreqs => '433.92', + one => [-1,2], # -380,760 + zero => [-2,1], # -760,380 + start => [-25,1], # -9500,380 + clockabs => 380, + format => 'twostate', + clientmodule => 'SD_UT', + modulematch => '^P104#', + preamble => 'P104#', + length_min => '16', + length_max => '16', + }, ######################################################################## #### ### old information from incomplete implemented protocols #### #### diff --git a/README.md b/README.md index 79c0cb64f..7e859768f 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Supported Devices / Protocols |Techmar Garden Lights | Remote control | |Technoline TX3 | Weather sensor | |Tedsen SKX1xx, SKX2xx, SKX4xx, SKX6xx | Remote control | +|TR60C-1 | Remote control with touch screen | |Visivon remote PT4450 | Remote control | |VLOXO | wireless bell | |WH2 | (TFA 30.3157 nur Temp, Hum = 255 -> nicht angezeigt)| diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 3a23b3199..ac0552f08 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,4 +1,4 @@ -UPD 2020-04-22_23:23:26 226649 FHEM/00_SIGNALduino.pm +UPD 2020-05-02_17:36:35 226653 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2020-04-16_21:15:43 19841 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm @@ -7,12 +7,12 @@ UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm -UPD 2020-04-21_20:42:48 135052 FHEM/14_SD_UT.pm +UPD 2020-04-28_21:05:30 139288 FHEM/14_SD_UT.pm UPD 2020-04-15_23:37:43 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm UPD 2020-04-15_23:37:19 15082 FHEM/90_SIGNALduino_un.pm -UPD 2020-04-21_20:42:48 167811 FHEM/lib/SD_ProtocolData.pm +UPD 2020-04-22_20:41:36 169560 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From e398f2ca414022729ba6187e23856736f53ea8eb Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 2 May 2020 19:10:23 +0000 Subject: [PATCH 22/35] Automatic updated controls and CHANGED --- CHANGED | 3 +++ controls_signalduino.txt | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index def1d82f8..e24d02144 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,6 @@ +2020-05-02 - new protocol 104 for remote control TR60C-1 (#844) + +* Update 14_SD_UT.pm 2020-05-02 - Merge branch 'dev-r34' into dev-r34_TR60C-1 2020-05-02 - new protocol 104 for remote control TR60C-1 2020-04-22 - Merge branch 'dev-r34' into dev-r34_operatorFixes diff --git a/controls_signalduino.txt b/controls_signalduino.txt index ac0552f08..915db68dd 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,4 +1,4 @@ -UPD 2020-05-02_17:36:35 226653 FHEM/00_SIGNALduino.pm +UPD 2020-05-02_21:10:07 226653 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm UPD 2020-04-16_21:15:43 19841 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm @@ -7,12 +7,12 @@ UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm -UPD 2020-04-28_21:05:30 139288 FHEM/14_SD_UT.pm +UPD 2020-05-02_21:10:07 139288 FHEM/14_SD_UT.pm UPD 2020-04-15_23:37:43 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm UPD 2020-04-15_23:37:19 15082 FHEM/90_SIGNALduino_un.pm -UPD 2020-04-22_20:41:36 169560 FHEM/lib/SD_ProtocolData.pm +UPD 2020-05-02_21:10:07 169560 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From 22084982b3402bcbd349a13f021927448634153f Mon Sep 17 00:00:00 2001 From: Udo Date: Mon, 25 May 2020 11:01:37 +0200 Subject: [PATCH 23/35] add attribute UTfrequency in 14_SD_UT.pm (#845) * SD_UT new attribute UTfrequency for individual transmission frequency Multiple query "$ attrName eq 'model'" removed change commandref replace "foreach my $keys (keys %models)" with "if ( exists $models{$attrValue}" in line 1756 replace "foreach my $keys (sort keys %{$models{RC_10}{buttons}})" with "if ( exists $models{RC_10}{buttons}{$button} )" in line 1845 replace "foreach my $keys (keys %models)" with "grep { $models{$_}{hex_lengh} =~ /$hex_lengh/ } keys %models;" in line 1745 delete "$attr{$name}{room} = "SD_UT" if( not defined( $attr{$name}{room} ) );" change search for models with same hex_length --- CHANGED | 33 + FHEM/14_SD_UT.pm | 1372 +++++++++++++++++--------------------- controls_signalduino.txt | 2 +- 3 files changed, 629 insertions(+), 778 deletions(-) diff --git a/CHANGED b/CHANGED index e24d02144..05b4d51fa 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,36 @@ +2020-05-24 - Update 14_SD_UT.pm + +Reference to autocreate added +2020-05-23 - Update 14_SD_UT.pm + +change commandref engl. +2020-05-22 - Update 14_SD_UT.pm + +change search for models with same hex_length +rename hex_lengh in hex_length +2020-05-20 - Update 14_SD_UT.pm + +replace "foreach my $keys (keys %models)" with "grep { $models{$_}{hex_lengh} =~ /$hex_lengh/ } keys %models;" in line 1745 +delete "$attr{$name}{room} = "SD_UT" if( not defined( $attr{$name}{room} ) );" +2020-05-18 - Update 14_SD_UT.pm + +replace "foreach my $keys (sort keys %{$models{RC_10}{buttons}})" with "if ( exists $models{RC_10}{buttons}{$button} )" in line 1845 +2020-05-17 - Update 14_SD_UT.pm + +replace "foreach my $keys (keys %models)" with "if ( exists $models{$attrValue}" in line 1756 +minor corrections in html_DE +2020-05-17 - Update 14_SD_UT.pm + +update html_DE +2020-05-12 - Update 14_SD_UT.pm - change commandref + +change commandref +2020-05-07 - Update 14_SD_UT.pm + +Check values ​​attribute UTfrequency added +Documentation for UTfrequency attribute added +Multiple query "$ attrName eq 'model'" removed +2020-05-06 - SD_UT new attribute UTfrequency for individual transmission frequency 2020-05-02 - new protocol 104 for remote control TR60C-1 (#844) * Update 14_SD_UT.pm diff --git a/FHEM/14_SD_UT.pm b/FHEM/14_SD_UT.pm index cc6146ed0..2be7bbc60 100644 --- a/FHEM/14_SD_UT.pm +++ b/FHEM/14_SD_UT.pm @@ -70,32 +70,32 @@ # 0111010011 "power_on_off" - nur 10 Bit, SIGNALduino.pm hängt 2 Nullen an # https://github.com/RFD-FHEM/RFFHEM/issues/331 # nibble 0-1 -> Ident | nibble 2-4 -> Tastencode -# light_on_off - hex_lengh 5 get sduino_dummy raw MU;;P0=710;;P1=353;;P2=-403;;P4=-761;;P6=-16071;;D=20204161204120412041204120414141204120202041612041204120412041204141412041202020416120412041204120412041414120412020204161204120412041204120414141204120202041;;CP=1;;R=40;; -# novy - hex_lengh 3 get sduino_dummy raw MU;;P0=706;;P1=-763;;P2=370;;P3=-405;;P4=-15980;;D=0123012301230304230123012301230123012303042;;CP=2;;R=42;; -# power_on_off - hex_lengh 5 get sduino_dummy raw MU;;P0=-756;;P1=718;;P2=354;;P3=-395;;P4=-16056;;D=01020202310231310202423102310231023102310202023102313102024231023102310231023102020231023131020242310231023102310231020202310231310202;;CP=2;;R=41;; -# speed_minus - hex_lengh 3 get sduino_dummy raw MU;;P0=-8032;;P1=364;;P2=-398;;P3=700;;P4=-760;;P5=-15980;;D=0123412341234123412341412351234123412341234123414123512341234123412341234141235123412341234123412341412351234123412341234123414123;;CP=1;;R=40;; -#} speed_plus - hex_lengh 3 get sduino_dummy raw MU;;P0=22808;;P1=-24232;;P2=701;;P3=-765;;P4=357;;P5=-15970;;P7=-406;;D=012345472347234723472347234723454723472347234723472347234547234723472347234723472345472347234723472347234723454723472347234723472347234;;CP=4;;R=39;; +# light_on_off - hex_length 5 get sduino_dummy raw MU;;P0=710;;P1=353;;P2=-403;;P4=-761;;P6=-16071;;D=20204161204120412041204120414141204120202041612041204120412041204141412041202020416120412041204120412041414120412020204161204120412041204120414141204120202041;;CP=1;;R=40;; +# novy - hex_length 3 get sduino_dummy raw MU;;P0=706;;P1=-763;;P2=370;;P3=-405;;P4=-15980;;D=0123012301230304230123012301230123012303042;;CP=2;;R=42;; +# power_on_off - hex_length 5 get sduino_dummy raw MU;;P0=-756;;P1=718;;P2=354;;P3=-395;;P4=-16056;;D=01020202310231310202423102310231023102310202023102313102024231023102310231023102020231023131020242310231023102310231020202310231310202;;CP=2;;R=41;; +# speed_minus - hex_length 3 get sduino_dummy raw MU;;P0=-8032;;P1=364;;P2=-398;;P3=700;;P4=-760;;P5=-15980;;D=0123412341234123412341412351234123412341234123414123512341234123412341234141235123412341234123412341412351234123412341234123414123;;CP=1;;R=40;; +#} speed_plus - hex_length 3 get sduino_dummy raw MU;;P0=22808;;P1=-24232;;P2=701;;P3=-765;;P4=357;;P5=-15970;;P7=-406;;D=012345472347234723472347234723454723472347234723472347234547234723472347234723472345472347234723472347234723454723472347234723472347234;;CP=4;;R=39;; ### # - Remote Control Novy_840039 for Novy Cloud 230 kitchen hood [Protocol 86] (Länge je nach Taste 12 oder 18 Bit) [additionally Protocol 81] # https://github.com/RFD-FHEM/RFFHEM/issues/792 | https://forum.fhem.de/index.php/topic,107867.0.html #{ nibble 0-1 -> Ident | nibble 2-4 -> Tastencode -# 0111010011 "power_on_off" - nur 10 Bit, SIGNALduino.pm hängt 2 Nullen an hex_lengh 5 get sduino_dummy raw MU;;P0=-749;;P1=378;;P2=-456;;P3=684;;P4=-16081;;D=01230101012301232301014123012301230123012301010123012323010141230123012301230123010101230123230101412;;CP=1;;R=66;; -# 0110110110 "cooking_light_on" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P0=-4768;;P1=380;;P2=-397;;P3=690;;P4=-755;;P5=-16077;;CP=1;;R=39;;D=0123412341234123412341412341412341412351234123412341234123414123414123414123;;O;;w=0;; -# 0110110100 "cooking_light_off" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P0=382;;P1=200;;P2=-745;;P4=-394;;P5=696;;P6=-16083;;CP=0;;R=81;;D=1204520204520204520454560452045204520452045202045202045204545;;O;;w=0;; -# 0110110101 "cooking_light_dim_plus" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P0=-753;;P1=387;;P2=-419;;P3=679;;P6=-16050;;CP=1;;R=58;;D=0123012301012301012301230161230123012301230123010123010123012301;;p;;w=0;; -# 0110110011 "cooking_light_dim_minus" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P1=386;;P2=-394;;P3=694;;P4=-794;;P5=-16064;;CP=1;;R=51;;D=123412341234123412341412341412323414151234123412341234123414123414123234141;;p;;w=0;; -# 0111001110 "cooking_light_cold" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P0=-92;;P1=371;;P2=-738;;P4=-393;;P5=702;;P6=-16072;;CP=1;;R=69;;D=012145214521212145452121214561452145214521452145212121454521212145;;e;;w=0;; -# 0111001011 "cooking_light_warm" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P0=-17440;;P1=381;;P2=-415;;P3=668;;P4=-756;;P6=-6786;;CP=1;;R=85;;D=0123412341234123412341414123234123414101634123414141232341234141;;e;;w=0;; -# 0110111110 "ambient_light_on" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P0=-9524;;P1=364;;P2=-414;;P3=669;;P4=-755;;P5=-16076;;CP=1;;R=83;;D=0123412341234123412341412341414141412351234123412341234123414123414141414123;;e;;w=0;; -# 0110111100 "ambient_light_off" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P1=371;;P2=-406;;P3=685;;P4=-744;;P6=-16050;;CP=1;;R=88;;D=123412341234123412341412341414141232361234123412341234123414123414141412323;;e;;w=0;; -# 0110111101 "ambient_light_dim_plus" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P0=-10584;;P1=362;;P2=-417;;P3=678;;P4=-765;;P5=-16075;;CP=1;;R=67;;D=0123412341234123412341412341414141234151234123412341234123414123414141412341;;O;;w=0;; -# 0110111011 "ambient_light_dim_minus" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P2=-14541;;P3=-396;;P4=707;;P5=-733;;P6=367;;CP=6;;R=86;;D=62634563456345634563456563456565634565626345634563456345634565634565656345656;;p;;w=0;; -# 0111010110 "ambient_light_cold" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P1=363;;P2=-416;;P3=683;;P4=-755;;P5=-16073;;CP=1;;R=74;;D=123412341234123412341414123412341412351234123412341234123414141234123414123;;p;;w=0;; -# 0111001101 "ambient_light_warm" - i.O. hex_lengh 5 get sduino_dummy raw MU;;P0=381;;P2=-751;;P4=-419;;P5=678;;P6=-16060;;CP=0;;R=78;;D=6045204520452045204520202045452020452060452045204520452045202020454520204520;;p;;w=1;; -# 0110 "fan_minus" - i.O. hex_lengh 3 get sduino_dummy raw MU;;P0=388;;P1=-756;;P2=264;;P3=-399;;P4=683;;P5=-16082;;CP=0;;R=67;;D=0123410341034103410341050341034103410341034103410;;e;;w=0;; -# 0101 "fan_plus" - i.O. hex_lengh 3 get sduino_dummy raw MU;;P1=-16074;;P2=366;;P3=-757;;P6=-422;;P7=680;;CP=2;;R=81;;D=671267326732673267326732326712673267326732673267323267;;e;;w=0;; -# 0110011101 "fan_left" - not assigned for Novy Cloud 230 hex_lengh 5 get sduino_dummy raw MU;;P0=378;;P2=-788;;P3=-434;;P4=649;;P5=-16070;;CP=0;;R=79;;D=02034203420203434202020342050342034203420342034202034342020203420;;p;;w=0;; -# 0110011010 "fan_right" - not assigned for Novy Cloud 230 hex_lengh 5 get sduino_dummy raw MU;;P0=-16705;;P1=361;;P2=-2704;;P3=663;;P4=-778;;P5=-423;;CP=1;;R=68;;D=012341534153415341415353414153415301534153415341534153414153534141534153;;O;;w=0;; +# 0111010011 "power_on_off" - nur 10 Bit, SIGNALduino.pm hängt 2 Nullen an hex_length 5 get sduino_dummy raw MU;;P0=-749;;P1=378;;P2=-456;;P3=684;;P4=-16081;;D=01230101012301232301014123012301230123012301010123012323010141230123012301230123010101230123230101412;;CP=1;;R=66;; +# 0110110110 "cooking_light_on" - i.O. hex_length 5 get sduino_dummy raw MU;;P0=-4768;;P1=380;;P2=-397;;P3=690;;P4=-755;;P5=-16077;;CP=1;;R=39;;D=0123412341234123412341412341412341412351234123412341234123414123414123414123;;O;;w=0;; +# 0110110100 "cooking_light_off" - i.O. hex_length 5 get sduino_dummy raw MU;;P0=382;;P1=200;;P2=-745;;P4=-394;;P5=696;;P6=-16083;;CP=0;;R=81;;D=1204520204520204520454560452045204520452045202045202045204545;;O;;w=0;; +# 0110110101 "cooking_light_dim_plus" - i.O. hex_length 5 get sduino_dummy raw MU;;P0=-753;;P1=387;;P2=-419;;P3=679;;P6=-16050;;CP=1;;R=58;;D=0123012301012301012301230161230123012301230123010123010123012301;;p;;w=0;; +# 0110110011 "cooking_light_dim_minus" - i.O. hex_length 5 get sduino_dummy raw MU;;P1=386;;P2=-394;;P3=694;;P4=-794;;P5=-16064;;CP=1;;R=51;;D=123412341234123412341412341412323414151234123412341234123414123414123234141;;p;;w=0;; +# 0111001110 "cooking_light_cold" - i.O. hex_length 5 get sduino_dummy raw MU;;P0=-92;;P1=371;;P2=-738;;P4=-393;;P5=702;;P6=-16072;;CP=1;;R=69;;D=012145214521212145452121214561452145214521452145212121454521212145;;e;;w=0;; +# 0111001011 "cooking_light_warm" - i.O. hex_length 5 get sduino_dummy raw MU;;P0=-17440;;P1=381;;P2=-415;;P3=668;;P4=-756;;P6=-6786;;CP=1;;R=85;;D=0123412341234123412341414123234123414101634123414141232341234141;;e;;w=0;; +# 0110111110 "ambient_light_on" - i.O. hex_length 5 get sduino_dummy raw MU;;P0=-9524;;P1=364;;P2=-414;;P3=669;;P4=-755;;P5=-16076;;CP=1;;R=83;;D=0123412341234123412341412341414141412351234123412341234123414123414141414123;;e;;w=0;; +# 0110111100 "ambient_light_off" - i.O. hex_length 5 get sduino_dummy raw MU;;P1=371;;P2=-406;;P3=685;;P4=-744;;P6=-16050;;CP=1;;R=88;;D=123412341234123412341412341414141232361234123412341234123414123414141412323;;e;;w=0;; +# 0110111101 "ambient_light_dim_plus" - i.O. hex_length 5 get sduino_dummy raw MU;;P0=-10584;;P1=362;;P2=-417;;P3=678;;P4=-765;;P5=-16075;;CP=1;;R=67;;D=0123412341234123412341412341414141234151234123412341234123414123414141412341;;O;;w=0;; +# 0110111011 "ambient_light_dim_minus" - i.O. hex_length 5 get sduino_dummy raw MU;;P2=-14541;;P3=-396;;P4=707;;P5=-733;;P6=367;;CP=6;;R=86;;D=62634563456345634563456563456565634565626345634563456345634565634565656345656;;p;;w=0;; +# 0111010110 "ambient_light_cold" - i.O. hex_length 5 get sduino_dummy raw MU;;P1=363;;P2=-416;;P3=683;;P4=-755;;P5=-16073;;CP=1;;R=74;;D=123412341234123412341414123412341412351234123412341234123414141234123414123;;p;;w=0;; +# 0111001101 "ambient_light_warm" - i.O. hex_length 5 get sduino_dummy raw MU;;P0=381;;P2=-751;;P4=-419;;P5=678;;P6=-16060;;CP=0;;R=78;;D=6045204520452045204520202045452020452060452045204520452045202020454520204520;;p;;w=1;; +# 0110 "fan_minus" - i.O. hex_length 3 get sduino_dummy raw MU;;P0=388;;P1=-756;;P2=264;;P3=-399;;P4=683;;P5=-16082;;CP=0;;R=67;;D=0123410341034103410341050341034103410341034103410;;e;;w=0;; +# 0101 "fan_plus" - i.O. hex_length 3 get sduino_dummy raw MU;;P1=-16074;;P2=366;;P3=-757;;P6=-422;;P7=680;;CP=2;;R=81;;D=671267326732673267326732326712673267326732673267323267;;e;;w=0;; +# 0110011101 "fan_left" - not assigned for Novy Cloud 230 hex_length 5 get sduino_dummy raw MU;;P0=378;;P2=-788;;P3=-434;;P4=649;;P5=-16070;;CP=0;;R=79;;D=02034203420203434202020342050342034203420342034202034342020203420;;p;;w=0;; +# 0110011010 "fan_right" - not assigned for Novy Cloud 230 hex_length 5 get sduino_dummy raw MU;;P0=-16705;;P1=361;;P2=-2704;;P3=663;;P4=-778;;P5=-423;;CP=1;;R=68;;D=012341534153415341415353414153415301534153415341534153414153534141534153;;O;;w=0;; #} ############################################################################################################################################################################### # - CAME Drehtor Antrieb - remote CAME_TOP_432EV [Protocol 86] and [additionally Protocol 81] @@ -341,13 +341,13 @@ my %models = ( "111101" => "3_fan_high_speed", "101111" => "light_on_off", "111110" => "fan_off", - hex_lengh => "3", + hex_length => [3], Protocol => "P29", Typ => "remote" }, "CAME_TOP_432EV" => { "1110" => "left_button", "1101" => "right_button", - hex_lengh => "3", + hex_length => [3], Protocol => "P86", Typ => "remote" }, @@ -357,12 +357,12 @@ my %models = ( "1000" => "power_on", "1010" => "flickering_slowly", "1100" => "brightness_plus", - hex_lengh => "5", + hex_length => [5], Protocol => "P14", Typ => "remote" }, "HS1_868_BS" => { "0" => "send", - hex_lengh => "11", + hex_length => [11], Protocol => "P69", Typ => "remote" }, @@ -370,14 +370,14 @@ my %models = ( "1011" => "button_2", "1110" => "button_3", "1101" => "button_4", - hex_lengh => "11", + hex_length => [11], Protocol => "P69", Typ => "remote" }, "Krinner_LUMIX" => { "0000" => "off", "0001" => "on", Protocol => "P92", - hex_lengh => "8", + hex_length => [8], Typ => "remote" }, "OR28V" => { "000000" => "volume_mute", @@ -426,7 +426,7 @@ my %models = ( "110111" => "*", "111000" => "#", Protocol => "P68", - hex_lengh => "5", + hex_length => [5], Typ => "remote" }, "Novy_840029" => { "0100" => "novy", @@ -434,7 +434,7 @@ my %models = ( "0110" => "speed_minus", "0111010001" => "light_on_off", # 0111010000 "0111010011" => "power_on_off", # 0111010010 - hex_lengh => "3,5", # 3 or 5, not 3.5 + hex_length => [3,5], # 3 or 5, not 3.5 Protocol => "P86", Typ => "remote" }, @@ -455,7 +455,7 @@ my %models = ( "0101" => "fan_plus", # Novy_840029 same code! "0110011101" => "fan_left", "0110011010" => "fan_right", - hex_lengh => "3,5", # 3 or 5, not 3.5 + hex_length => [3,5], # 3 or 5, not 3.5 Protocol => "P86", Typ => "remote" }, @@ -471,7 +471,7 @@ my %models = ( "00011110" => "Master_off", "00010100" => "Unknown_up", "00000101" => "Unknown_down", - hex_lengh => "5", + hex_length => [5], Protocol => "P34", Typ => "remote" }, @@ -485,7 +485,7 @@ my %models = ( "11010010" => "Ch4_off", # 11011010101010110010010101010100 11010010 "10100101" => "Master_on", # 11011010101010110010010101010100 10100101 "01011010" => "Master_off",# 11011010101010110010010101010100 01011010 - hex_lengh => "10", + hex_length => [10], Protocol => "P26", Typ => "remote" }, @@ -509,7 +509,7 @@ my %models = ( "10100101" => "Ch3_dim_down", # after CH3 on/off "00110110" => "Ch4_dim_up", # after CH4 on/off "00100111" => "Ch4_dim_down", # after CH4 on/off - hex_lengh => "5", + hex_length => [5], Protocol => "P34", Typ => "remote" }, @@ -523,7 +523,7 @@ my %models = ( "111101" => "fan_off", "111110" => "light_on_off", "101101" => "set", - hex_lengh => "3", + hex_length => [3], Protocol => "P83", Typ => "remote" }, @@ -544,12 +544,12 @@ my %models = ( '01111000' => 'fan_4', # is not sent directly '0000' => 'light_off', # is not sent directly '1111' => 'light_on', # is not sent directly - hex_lengh => '4', + hex_length => [4], Protocol => 'P104', Typ => 'remote' }, "SA_434_1_mini" => { "0" => "send", - hex_lengh => "3", + hex_length => [3], Protocol => "P81", Typ => "remote" }, @@ -573,18 +573,18 @@ my %models = ( "00000100" => "Group_9_off", # 0x04 "00010011" => "All_on", # 0x13 "00010100" => "All_off", # 0x14 - hex_lengh => "13", + hex_length => [13], Protocol => "P95", Typ => "remote" }, "Tedsen_SKX1xx" => { "1100" => "Button_1", # tristate 10 - hex_lengh => "5", + hex_length => [5], Protocol => "P46", Typ => "remote" }, "Tedsen_SKX2xx" => { "1000" => "Button_1", # tristate F0 = GEIGER Ab: 0- "1010" => "Button_2", # tristate FF = GEIGER Auf: 00 - hex_lengh => "5", + hex_length => [5], Protocol => "P46", Typ => "remote" }, @@ -592,7 +592,7 @@ my %models = ( "1010" => "Button_2", # tristate FF = GEIGER Auf: 00 "0000" => "Button_3", # tristate 00 = GEIGER Ab: -- "0010" => "Button_4", # tristate 0F = GEIGER Auf: -0 - hex_lengh => "5", + hex_length => [5], Protocol => "P46", Typ => "remote" }, @@ -602,18 +602,18 @@ my %models = ( "0010" => "Button_4", # tristate 0F = GEIGER Auf: -0 "1110" => "Button_5", # tristate 1F = GEIGER Ab: +0 "1011" => "Button_6", # tristate F1 = GEIGER Auf: 0+ - hex_lengh => "5", + hex_length => [5], Protocol => "P46", Typ => "remote" }, "Unitec_47031" => { Protocol => "P30", - hex_lengh => "3", + hex_length => [3], Typ => "switch" }, "LED_XM21_0" => { "1100" => "off", "11111111" => "on", Protocol => "P76", - hex_lengh => "15,16", + hex_length => [15,16], Typ => "remote" }, "SF01_01319004" => { "1100" => "plus", @@ -621,7 +621,7 @@ my %models = ( "1101" => "interval", "1110" => "light_on_off", "1001" => "delay", - hex_lengh => "5", + hex_length => [5], Protocol => "P86", Typ => "remote" }, @@ -630,7 +630,7 @@ my %models = ( "0101" => "interval", "0110" => "light_on_off", "0001" => "delay", - hex_lengh => "5", + hex_length => [5], Protocol => "P86", Typ => "remote" }, @@ -644,19 +644,19 @@ my %models = ( "1100" => "dimdown", "1110" => "dimup", Protocol => "P93", - hex_lengh => "9", + hex_length => [9], Typ => "remote" }, "MD_2003R" => { Protocol => "P91", #P91.1 - hex_lengh => "9", + hex_length => [9], Typ => "gas" }, "MD_210R" => { Protocol => "P91", #P91.1 - hex_lengh => "9", + hex_length => [9], Typ => "switch" }, "MD_2018R" => { Protocol => "P91", #P91.1 - hex_lengh => "9", + hex_length => [9], Typ => "vibration" }, "RC_10" => { "1" => "on", @@ -670,14 +670,14 @@ my %models = ( "100" => "all", }, Protocol => "P90", - hex_lengh => "9", + hex_length => [9], Typ => "remote" }, "RCnoName20" => { "000010001111000" => "plus", "000000101000100" => "minus", "000001010000100" => "off", "000100011011000" => "on", - hex_lengh => "8", + hex_length => [8], Protocol => "P20", Typ => "remote" }, @@ -693,17 +693,17 @@ my %models = ( "1010" => "info", "1011" => "mode", "1100" => "help", - hex_lengh => "10", + hex_length => [10], Protocol => "P97", Typ => "remote" }, "Navaris" => { "0" => "send", - hex_lengh => "6", + hex_length => [6], Protocol => "P99", Typ => "remote" }, "unknown" => { Protocol => "any", - hex_lengh => "", + hex_length => [], Typ => "not_exist" } ); @@ -719,7 +719,7 @@ sub SD_UT_Initialize($) { $hash->{AttrFn} = "SD_UT_Attr"; $hash->{AttrList} = "repeats:1,2,3,4,5,6,7,8,9 IODev do_not_notify:1,0 ". "ignore:0,1 showtime:1,0 model:".join(",", sort keys %models). - " $readingFnAttributes UTclock"; + " $readingFnAttributes UTclock UTfrequency"; $hash->{AutoCreate} = { "MD_2003R.*" => {ATTR => "model:MD_2003R", FILTER => "%NAME", autocreateThreshold => "3:180", GPLOT => ""}, @@ -818,7 +818,6 @@ sub SD_UT_Define($$) { } else { $attr{$name}{model} = $devicetyp if( not defined( $attr{$name}{model} ) ); } - $attr{$name}{room} = "SD_UT" if( not defined( $attr{$name}{room} ) ); AssignIoPort($hash, $iodevice); } @@ -937,7 +936,7 @@ sub SD_UT_Set($$$@) { $msgEnd .= "#R" . $repeats; ############ Manax | mumbi ############ } elsif ($model eq "RC_10") { - return "ERROR: to send, please push button on and off again on remote" if ( (ReadingsVal($name, "x_n5-8_on", "0") eq "0") || (ReadingsVal($name, "x_n5-8_off", "0") eq "0") || (ReadingsVal($name, "x_n4", "0") eq "0") ); + return "ERROR! $name: To send, please push button on and off again on remote." if ( (ReadingsVal($name, "x_n5-8_on", "0") eq "0") || (ReadingsVal($name, "x_n5-8_off", "0") eq "0") || (ReadingsVal($name, "x_n4", "0") eq "0") ); $definition[1] = substr($definition[1],0,4); my $adr = sprintf( "%016b", hex($definition[1])); # argument 1 - adress to binary with 16 digits my $unknown1 = ReadingsVal($name, "x_n4", "0"); @@ -1065,6 +1064,17 @@ sub SD_UT_Set($$$@) { $msg .= '#C' . $UTclock if (defined($UTclock)); # optional Clockpulse + my $f = AttrVal($name,'UTfrequency',undef); + if (defined($f)) { + $f = $f / 26 * 65536; + my $f2 = sprintf("%02x", $f / 65536); + my $f1 = sprintf("%02x", int($f % 65536) / 256); + my $f0 = sprintf("%02x", $f % 256); + my $arg = sprintf("%.3f", (hex($f2)*65536+hex($f1)*256+hex($f0))/65536*26); + Log3 $hash, 3, "$ioname: SD_UT_Set setting UTfrequency (0D,0E,0F) to $f2 $f1 $f0 = $arg MHz"; + $msg .="#F$f2$f1$f0"; + } + readingsSingleUpdate($hash, "LastAction", "send", 0) if ($models{$model}{Typ} eq "remote"); readingsSingleUpdate($hash, "state" , $cmd, 1); @@ -1714,169 +1724,166 @@ sub SD_UT_Attr(@) { my $state; my $oldmodel = AttrVal($name, "model", "unknown"); my $bitData; - my $hex_lengh = length(InternalVal($name, "lastMSG", "0")); - - if ($cmd eq "set" && $attrName eq 'repeats' && $attrValue !~ m/^[1-9]$/i) { - return "$name: Unallowed value $attrValue for the attribute repetition (must be 1 - 9)!"; - } - - ############ chance device models ############ - if ($cmd eq "set" && $attrName eq "model" && $attrValue ne $oldmodel) { - - if (InternalVal($name, "bitMSG", "no data") ne "no data") { - my $devicemodel; + my $hex_length = length(InternalVal($name, "lastMSG", "0")); - ### ERROR for Users - my $allowed_models; - foreach my $keys (keys %models) { # read allowed_models with the same hex_lengh - $allowed_models.= $keys.", " if ($models{$keys}{hex_lengh} eq $hex_lengh); - } + if ($cmd eq 'set') { + if ($attrName eq 'repeats' && $attrValue !~ m/^[1-9]$/xms) { + return "$name: Unallowed value $attrValue for the attribute repetition (must be 1 - 9)!"; + } + if ($attrName eq 'UTfrequency' && ($attrValue !~ m/^[1-9]{1}[0-9]{0,2}\.?[0-9]*$/xms || $attrValue >= 1000.0)) { + return "$name: Invalid value $attrValue for the UTfrequency attribute. Values ​​such as: 433.92 are permitted."; + } - Log3 $name, 4, "SD_UT_Attr Check for the change, $oldmodel hex_lengh=$hex_lengh, attrValue=$attrValue needed hex_lengh=".$models{$attrValue}{hex_lengh}; - return "ERROR! You want to choose the $oldmodel model to $attrValue.\nPlease check your selection.\nThe length of RAWMSG must be the same!\n\nAllowed models are: $allowed_models" if ($models{$attrValue}{hex_lengh} !~ /$hex_lengh/ && $oldmodel ne "unknown"); # variants one - return "ERROR! You want to choose the unknown model to $attrValue.\nPlease check your selection.\nRAWMSG length is wrong!\n\nAllowed models are: $allowed_models" if (not ($models{$attrValue}{hex_lengh} =~ /($hex_lengh)/ ) && $oldmodel eq "unknown"); # variants two/three - ### #### #### ### + ############ change device models ############ + if ($attrName eq 'model' && $attrValue ne $oldmodel) { + if (InternalVal($name, "bitMSG", "no data") ne "no data") { + my $devicemodel; + + ### ERROR for users when change attribute model (search allowed models with the same hex_length) + my @all_models = keys %models; + my @allowed_model_list; + for my $i (0 .. @all_models - 1) { + if ( grep {$_ == $hex_length } @{$models{$all_models[$i]}{hex_length}} ) { + push @allowed_model_list, $all_models[$i]; + } + } + my $allowed_models = join(', ' , sort @allowed_model_list); # convert to sorted string for output + Log3 $name, 4, "SD_UT_Attr Check for the change, $oldmodel hex_length=$hex_length, attrValue=$attrValue needed hex_length=@{$models{$attrValue}{hex_length}}"; + return "ERROR! $name: You want to choose the $oldmodel model to $attrValue.\nPlease check your selection.\nThe length of DMSG must be the same!\n\nAllowed models are:\n$allowed_models" if ( not grep {$_ eq $attrValue} @allowed_model_list ); - if ($attrName eq "model" && $attrValue eq "unknown") { - readingsSingleUpdate($hash, "state", " Please define your model with attributes! ", 0); - } + if ($attrValue eq "unknown") { + readingsSingleUpdate($hash, "state", " Please define your model with attributes! ", 0); + } - foreach my $keys (sort keys %models) { - if($keys eq $attrValue) { + if ( exists $models{$attrValue} ) { $attr{$name}{model} = $attrValue; # set new model $bitData = InternalVal($name, "bitMSG", "-"); - $devicemodel = $keys; + $devicemodel = $attrValue; $state = "Defined"; - last; } - } - ############ Westinghouse_Delancey RH787T ############ - if ($attrName eq "model" && $attrValue eq "RH787T") { - $deviceCode = substr($bitData,1,4); - $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Westinghouse TR60C-1 ############ - } elsif ($attrName eq 'model' && $attrValue eq 'TR60C1') { - $deviceCode = substr($bitData,0,4); - $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Westinghouse Buttons_five ############ - } elsif ($attrName eq "model" && $attrValue eq "Buttons_five") { - $deviceCode = substr($bitData,8,4); - $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ SA_434_1_mini ############ - } elsif ($attrName eq "model" && $attrValue eq "SA_434_1_mini") { - $deviceCode = sprintf("%03X", oct( "0b$bitData" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx ############ - } elsif ($attrName eq "model" && ($attrValue eq "Tedsen_SKX1xx" || $attrValue eq "Tedsen_SKX2xx" || $attrValue eq "Tedsen_SKX4xx" || $attrValue eq "Tedsen_SKX6xx")) { - $deviceCode = SD_UT_bin2tristate(substr($bitData,0,14)); # only 14 bit from bitdata to tristate - $devicename = $devicemodel."_".$deviceCode; - ############ Unitec_47031 ############ - } elsif ($attrName eq "model" && $attrValue eq "Unitec_47031") { - $deviceCode = substr($bitData,0,8); # unklar derzeit! 10Dil auf Bild - $deviceCode = sprintf("%02X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ QUIGG_DMV ############ - } elsif ($attrName eq "model" && $attrValue eq "QUIGG_DMV") { - $deviceCode = substr($bitData,0,12); - $deviceCode = sprintf("%03X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ TR_502MSV ############ - } elsif ($attrName eq "model" && $attrValue eq "TR_502MSV") { - $deviceCode = substr($bitData,0,12); - $deviceCode = sprintf("%03X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Novy_840029 || Novy_840039 ############ - } elsif ($attrName eq "model" && ($attrValue eq "Novy_840029" || $attrValue eq "Novy_840039") ) { - $deviceCode = substr($bitData,0,8); - $deviceCode = sprintf("%02X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ CAME_TOP_432EV ############ - } elsif ($attrName eq "model" && $attrValue eq "CAME_TOP_432EV") { - $deviceCode = substr($bitData,0,8); - $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ NEFF SF01_01319004 || BOSCH SF01_01319004_Typ2 || Refsta Topdraft (Tecnowind) ############ - } elsif ($attrName eq "model" && ($attrValue eq "SF01_01319004" || $attrValue eq "SF01_01319004_Typ2")) { - $deviceCode = substr($bitData,0,14) . "00"; - $deviceCode = sprintf("%04X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Hoermann HS1-868-BS ############ - } elsif ($attrName eq "model" && $attrValue eq "HS1_868_BS") { - $deviceCode = sprintf("%09X", oct( "0b$bitData" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Hoermann HSM4 ############ - } elsif ($attrName eq "model" && $attrValue eq "HSM4") { - $deviceCode = substr($bitData,8,28); - $deviceCode = sprintf("%07X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Chilitec_22640 ############ - } elsif ($attrName eq "model" && $attrValue eq "Chilitec_22640") { - $deviceCode = substr($bitData,0,16); - $deviceCode = sprintf("%04X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ LED_XM21_0 ############ - } elsif ($attrName eq "model" && $attrValue eq "LED_XM21_0") { - $deviceCode = substr($bitData,0,56); - $deviceCode = sprintf("%14X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Krinner_LUMIX ############ - } elsif ($attrName eq "model" && $attrValue eq "Krinner_LUMIX") { - $deviceCode = substr($bitData,0,28); - $deviceCode = sprintf("%07X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Manax | mumbi ############ - } elsif ($attrName eq "model" && $attrValue eq "RC_10") { - $deviceCode = substr($bitData,0,16); - $deviceCode = sprintf("%04X", oct( "0b$deviceCode" ) ); - - my $button = substr($bitData,20,3); - foreach my $keys (sort keys %{$models{RC_10}{buttons}}) { - if ($keys eq $button) { - $deviceCode = $deviceCode."_".$models{RC_10}{buttons}{$keys}; - last; + ############ Westinghouse_Delancey RH787T ############ + if ($attrValue eq "RH787T") { + $deviceCode = substr($bitData,1,4); + $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Westinghouse TR60C-1 ############ + } elsif ($attrValue eq 'TR60C1') { + $deviceCode = substr($bitData,0,4); + $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Westinghouse Buttons_five ############ + } elsif ($attrValue eq "Buttons_five") { + $deviceCode = substr($bitData,8,4); + $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ SA_434_1_mini ############ + } elsif ($attrValue eq "SA_434_1_mini") { + $deviceCode = sprintf("%03X", oct( "0b$bitData" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx ############ + } elsif ($attrValue eq "Tedsen_SKX1xx" || $attrValue eq "Tedsen_SKX2xx" || $attrValue eq "Tedsen_SKX4xx" || $attrValue eq "Tedsen_SKX6xx") { + $deviceCode = SD_UT_bin2tristate(substr($bitData,0,14)); # only 14 bit from bitdata to tristate + $devicename = $devicemodel."_".$deviceCode; + ############ Unitec_47031 ############ + } elsif ($attrValue eq "Unitec_47031") { + $deviceCode = substr($bitData,0,8); # unklar derzeit! 10Dil auf Bild + $deviceCode = sprintf("%02X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ QUIGG_DMV ############ + } elsif ($attrValue eq "QUIGG_DMV") { + $deviceCode = substr($bitData,0,12); + $deviceCode = sprintf("%03X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ TR_502MSV ############ + } elsif ($attrValue eq "TR_502MSV") { + $deviceCode = substr($bitData,0,12); + $deviceCode = sprintf("%03X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Novy_840029 || Novy_840039 ############ + } elsif ($attrValue eq "Novy_840029" || $attrValue eq "Novy_840039") { + $deviceCode = substr($bitData,0,8); + $deviceCode = sprintf("%02X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ CAME_TOP_432EV ############ + } elsif ($attrValue eq "CAME_TOP_432EV") { + $deviceCode = substr($bitData,0,8); + $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ NEFF SF01_01319004 || BOSCH SF01_01319004_Typ2 || Refsta Topdraft (Tecnowind) ############ + } elsif ($attrValue eq "SF01_01319004" || $attrValue eq "SF01_01319004_Typ2") { + $deviceCode = substr($bitData,0,14) . "00"; + $deviceCode = sprintf("%04X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Hoermann HS1-868-BS ############ + } elsif ($attrValue eq "HS1_868_BS") { + $deviceCode = sprintf("%09X", oct( "0b$bitData" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Hoermann HSM4 ############ + } elsif ($attrValue eq "HSM4") { + $deviceCode = substr($bitData,8,28); + $deviceCode = sprintf("%07X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Chilitec_22640 ############ + } elsif ($attrValue eq "Chilitec_22640") { + $deviceCode = substr($bitData,0,16); + $deviceCode = sprintf("%04X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ LED_XM21_0 ############ + } elsif ($attrValue eq "LED_XM21_0") { + $deviceCode = substr($bitData,0,56); + $deviceCode = sprintf("%14X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Krinner_LUMIX ############ + } elsif ($attrValue eq "Krinner_LUMIX") { + $deviceCode = substr($bitData,0,28); + $deviceCode = sprintf("%07X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Manax | mumbi ############ + } elsif ($attrValue eq "RC_10") { + $deviceCode = substr($bitData,0,16); + $deviceCode = sprintf("%04X", oct( "0b$deviceCode" ) ); + my $button = substr($bitData,20,3); + if ( exists $models{RC_10}{buttons}{$button} ) { + $deviceCode = $deviceCode."_".$models{RC_10}{buttons}{$button}; } + $devicename = $devicemodel."_".$deviceCode; + ############ ESTO KL_RF01 ############ + } elsif ($attrValue eq "KL_RF01") { + $deviceCode = substr($bitData,0,16); + $deviceCode = sprintf("%04X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Techmar Garden Lights ############ + } elsif ($attrValue eq "Techmar") { + $deviceCode = substr($bitData,0,32); + $deviceCode = sprintf("%08X", oct( "0b$deviceCode" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ Navaris ############ + } elsif ($attrValue eq "Navaris") { + $deviceCode = sprintf("%06X", oct( "0b$bitData" ) ); + $devicename = $devicemodel."_".$deviceCode; + ############ unknown ############ + } else { + $devicename = "unknown_please_select_model"; + Log3 $name, 3, "SD_UT_Attr UNDEFINED sensor $attrValue (model=unknown)"; } - - $devicename = $devicemodel."_".$deviceCode; - ############ ESTO KL_RF01 ############ - } elsif ($attrName eq "model" && $attrValue eq "KL_RF01") { - $deviceCode = substr($bitData,0,16); - $deviceCode = sprintf("%04X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Techmar Garden Lights ############ - } elsif ($attrName eq "model" && $attrValue eq "Techmar") { - $deviceCode = substr($bitData,0,32); - $deviceCode = sprintf("%08X", oct( "0b$deviceCode" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ Navaris ############ - } elsif ($attrName eq "model" && $attrValue eq "Navaris") { - $deviceCode = sprintf("%06X", oct( "0b$bitData" ) ); - $devicename = $devicemodel."_".$deviceCode; - ############ unknown ############ - } else { - $devicename = "unknown_please_select_model"; - Log3 $name, 3, "SD_UT_Attr UNDEFINED sensor $attrValue (model=unknown)"; - } - Log3 $name, 3, "SD_UT_Attr UNDEFINED sensor $attrValue detected, code $deviceCode (DoTrigger)" if ($devicemodel ne "unknown"); + Log3 $name, 3, "SD_UT_Attr UNDEFINED sensor $attrValue detected, code $deviceCode (DoTrigger)" if ($devicemodel ne "unknown"); - $modules{SD_UT}{defptr}{deletecache} = $name; # delete old device - Log3 $name, 5, "SD_UT: Attr cmd=$cmd devicename=$name attrName=$attrName attrValue=$attrValue oldmodel=$oldmodel"; + $modules{SD_UT}{defptr}{deletecache} = $name; # delete old device + Log3 $name, 5, "SD_UT: Attr cmd=$cmd devicename=$name attrName=$attrName attrValue=$attrValue oldmodel=$oldmodel"; - readingsSingleUpdate($hash, "state", $state, 0); + readingsSingleUpdate($hash, "state", $state, 0); - DoTrigger ("global","UNDEFINED unknown_please_select_model SD_UT unknown") if ($devicename eq "unknown_please_select_model"); # if user push attr return to unknown - DoTrigger ("global","UNDEFINED $devicename SD_UT $devicemodel $deviceCode") if ($devicename ne "unknown_please_select_model"); # create new device + DoTrigger ("global","UNDEFINED unknown_please_select_model SD_UT unknown") if ($devicename eq "unknown_please_select_model"); # if user push attr return to unknown + DoTrigger ("global","UNDEFINED $devicename SD_UT $devicemodel $deviceCode") if ($devicename ne "unknown_please_select_model"); # create new device - $attr{$devicename}{model} = "$attrValue"; # set model + $attr{$devicename}{model} = "$attrValue"; # set model - } else { - readingsSingleUpdate($hash, "state", "Please press button again!", 0); - return "Please press button again or receive more messages!\nOnly with another message can the model be defined.\nWe need bitMSG from message."; + } else { + readingsSingleUpdate($hash, "state", "Please press button again!", 0); + return "Please press button again or receive more messages!\nOnly with another message can the model be defined.\nWe need bitMSG from message."; + } } } @@ -1935,613 +1942,424 @@ sub SD_UT_tristate2bin($) {

      SD_UT

      -
        The module SD_UT is a universal module of SIGNALduino for devices or sensors.
        +
          + The module SD_UT is a universal module of SIGNALduino for devices or sensors.
          After the first creation of the device unknown_please_select_model, the user must define the device himself via the model attribute.
          - If the device is not supported yet, bit data can be collected with the unknown_please_select_model device.

          + If the device is not supported yet, bit data can be collected with the unknown_please_select_model device. +

          Note: As soon as the attribute model of a defined device is changed or deleted, the module re-creates a device of the selected type, and when a new message is run, the current device is deleted. - Devices of the same or different type with the same deviceCode will result in errors. PLEASE use different deviceCode.

          - The following devices are supported:
          -
            - Atlantic Security sensors   (module model: MD-2003R, MD-2018R,MD-210R | Protokoll 91|91.1)
            -    note: the model MD_230R (water) is recognized as MD-2018R due to the same hardware ID!
          -
            - BOSCH ceiling fan   (module model: SF01_01319004_Typ2 | protocol 86)
          -
            - CAME swing gate drive   (module model: CAME_TOP_432EV | protocol 86)
          -
            - ChiliTec LED X-Mas light   (module model: Chilitec_22640 | protocol 14)
          -
            - ESTO ceiling lamp   (model: KL_RF01 | protocol 93)
          -
            - Hoermann HS1-868-BS   (module model: HS1_868_BS | protocol 69)
          -
            - Hoermann HSM4   (module model: HSM4 | protocol 69)
          -
            - Krinner LUMIX X-Mas light string   (module model: Krinner_LUMIX | protocol 92)
          -
            - LED_XM21_0 X-Mas light string   (module model: LED_XM21_0 | protocol 76)
          -
            - TR-502MSV (LIDL, LIBRA, MANDOLYN, QUIGG), compatible GT-7008BS, GT-FSI-04, DMV-7008S, Powerfix RCB-I 3600   (module model: TR_502MSV | protocol 34)
          -
            - Manax RCS250   (module model: RC_10 | protocol 90)
          -
            - Medion OR28V   (module model: OR28V | protocol 68)
          -
            - mumbi AFS300-s (remote control RC-10 | random code wireless switch RCS-22GS)   (module model: RC_10 | protocol 90)
          -
            - Momento (remote control for wireless digital picture frame)   (module model: Momento | protocol 97)
          -
            - NAVARIS touch light switch Model No.: 44344.04   (module model: Navaris | protocol 99)
          -
            - NEFF or Refsta Topdraft (Tecnowind) kitchen hood   (module model: SF01_01319004 | protocol 86)
          -
            - Novy Cloud 230 kitchen hood   (module model: Novy_840039 | protocol 86)
          -
            - Novy Pureline 6830 kitchen hood   (module model: Novy_840029 | protocol 86)
          -
            - QUIGG DMV-7000   (module model: QUIGG_DMV | protocol 34)
          -
            - Remote control SA-434-1 mini 923301   (module model: SA_434_1_mini | protocol 81)
          -
            - Remote control for Techmar Garden Lights    (Modulmodel: Techmar | Protokoll 95)
          -
            - Remote control with 4 buttons for diesel heating    (Modulmodel: RCnoName20 | Protokoll 20)
          -
            - Tedsen Teletaster (protocol 46): - -
              SKX1xx, 1 button - module model: Tedsen_SKX1xx
            -
              SKX2xx, 2 button (GEIGER_GF0x01) - module model: Tedsen_SKX2xx
            -
              SKX4xx, 4 button (GEIGER_GF0x02) - module model: Tedsen_SKX4xx
            -
              SKX6xx, 6 button (GEIGER_GF0x03) - module model: Tedsen_SKX6xx
            -
            -
          -
            - unitec remote door reed switch 47031 (Unitec 47121 | Unitec 47125 | Friedland)   (module model: Unitec_47031 | protocol 30)
          -
            - Westinghouse Delancey ceiling fan (remote, 5 buttons without SET)   (module model: Buttons_five | protocol 29)
          -
            - Westinghouse Delancey ceiling fan (remote, 9 buttons with SET)   (module model: RH787T | protocol 83)
          -
            - Westinghouse ceiling fan Bendan (remote control TR60C-1, touch screen)   (module model: TR60C1 | protocol 104)
          -
            - xavax 00111939 (remote control, 10 buttons)   (Modulmodel: xavax | protocol 26)
          -

          + Devices of the same or different type with the same deviceCode will result in errors. PLEASE use different deviceCode. +

          + + The following devices are supported:
          +
            +
          • Atlantic Security sensors   (module model: MD-2003R, MD-2018R,MD-210R, protocol 91|91.1)
            +    Note: The model MD_230R (water) is recognized as MD-2018R due to the same hardware ID!
          • +
          • BOSCH ceiling fan   (module model: SF01_01319004_Typ2, protocol 86)
          • +
          • CAME swing gate drive   (module model: CAME_TOP_432EV, protocol 86)
          • +
          • ChiliTec LED X-Mas light   (module model: Chilitec_22640, protocol 14)
          • +
          • ESTO ceiling lamp   (module model: KL_RF01, protocol 93)
          • +
          • Remote control with 4 buttons for diesel heating   (module model: RCnoName20, protocol 20)
          • +
          • Hoermann HS1-868-BS   (module model: HS1_868_BS, protocol 69)
          • +
          • Hoermann HSM4   (module model: HSM4, protocol 69)
          • +
          • Krinner LUMIX X-Mas light string   (module model: Krinner_LUMIX, Protokol 92)
          • +
          • LED_XM21_0 X-Mas light string   (module model: LED_XM21_0, Protokol 76)
          • +
          • TR-502MSV (LIDL, LIBRA, MANDOLYN, QUIGG), compatible GT-7008BS, GT-FSI-04, DMV-7008S, Powerfix RCB-I 3600   (module model: TR_502MSV, protocol 34)
          • +
          • Manax RCS250   (module model: RC_10, protocol 90)
          • +
          • Medion OR28V   (module model: OR28V, protocol 68)
          • +
          • mumbi AFS300-s (remote control RC-10, wireless socket RCS-22GS)   (module model: RC_10, protocol 90)
          • +
          • Momento (remote control for wireless digital picture frame)   (module model: Momento, protocol 97)
          • +
          • NAVARIS touch light switch Model No.: 44344.04   (module model: Navaris, protocol 99)
          • +
          • NEFF or Refsta Topdraft (Tecnowind) kitchen hood   (module model: SF01_01319004, protocol 86)
          • +
          • Novy Cloud 230 kitchen hood   (module model: Novy_840039, protocol 86)
          • +
          • Novy Pureline 6830 kitchen hood   (module model: Novy_840029, protocol 86)
          • +
          • QUIGG DMV-7000   (module model: QUIGG_DMV, protocol 34)
          • +
          • SA-434-1 mini 923301   (module model: SA_434_1_mini, protocol 81)
          • +
          • Techmar Garden Lights    (module model: Techmar, protocol 95)
          • +
          • Tedsen Teletaster (protocol 46): +
              +
            • SKX1xx, 1 button - module model: Tedsen_SKX1xx
            • +
            • SKX2xx, 2 button (GEIGER_GF0x01) - module model: Tedsen_SKX2xx
            • +
            • SKX4xx, 4 button (GEIGER_GF0x02) - module model: Tedsen_SKX4xx
            • +
            • SKX6xx, 6 button (GEIGER_GF0x03) - module model: Tedsen_SKX6xx
            • +
          • +
          • unitec magnetic contact 47031 (for alarm systems Unitec 47121, Unitec 47125, Friedland)   (module model: Unitec_47031, protocol 30)
          • +
          • Westinghouse ceiling fan (remote control, 5 buttons without SET)   (module model: Buttons_five, protocol 29)
          • +
          • Westinghouse Delancey ceiling fan (remote control, 9 buttons with SET)   (module model: RH787T, protocol 83)
          • +
          • Westinghouse ceiling fan Bendan (remote control TR60C-1, touch screen)   (module model: TR60C1, protocol 104)
          • +
          • xavax 00111939 (remote control, 10 button)   (module model: xavax, protocol 26)
          • +
          +

          + Define
          -
            define <NAME> SD_UT <model> <Hex-address>

            - examples: +
              + define <NAME> SD_UT <model> <Hex-address>

              + examples:
                - define <NAME> SD_UT RH787T A
                - define <NAME> SD_UT SA_434_1_mini ffd
                - define <NAME> SD_UT unknown
                -


            - Set
            -
              Different transmission commands are available.

            -
              BOSCH (SF01_01319004_Typ2) | NEFF / Refsta Topdraft (SF01_01319004)
            -
              -
            • delay
              - button one on the remote
            • -
            -
              -
            • interval
              - button two on the remote
            • -
            -
              -
            • light_on_off
              - button three on the remote
            • -
            -
              -
            • minus
              - button four on the remote
            • -
            -
              -
            • plus
              - button five on the remote
            • -

            - -
              ChiliTec LED X-Mas light
            -
              -
            • power_on
              - button ON on the remote
            • -
            -
              -
            • power_off
              - button OFF on the remote
            • -
            -
              -
            • flickering_slowly
              - button SL on the remote
            • -
            -
              -
            • flickering_fast
              - button SF on the remote
            • -
            -
              -
            • brightness_minus
              - button - on the remote
            • -
            -
              -
            • brightness_plus
              - button + on the remote
            • -

            - -
              ESTO KL_RF01
            -
              -
            • on
              - button ON on the remote
            • -
            -
              -
            • off
              - button OFF on the remote
            • -
            -
              -
            • alternating_full_luminosity
              - button alternating_full_luminosity on the remote
            • -
            -
              -
            • full_brightness
              - button full_brightness on the remote
            • -
            -
              -
            • light_color_warm_white
              - button light_color_warm_white on the remote
            • + define <NAME> SD_UT RH787T A
              + define <NAME> SD_UT SA_434_1_mini ffd
              + define <NAME> SD_UT unknown
              +
          -
            -
          • light_color_cold_white
            - button light_color_cold_white on the remote
          • -
          -
            -
          • dimup
            - button DIMUP on the remote
          • -
          -
            -
          • dimdown
            - button DIMDOWN on the remote
          • -
          -
            -
          • night_mode
            - button moon on the remote
          • -

          - -
            LED_XM21_0 light string
          -
            -
          • on
            - button I on the remote
          • -
          -
            -
          • off
            - button O on the remote
          • -

          +

          -
            Remote control SA-434-1 mini 923301  |  Hoermann HS1-868-BS  |  Tedsen_SKX1/2/4/6xx
          + Set
            -
          • send
            - button (Always send the same, even if the user sends another set command via console.)
          • -

          - -
            Hoermann HSM4 (remote with 4 buttons)
          -
            -
          • button_1
            - Button one on the remote
          • -
          -
            -
          • button_2
            - Button two on the remote
          • -
          -
            -
          • button_3
            - Button three on the remote
          • -
          -
            -
          • button_4
            - Button four on the remote
          • -

          - -
            Techmar Garden Lights (remote control with 10 buttons)
          -
          • Group_1 ... Group_9
            - Group 1 to 9, on / off
          • -
          -
          • All_on / All_off
            - All Groups on / off
          • -

          - -
            Westinghouse ceiling fan (remote with 5 buttons and without SET)
          -
            -
          • 1_fan_low_speed
            - Button LOW on the remote
          • -
          -
            -
          • 2_fan_medium_speed
            - Button MED on the remote
          • -
          -
            -
          • 3_fan_high_speed
            - Button HI on the remote
          • -
          -
            -
          • light_on_off
            - switch light on or off
          • -
          -
            -
          • fan_off
            - turns off the fan
          • -

          - -
            Westinghouse Delancey ceiling fan (remote RH787T with 9 buttons and SET)
          -
            -
          • 1_fan_minimum_speed
            - Button I on the remote
          • -
          -
            -
          • 2_fan_low_speed
            - Button II on the remote
          • -
          -
            -
          • 3_fan_medium_low_speed
            - Button III on the remote
          • -
          -
            -
          • 4_fan_medium_speed
            - Button IV on the remote
          • -
          -
            -
          • 5_fan_medium_high_speed
            - Button V on the remote
          • -
          -
            -
          • 6_fan_high_speed
            - Button VI on the remote
          • -
          -
            -
          • fan_off
            - turns off the fan
          • -
          -
            -
          • fan_direction
            - Defining the direction of rotation
          • -
          -
            -
          • light_on_off
            - switch light on or off
          • -
          -
            -
          • set
            - Button SET in the remote
          • + Different transmission commands are available. +

            + + BOSCH (SF01_01319004_Typ2), NEFF / Refsta Topdraft (SF01_01319004) +
              +
            • delay: button 1 on the remote
            • +
            • interval: button 2 on the remote
            • +
            • light_on_off: button 3 on the remote
            • +
            • minus: button 4 on the remote
            • +
            • plus: button 5 on the remote
            • +

            + + ChiliTec LED X-Mas light +
              +
            • power_on: button ON on the remote
            • +
            • power_off: button OFF on the remote
            • +
            • flickering_slowly: button SL on the remote
            • +
            • flickering_fast: button SF on the remote
            • +
            • brightness_minus: button - on the remote
            • +
            • brightness_plus: button + on the remote
            • +

            + + ESTO KL_RF01 +
              +
            • on: button ON on the remote
            • +
            • off: button OFF on the remote
            • +
            • alternating_full_luminosity: button alternating_full_luminosity on the remote
            • +
            • full_brightness: button full_brightness on the remote
            • +
            • light_color_warm_white: button light_color_warm_white on the remote
            • +
            • light_color_cold_white: button light_color_cold_white on the remote
            • +
            • dimup: button DIMUP on the remote
            • +
            • dimdown: button DIMDOWN on the remote
            • +
            • night_mode: button moon on the remote
            • +

            + + LED_XM21_0 light string +
              +
            • on: button I on the remote
            • +
            • off: button O on the remote
            • +

            + + Remote control SA-434-1 mini 923301, Hoermann HS1-868-BS, Tedsen_SKX1xx +
              +
            • send: button (Always send the same, even if the user sends another set command via console.)
            • +

            + + Hoermann HSM4 (Remote control with 4 button) +
              +
            • button_1: button 1 on the remote
            • +
            • button_2: button 2 on the remote
            • +
            • button_3: button 3 on the remote
            • +
            • button_4: button 4 on the remote
            • +

            + + Techmar Garden Lights (Remote control with 10 button) +
              +
            • Group_1 ... Group_9: Group 1 to 9, on / off
            • +
            • All_on / All_off: All Groups on / off
            • +

            + + Westinghouse ceiling fan (Remote control with 5 button) +
              +
            • 1_fan_low_speed: button LOW on the remote
            • +
            • 2_fan_medium_speed: button MED on the remote
            • +
            • 3_fan_high_speed: button HI on the remote
            • +
            • light_on_off: switch light on or off
            • +
            • fan_off: turns off the fan
            • +

            + + Westinghouse Delancey ceiling fan (Remote control RH787T with 9 button + SET) +
              +
            • 1_fan_minimum_speed: button I on the remote
            • +
            • 2_fan_low_speed: button II on the remote
            • +
            • 3_fan_medium_low_speed: button III on the remote
            • +
            • 4_fan_medium_speed: button IV on the remote
            • +
            • 5_fan_medium_high_speed: button V on the remote
            • +
            • 6_fan_high_speed: button VI on the remote
            • +
            • fan_off: turns off the fan
            • +
            • fan_direction: defining the direction of rotation
            • +
            • light_on_off: switch light on or off
            • +
            • set: button SET on the remote
            • +


          Get
          -
            N/A


          +
            N/A
          +

          - Attribute
          -
          -
          -
          -
            -
          • model
            - The attribute indicates the model type of your device.
            - (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, TR60C1, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)
          • -

          -
          • repeats
            - This attribute can be used to adjust how many repetitions are sent. Default is 5.

          -
          • UTclock
            - This attribute set the clock pulse when sending. There is no standard value.
            - exception: The model Novy_840039 has a preset clock pulse of 375. You can manually adjust this individually with the attribute.

          - - Generated readings of the models
          -
            Buttons_five | CAME_TOP_432EV | Chilitec_22640 | HSM4 | KL_RF01 | LED_XM21_0 | Momento | Novy_840029 | Novy_840039 | OR28V | QUIGG_DMV | RC_10 | RH787T | SF01_01319004 | SF01_01319004_Typ2 | TR_502MSV
            -
          • deviceCode
            - Device code of the system
          • -
          • LastAction
            - Last executed action of the device. receive for command received | send for command send
          • -
          • state
            - Last executed keystroke of the remote control

          - -
            MD_2003R (gas)  |  MD_2018R (vibration)  |  MD_210R (door/windows switch)  |  MD_230R (water)
            -
          • contact
            - Status of the internal alarm contact
          • -
          • deviceTyp
            - Model type of your sensor
          • -
          • sabotage
            - State of sabotage contact
          • -
          • state
            - State of the device

          - -
            HS1-868-BS  |  SA_434_1_mini  |  Tedsen_SKX1xx  |  Tedsen_SKX2xx  |  Tedsen_SKX4xx  |  Tedsen_SKX6xx
            -
          • LastAction
            - Last executed action of FHEM. send for command send.
          • -
          • state
            - Last executed action of the device. receive for command received | send for command send

          - -
            Unitec_47031
            -
          • System-Housecode
            - System or house code of the device
          • -
          • state
            - Condition of contact (prepared, unconfirmed)
          • -
          • Zone
            - Zone of the device
          • -
          • Usersystem
            - Group of the system
          • -

          + Attributes
          +
            +
          • do_not_notify
          • +
          • ignore
          • +
          • IODev
          • +
          • model
            + The attribute indicates the model type of your device (Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, TR60C1, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031, unknown). + If the attribute is changed, a new device is created using autocreate. Autocreate must be activated for this. +
          • +
          • repeats
            + This attribute can be used to adjust how many repetitions are sent. Default is 5. +
          • +
          • UTclock
            + This attribute set the base clock when sending. There is no standard value.
            + Exception: The model Novy_840039 has a preset base clock of 375. You can manually adjust this individually with this attribute. +
          • +
          • UTfrequency
            + An individual transmission frequency can be set with this attribute. If this attribute is not set, the transmission frequency of the IO device (e.g. Signalduino) is used. +
          • +
          +

          + + Generated readings of the models
          +
            + Buttons_five, CAME_TOP_432EV, Chilitec_22640, HSM4, KL_RF01, LED_XM21_0, Momento, Novy_840029, Novy_840039, OR28V, QUIGG_DMV, RC_10, RH787T, SF01_01319004, SF01_01319004_Typ2, TR_502MSV +
              +
            • deviceCode: Device code of the system
            • +
            • LastAction: Last executed action of the device (receive for command received | send for command send).
            • +
            • state: Current state of the device
            • +

            + MD_2003R (gas), MD_2018R (vibration), MD_210R (door/window switch), MD_230R (water) +
              +
            • contact: State of the internal alarm contact.
            • +
            • deviceTyp: Model type of the sensor.
            • +
            • sabotage: State of sabotage contact.
            • +
            • state: Current state of the device
            • +

            + + HS1-868-BS, SA_434_1_mini, Tedsen_SKX1, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx +
              +
            • LastAction: Last executed action of the device (receive for command received | send for command send).
            • +
            • state: Current state of the device
            • +

            + + Unitec_47031 +
              +
            • System-Housecode: System or house code of the device
            • +
            • state: Condition of contact (prepared, unconfirmed)
            • +
            • Zone: Zone of the device
            • +
            • Usersystem: Group of the system
            • +
            +
        + =end html =begin html_DE

        SD_UT

        -
          Das Modul SD_UT ist ein Universalmodul vom SIGNALduino für Geräte oder Sensoren.
          +
            + Das Modul SD_UT ist ein Universalmodul vom SIGNALduino für Geräte oder Sensoren.
            Nach dem ersten Anlegen des Gerätes unknown_please_select_model muss der User das Gerät selbst definieren mittels des Attributes model.
            - Bei noch nicht unterstützen Geräten können mit dem unknown_please_select_model Gerät Bitdaten gesammelt werden.

            - Hinweis: Sobald das Attribut model eines definieren Gerätes verstellt oder gelöscht wird, so legt das Modul ein Gerät des gewählten Typs neu an und mit Durchlauf einer neuen Nachricht wird das aktuelle Gerät gelöscht. - Das Betreiben von Geräten des gleichen oder unterschiedliches Typs mit gleichem deviceCode führt zu Fehlern. BITTE achte stets auf einen unterschiedlichen deviceCode.

            - Es werden bisher folgende Geräte unterstützt:
            -
              - Atlantic Security Sensoren   (Modulmodel: MD-2003R, MD-2018R,MD-210R | Protokoll 91|91.1)
              -    Hinweis: Das Model MD_230R (water) wird aufgrund von gleicher Hardwarekennung als MD-2018R erkannt!
            -
              - BOSCH Deckenlüfter   (Modulmodel: SF01_01319004_Typ2 | Protokoll 86)
            -
              - CAME Drehtor Antrieb   (Modulmodel: CAME_TOP_432EV | Protokoll 86)
            -
              - ChiliTec LED Christbaumkerzen   (Modulmodel: Chilitec_22640 | Protokoll 14)
            -
              - ESTO Deckenlampe   (Modulmodel: KL_RF01 | Protokoll 93)
            -
              - Fernbedienung mit 4 Tasten für Diesel-Heizung    (Modulmodel: RCnoName20 | Protokoll 20)
            -
              - Hoermann HS1-868-BS   (Modulmodel: HS1_868_BS | Protokoll 69)
            -
              - Hoermann HSM4   (Modulmodel: HSM4 | Protokoll 69)
            -
              - Krinner LUMIX Christbaumkerzen   (Modulmodel: Krinner_LUMIX | Protokol 92)
            -
              - LED_XM21_0 Christbaumkerzen   (Modulmodel: LED_XM21_0 | Protokol 76)
            -
              - TR-502MSV (LIDL, LIBRA, MANDOLYN, QUIGG), kompatibel GT-7008BS, GT-FSI-04, DMV-7008S, Powerfix RCB-I 3600   (module model: TR_502MSV | protocol 34)
            -
              - Manax RCS250   (Modulmodel: RC_10 | Protokoll 90)
            -
              - Medion OR28V   (Modulmodel: OR28V | Protokoll 68)
            -
              - mumbi AFS300-s (remote control RC-10 | random code wireless switch RCS-22GS)   (Modulmodel: RC_10 | Protokoll 90)
            -
              - Momento (Fernbedienung für digitalen Bilderrahmen)   (Modulmodel: Momento | protocol 97)
            -
              - NAVARIS Funk-Licht-Schalter Model No.: 44344.04   (Modulmodel: Navaris | protocol 99)
            -
              - NEFF oder Refsta Topdraft (Tecnowind) Dunstabzugshaube   (Modulmodel: SF01_01319004 | Protokoll 86)
            -
              - Novy Cloud 230 Dunstabzugshaube   (Modulmodel: Novy_840039 | Protokoll 86)
            -
              - Novy Pureline 6830 Dunstabzugshaube   (Modulmodel: Novy_840029 | Protokoll 86)
            -
              - QUIGG DMV-7000   (Modulmodel: QUIGG_DMV | Protokoll 34)
            -
              - Remote control SA-434-1 mini 923301   (Modulmodel: SA_434_1_mini | Protokoll 81)
            -
              - Techmar Garden Lights    (Modulmodel: Techmar | Protokoll 95)
            -
              - Tedsen Teletaster (Protokoll 46): - -
                SKX1xx, 1 Taste - Modulmodel: Tedsen_SKX1xx
              -
                SKX2xx, 2 Tasten (GEIGER_GF0x01) - Modulmodel: Tedsen_SKX2xx
              -
                SKX4xx, 4 Tasten (GEIGER_GF0x02) - Modulmodel: Tedsen_SKX4xx
              -
                SKX6xx, 6 Tasten (GEIGER_GF0x03) - Modulmodel: Tedsen_SKX6xx
              -
              -
            -
              - unitec remote door reed switch 47031 (Unitec 47121 | Unitec 47125 | Friedland)   (Modulmodel: Unitec_47031 | Protokoll 30)
            -
              - Westinghouse Deckenventilator (Fernbedienung, 5 Tasten ohne SET)   (Modulmodel: Buttons_five | Protokoll 29)
            -
              - Westinghouse Delancey Deckenventilator (Fernbedienung, 9 Tasten mit SET)   (Modulmodel: RH787T | Protokoll 83)
            -
              - Westinghouse Deckenventilator Bendan (Fernbedienung TR60C-1, Touch screen)   (Modulmodel: TR60C1 | Protokoll 104)
            -
              - xavax 00111939 (Fernbedienung, 10 Tasten)   (Modulmodel: xavax | Protokoll 26)
            -

            + Bei noch nicht unterstützen Geräten können mit dem unknown_please_select_model Gerät Bitdaten gesammelt werden. +

            + Hinweis: Sobald das Attribut model eines definierten Gerätes verstellt oder gelöscht wird, so legt das Modul ein Gerät des gewählten Typs neu an und mit Durchlauf einer neuen Nachricht wird das aktuelle Gerät gelöscht. + Das Betreiben von Geräten des gleichen oder unterschiedliches Typs mit gleichem deviceCode führt zu Fehlern. BITTE achte stets auf einen unterschiedlichen deviceCode. +

            + + Es werden bisher folgende Geräte unterstützt:
            +
              +
            • Atlantic Security Sensoren   (Modulmodel: MD-2003R, MD-2018R,MD-210R, Protokoll 91|91.1)
              +    Hinweis: Das Model MD_230R (water) wird aufgrund gleicher Hardwarekennung als MD-2018R erkannt!
            • +
            • BOSCH Deckenlüfter   (Modulmodel: SF01_01319004_Typ2, Protokoll 86)
            • +
            • CAME Drehtor Antrieb   (Modulmodel: CAME_TOP_432EV, Protokoll 86)
            • +
            • ChiliTec LED Christbaumkerzen   (Modulmodel: Chilitec_22640, Protokoll 14)
            • +
            • ESTO Deckenlampe   (Modulmodel: KL_RF01, Protokoll 93)
            • +
            • Fernbedienung mit 4 Tasten für Diesel-Heizung    (Modulmodel: RCnoName20, Protokoll 20)
            • +
            • Hoermann HS1-868-BS   (Modulmodel: HS1_868_BS, Protokoll 69)
            • +
            • Hoermann HSM4   (Modulmodel: HSM4, Protokoll 69)
            • +
            • Krinner LUMIX Christbaumkerzen   (Modulmodel: Krinner_LUMIX, Protokol 92)
            • +
            • LED_XM21_0 Christbaumkerzen   (Modulmodel: LED_XM21_0, Protokol 76)
            • +
            • TR-502MSV (LIDL, LIBRA, MANDOLYN, QUIGG), kompatibel GT-7008BS, GT-FSI-04, DMV-7008S, Powerfix RCB-I 3600   (Modulmodel: TR_502MSV, Protokoll 34)
            • +
            • Manax RCS250   (Modulmodel: RC_10, Protokoll 90)
            • +
            • Medion OR28V   (Modulmodel: OR28V, Protokoll 68)
            • +
            • mumbi AFS300-s (Fernbedienung RC-10, Funksteckdose RCS-22GS)   (Modulmodel: RC_10, Protokoll 90)
            • +
            • Momento (Fernbedienung für digitalen Bilderrahmen)   (Modulmodel: Momento, Protokoll 97)
            • +
            • NAVARIS Funk-Licht-Schalter Model No.: 44344.04   (Modulmodel: Navaris, Protokoll 99)
            • +
            • NEFF oder Refsta Topdraft (Tecnowind) Dunstabzugshaube   (Modulmodel: SF01_01319004, Protokoll 86)
            • +
            • Novy Cloud 230 Dunstabzugshaube   (Modulmodel: Novy_840039, Protokoll 86)
            • +
            • Novy Pureline 6830 Dunstabzugshaube   (Modulmodel: Novy_840029, Protokoll 86)
            • +
            • QUIGG DMV-7000   (Modulmodel: QUIGG_DMV, Protokoll 34)
            • +
            • SA-434-1 mini 923301   (Modulmodel: SA_434_1_mini, Protokoll 81)
            • +
            • Techmar Garden Lights    (Modulmodel: Techmar, Protokoll 95)
            • +
            • Tedsen Teletaster (Protokoll 46): +
                +
              • SKX1xx, 1 Taste - Modulmodel: Tedsen_SKX1xx
              • +
              • SKX2xx, 2 Tasten (GEIGER_GF0x01) - Modulmodel: Tedsen_SKX2xx
              • +
              • SKX4xx, 4 Tasten (GEIGER_GF0x02) - Modulmodel: Tedsen_SKX4xx
              • +
              • SKX6xx, 6 Tasten (GEIGER_GF0x03) - Modulmodel: Tedsen_SKX6xx
              • +
            • +
            • unitec Magnetkontakt 47031 (für Alarmanlagen Unitec 47121, Unitec 47125, Friedland)   (Modulmodel: Unitec_47031, Protokoll 30)
            • +
            • Westinghouse Deckenventilator (Fernbedienung, 5 Tasten ohne SET)   (Modulmodel: Buttons_five, Protokoll 29)
            • +
            • Westinghouse Delancey Deckenventilator (Fernbedienung, 9 Tasten mit SET)   (Modulmodel: RH787T, Protokoll 83)
            • +
            • Westinghouse Deckenventilator Bendan (Fernbedienung TR60C-1, Touch screen)   (Modulmodel: TR60C1, Protokoll 104)
            • +
            • xavax 00111939 (Fernbedienung, 10 Tasten)   (Modulmodel: xavax, Protokoll 26)
            • +
            +

            Define
            -
              define <NAME> SD_UT <model> <Hex-Adresse>

              - Beispiele: +
                + define <NAME> SD_UT <model> <Hex-Adresse>

                + Beispiele:
                  - define <NAME> SD_UT RH787T A
                  - define <NAME> SD_UT SA_434_1_mini ffd
                  - define <NAME> SD_UT unknown
                  -


              - - Set
              -
                Je nach Gerät sind unterschiedliche Sendebefehle verfügbar.

              -
                BOSCH (SF01_01319004_Typ2) | NEFF / Refsta Topdraft (SF01_01319004)
              -
                -
              • delay
                - Taste 1 auf der Fernbedienung
              • + define <NAME> SD_UT RH787T A
                + define <NAME> SD_UT SA_434_1_mini ffd
                + define <NAME> SD_UT unknown
                +
            -
              -
            • interval
              - Taste 2 auf der Fernbedienung
            • -
            -
              -
            • light_on_off
              - Taste 3 auf der Fernbedienung
            • -
            -
              -
            • minus
              - Taste 4 auf der Fernbedienung
            • -
            -
              -
            • plus
              - Taste 5 auf der Fernbedienung
            • -

            - -
              ChiliTec LED Christbaumkerzen
            -
              -
            • power_on
              - Taste ON auf der Fernbedienung
            • -
            -
              -
            • power_off
              - Taste OFF auf der Fernbedienung
            • -
            -
              -
            • flickering_slowly
              - Taste SL auf der Fernbedienung
            • -
            -
              -
            • flickering_fast
              - Taste SF auf der Fernbedienung
            • -
            -
              -
            • brightness_minus
              - Taste - auf der Fernbedienung
            • -
            -
              -
            • brightness_plus
              - Taste + auf der Fernbedienung
            • -

            - -
              ESTO KL_RF01
            -
              -
            • on
              - Taste ON auf der Fernbedienung
            • -
            -
              -
            • off
              - Taste OFF auf der Fernbedienung
            • -
            -
              -
            • alternating_full_luminosity
              - Taste ABWECHSELNDE_LEUCHTKRAFT auf der Fernbedienung
            • -
            -
              -
            • full_brightness
              - Taste VOLLE_HELLIGKEIT auf der Fernbedienung
            • -
            -
              -
            • light_color_warm_white
              - Taste LICHTFARBE_WARMWEIß auf der Fernbedienung
            • -
            -
              -
            • light_color_cold_white
              - Taste LICHTFARBE_KALTWEIß auf der Fernbedienung
            • -
            -
              -
            • dimup
              - Taste DIMUP auf der Fernbedienung
            • -
            -
              -
            • dimdown
              - Taste DIMDOWN auf der Fernbedienung
            • -
            -
              -
            • night_mode
              - Taste MOND auf der Fernbedienung
            • -

            - -
              LED_XM21_0 Christbaumkerzen
            -
              -
            • on
              - Taste I auf der Fernbedienung
            • -
            -
              -
            • off
              - Taste O auf der Fernbedienung
            • -

            +

            -
              Remote control SA-434-1 mini 923301  |  Hoermann HS1-868-BS  |  Tedsen_SKX1xx
            + Set
              -
            • send
              - Knopfdruck (Sendet immer das selbe, auch wenn der Benutzer einen anderen Set-Befehl via Konsole sendet.)
            • -

            - -
              Hoermann HSM4 (Fernbedienung mit 4 Tasten)
            -
              -
            • button_1
              - Taste 1 auf der Fernbedienung
            • -
            -
              -
            • button_2
              - Taste 2 auf der Fernbedienung
            • -
            -
              -
            • button_3
              - Taste 3 auf der Fernbedienung
            • -
            -
              -
            • button_4
              - Taste 4 auf der Fernbedienung
            • -

            - -
              Techmar Garden Lights (Fernbedienung mit 10 Tasten)
            -
            • Group_1 ... Group_9
              - Gruppe 1 bis 9, jeweils ein und aus
            • -
            -
            • All_on / All_off
              - Alle Gruppen ein / aus
            • -

            - -
              Westinghouse Deckenventilator (Fernbedienung mit 5 Tasten)
            -
              -
            • 1_fan_low_speed
              - Taste LOW auf der Fernbedienung
            • -
            -
              -
            • 2_fan_medium_speed
              - Taste MED auf der Fernbedienung
            • -
            -
              -
            • 3_fan_high_speed
              - Taste HI auf der Fernbedienung
            • -
            -
              -
            • light_on_off
              - Licht ein-/ausschalten
            • -
            -
              -
            • fan_off
              - Ventilator ausschalten
            • -

            - -
              Westinghouse Delancey Deckenventilator (Fernbedienung RH787T mit 9 Tasten + SET)
            -
              -
            • 1_fan_minimum_speed
              - Taste I auf der Fernbedienung
            • -
            -
              -
            • 2_fan_low_speed
              - Taste II auf der Fernbedienung
            • -
            + Je nach Gerät sind unterschiedliche Sendebefehle verfügbar. +

            + + BOSCH (SF01_01319004_Typ2), NEFF / Refsta Topdraft (SF01_01319004) +
              +
            • delay: Taste 1 auf der Fernbedienung
            • +
            • interval: Taste 2 auf der Fernbedienung
            • +
            • light_on_off: Taste 3 auf der Fernbedienung
            • +
            • minus: Taste 4 auf der Fernbedienung
            • +
            • plus: Taste 5 auf der Fernbedienung
            • +

            + + ChiliTec LED Christbaumkerzen +
              +
            • power_on: Taste ON auf der Fernbedienung
            • +
            • power_off: Taste OFF auf der Fernbedienung
            • +
            • flickering_slowly: Taste SL auf der Fernbedienung
            • +
            • flickering_fast: Taste SF auf der Fernbedienung
            • +
            • brightness_minus: Taste - auf der Fernbedienung
            • +
            • brightness_plus: Taste + auf der Fernbedienung
            • +

            + + ESTO KL_RF01 +
              +
            • on: Taste ON auf der Fernbedienung
            • +
            • off: Taste OFF auf der Fernbedienung
            • +
            • alternating_full_luminosity: Taste ABWECHSELNDE_LEUCHTKRAFT auf der Fernbedienung
            • +
            • full_brightness: Taste VOLLE_HELLIGKEIT auf der Fernbedienung
            • +
            • light_color_warm_white: Taste LICHTFARBE_WARMWEIß auf der Fernbedienung
            • +
            • light_color_cold_white: Taste LICHTFARBE_KALTWEIß auf der Fernbedienung
            • +
            • dimup: Taste DIMUP auf der Fernbedienung
            • +
            • dimdown: Taste DIMDOWN auf der Fernbedienung
            • +
            • night_mode: Taste MOND auf der Fernbedienung
            • +

            + + LED_XM21_0 Christbaumkerzen +
              +
            • on: Taste I auf der Fernbedienung
            • +
            • off: Taste O auf der Fernbedienung
            • +

            -
              -
            • 3_fan_medium_low_speed
              - Taste III auf der Fernbedienung
            • -
            -
              -
            • 4_fan_medium_speed
              - Taste IV auf der Fernbedienung
            • -
            -
              -
            • 5_fan_medium_high_speed
              - Taste V auf der Fernbedienung
            • -
            -
              -
            • 6_fan_high_speed
              - Taste VI auf der Fernbedienung
            • -
            -
              -
            • fan_off
              - Ventilator ausschalten
            -
              -
            • fan_direction
              - Drehrichtung festlegen
            • -
            -
              -
            • light_on_off
              - Licht ein-/ausschalten
            • -
            -
              -
            • set
              - Taste SET in der Fernbedienung
            • + Fernbedienungen SA-434-1 mini 923301, Hoermann HS1-868-BS, Tedsen_SKX1xx +
                +
              • send: Tastendruck (Sendet immer den gleichen Befehl, auch wenn der Benutzer einen anderen Set-Befehl via Konsole sendet.)
              • +

              + + Hoermann HSM4 (Fernbedienung mit 4 Tasten) +
                +
              • button_1: Taste 1 auf der Fernbedienung
              • +
              • button_2: Taste 2 auf der Fernbedienung
              • +
              • button_3: Taste 3 auf der Fernbedienung
              • +
              • button_4: Taste 4 auf der Fernbedienung
              • +

              + + Techmar Garden Lights (Fernbedienung mit 10 Tasten) +
                +
              • Group_1 ... Group_9: Gruppe 1 bis 9, jeweils ein und aus
              • +
              • All_on / All_off: Alle Gruppen ein / aus
              • +

              + + Westinghouse Deckenventilator (Fernbedienung mit 5 Tasten) +
                +
              • 1_fan_low_speed: Taste LOW auf der Fernbedienung
              • +
              • 2_fan_medium_speed: Taste MED auf der Fernbedienung
              • +
              • 3_fan_high_speed: Taste HI auf der Fernbedienung
              • +
              • light_on_off: Licht ein-/ausschalten
              • +
              • fan_off: Ventilator ausschalten
              • +

              + + Westinghouse Delancey Deckenventilator (Fernbedienung RH787T mit 9 Tasten + SET) +
                +
              • 1_fan_minimum_speed: Taste I auf der Fernbedienung
              • +
              • 2_fan_low_speed: Taste II auf der Fernbedienung
              • +
              • 3_fan_medium_low_speed: Taste III auf der Fernbedienung
              • +
              • 4_fan_medium_speed: Taste IV auf der Fernbedienung
              • +
              • 5_fan_medium_high_speed: Taste V auf der Fernbedienung
              • +
              • 6_fan_high_speed: Taste VI auf der Fernbedienung
              • +
              • fan_off: Ventilator ausschalten
              • +
              • fan_direction: Drehrichtung festlegen
              • +
              • light_on_off: Licht ein-/ausschalten
              • +
              • set: Taste SET in der Fernbedienung
              • +


            Get
            -
              N/A


            +
              N/A
            +

            Attribute
            -
            -
            -
            -
            • model
              - Das Attribut bezeichnet den Modelltyp Ihres Gerätes.
              - (unknown, Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, TR60C1, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031)
            • -

            -
            • repeats
              - Mit diesem Attribut kann angepasst werden, wie viele Wiederholungen sendet werden. Standard ist 5.

            -
            • UTclock
              - Mit diesem Attribut kann der Clockpulse beim senden eingestellt werden. Einen Standardwert gibt es nicht.
              - Ausnahme: Das Model Novy_840039 hat einen voreingestellten Clockpulse von 375. Diesen kann man manuell mit dem Attribut individuell anpassen.

            - - Generierte Readings der Modelle
            -
              Buttons_five | CAME_TOP_432EV | Chilitec_22640 | HSM4 | KL_RF01 | LED_XM21_0 | Momento | Novy_840029 | Novy_840039 | OR28V | QUIGG_DMV | RC_10 | RH787T | SF01_01319004 | SF01_01319004_Typ2 | TR_502MSV
              -
            • deviceCode
              - GeräteCode des Systemes
            • -
            • LastAction
              - Zuletzt ausgeführte Aktion des Gerätes. receive für Kommando empfangen | send für Kommando gesendet
            • -
            • state
              - Zuletzt ausgeführter Tastendruck der Fernbedienung

            - -
              MD_2003R (gas)  |  MD_2018R (vibration)  |  MD_210R (door/windows switch)  |  MD_230R (water)
              -
            • contact
              - Zustand des internen Alarmkontaktes.
            • -
            • deviceTyp
              - Modeltyp Ihres Sensors.
            • -
            • sabotage
              - Zustand des Sabotagekontaktes.
            • -
            • state
              - Zustand des Gerätes.

            - -
              HS1-868-BS  |  SA_434_1_mini  |  Tedsen_SKX1xx  |  Tedsen_SKX2xx  |  Tedsen_SKX4xx  |  Tedsen_SKX6xx
              -
            • LastAction
              - Zuletzt ausgeführte Aktion aus FHEM. send für Kommando gesendet.
            • -
            • state
              - Zuletzt ausgeführte Aktion des Gerätes. receive für Kommando empfangen.

            - -
              Unitec_47031
              -
            • System-Housecode
              - Eingestellter System bzw. Hauscode des Gerätes
            • -
            • state
              - Zustand des Kontaktes (vorbereitet, unbestätigt)
            • -
            • Zone
              - Eingestellte Zone des Gerätes
            • -
            • Usersystem
              - Bezeichnung Systemes
            • -

            +
              +
            • do_not_notify
            • +
            • ignore
            • +
            • IODev
            • +
            • model
              + Diese Attribut bezeichnet den Modelltyp Ihres Gerätes (Buttons_five, CAME_TOP_432EV, Chilitec_22640, KL_RF01, HS1-868-BS, HSM4, QUIGG_DMV, LED_XM21_0, Momento, Navaris, Novy_840029, Novy_840039, OR28V, RC_10, RH787T, SA_434_1_mini, SF01_01319004, TR60C1, Tedsen_SKX1xx, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx, TR_502MSV, Unitec_47031, unknown). + Bei Änderung des Attributes wird ein neues Gerät mittels autocreate erzeugt. Autocreate muss dazu aktiviert sein. +
            • +
            • repeats
              + Mit diesem Attribut kann angepasst werden, wie viele Wiederholungen gesendet werden. Standard ist 5. +
            • +
            • UTclock
              + Mit diesem Attribut kann der Basistakt beim Senden eingestellt werden. Einen Standardwert gibt es nicht.
              + Ausnahme: Das Model Novy_840039 hat einen voreingestellten Basistakt von 375. Auch diesen kann man mit dem Attribut individuell anpassen. +
            • +
            • UTfrequency
              + Mit diesem Attribut kann eine individuelle Sendefrequenz eingestellt werden. Ist dieses Attribut nicht gesetzt, wird die Sendefrequenz des IO Devices (z.B. Signalduino) verwendet. +
            • +
            +

            + + Generierte Readings der Modelle
            +
              + Buttons_five, CAME_TOP_432EV, Chilitec_22640, HSM4, KL_RF01, LED_XM21_0, Momento, Novy_840029, Novy_840039, OR28V, QUIGG_DMV, RC_10, RH787T, SF01_01319004, SF01_01319004_Typ2, TR_502MSV +
                +
              • deviceCode: GeräteCode des Systemes
              • +
              • LastAction: Zuletzt ausgeführte Aktion des Gerätes (receive für Kommando empfangen, send für Kommando gesendet).
              • +
              • state: Aktueller Zustand des Gerätes
              • +

              + + MD_2003R (gas), MD_2018R (vibration), MD_210R (door/windows switch), MD_230R (water) +
                +
              • contact: Zustand des internen Alarmkontaktes.
              • +
              • deviceTyp: Modeltyp des Sensors.
              • +
              • sabotage: Zustand des Sabotagekontaktes.
              • +
              • state: Zustand des Gerätes.
              • +

              + HS1-868-BS, SA_434_1_mini, Tedsen_SKX1, Tedsen_SKX2xx, Tedsen_SKX4xx, Tedsen_SKX6xx +
                +
              • LastAction: Zuletzt ausgeführte Aktion des Gerätes (receive für Kommando empfangen, send für Kommando gesendet).
              • +
              • state: Aktueller Zustand des Gerätes
              • +

              + + Unitec_47031 +
                +
              • System-Housecode: Eingestellter System- bzw. Hauscode des Gerätes
              • +
              • state: Zustand des Kontaktes (vorbereitet, unbestätigt)
              • +
              • Zone: Eingestellte Zone des Gerätes
              • +
              • Usersystem: Bezeichnung Systemes
              • +
              +
          + =end html_DE =cut diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 915db68dd..22fbc46a4 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -7,7 +7,7 @@ UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm -UPD 2020-05-02_21:10:07 139288 FHEM/14_SD_UT.pm +UPD 2020-05-24_21:02:48 137607 FHEM/14_SD_UT.pm UPD 2020-04-15_23:37:43 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm From 3e5006699b8e07628d5e277906f72691a65778fb Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 25 May 2020 09:02:01 +0000 Subject: [PATCH 24/35] Automatic updated controls and CHANGED --- CHANGED | 10 ++++++++++ controls_signalduino.txt | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index 05b4d51fa..16d24dbba 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,13 @@ +2020-05-25 - add attribute UTfrequency in 14_SD_UT.pm (#845) + +* SD_UT new attribute UTfrequency for individual transmission frequency +Multiple query "$ attrName eq 'model'" removed +change commandref +replace "foreach my $keys (keys %models)" with "if ( exists $models{$attrValue}" in line 1756 +replace "foreach my $keys (sort keys %{$models{RC_10}{buttons}})" with "if ( exists $models{RC_10}{buttons}{$button} )" in line 1845 +replace "foreach my $keys (keys %models)" with "grep { $models{$_}{hex_lengh} =~ /$hex_lengh/ } keys %models;" in line 1745 +delete "$attr{$name}{room} = "SD_UT" if( not defined( $attr{$name}{room} ) );" +change search for models with same hex_length 2020-05-24 - Update 14_SD_UT.pm Reference to autocreate added diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 22fbc46a4..472e0b695 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -7,7 +7,7 @@ UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm -UPD 2020-05-24_21:02:48 137607 FHEM/14_SD_UT.pm +UPD 2020-05-25_11:01:37 137607 FHEM/14_SD_UT.pm UPD 2020-04-15_23:37:43 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm From 9dccda2d4463ed8128d81ac1e66e726e6586a0ba Mon Sep 17 00:00:00 2001 From: Udo Date: Tue, 26 May 2020 11:51:12 +0200 Subject: [PATCH 25/35] 10_SD_GT revised for perlcritic (#847) --- CHANGED | 3 + FHEM/10_SD_GT.pm | 512 ++++++++++++++++++++------------------- controls_signalduino.txt | 2 +- 3 files changed, 268 insertions(+), 249 deletions(-) diff --git a/CHANGED b/CHANGED index 16d24dbba..bdc654e47 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,6 @@ +2020-05-25 - Update 10_SD_GT.pm + +Code revised for perlcritic 2020-05-25 - add attribute UTfrequency in 14_SD_UT.pm (#845) * SD_UT new attribute UTfrequency for individual transmission frequency diff --git a/FHEM/10_SD_GT.pm b/FHEM/10_SD_GT.pm index df93d7818..0587eefdd 100644 --- a/FHEM/10_SD_GT.pm +++ b/FHEM/10_SD_GT.pm @@ -1,5 +1,5 @@ ################################################################# -# $Id: 10_SD_GT.pm 0 2019-12-11 21:00:00Z elektron-bbs $ +# $Id: 10_SD_GT.pm 1 2020-05-25 21:00:00Z elektron-bbs $ # # The file is part of the SIGNALduino project. # @@ -8,33 +8,23 @@ # based on code quigg_gt9000.c from pilight ################################################################# -package main; +package SD_GT; use strict; use warnings; +use GPUtils qw(GP_Import GP_Export); -sub SD_GT_Initialize($) { - my ($hash) = @_; - $hash->{Match} = "^P49#[A-Fa-f0-9]+"; - $hash->{DefFn} = "SD_GT::Define"; - $hash->{UndefFn} = "SD_GT::Undef"; - $hash->{ParseFn} = "SD_GT::Parse"; - $hash->{SetFn} = "SD_GT::Set"; - $hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 showtime:1,0 $main::readingFnAttributes"; - $hash->{AutoCreate} = {"SD_GT_LEARN" => {FILTER => "%NAME", autocreateThreshold => "5:180", GPLOT => ""}}; -} - -################################################################# - -package SD_GT; +our $VERSION = '1.0'; -use strict; -use warnings; -use GPUtils qw(:all); # wird fuer den Import der FHEM Funktionen aus der fhem.pl benoetigt +# Export to main context with different name +GP_Export(qw( + Initialize + ) +); ## Import der FHEM Funktionen BEGIN { - GP_Import(qw( + GP_Import(qw( AssignIoPort AttrVal attr @@ -49,251 +39,269 @@ BEGIN { readingsBulkUpdate readingsEndUpdate readingsSingleUpdate - )) + )) }; -sub parseSystemcodeHex($$); -sub decodePayload($$$$); -sub checkVersion(@); -sub getSystemCodes($); +sub Initialize { + my ($hash) = @_; + $hash->{DefFn} = \&Define; + $hash->{UndefFn} = \&Undef; + $hash->{SetFn} = \&Set; + $hash->{ParseFn} = \&Parse; + $hash->{Match} = '^P49#[A-Fa-f0-9]+'; + $hash->{AttrList} = "IODev do_not_notify:1,0 ignore:0,1 showtime:1,0 $main::readingFnAttributes"; + $hash->{AutoCreate} = {'SD_GT_LEARN' => {FILTER => '%NAME', autocreateThreshold => '5:180', GPLOT => q{}}}; + return; +} + +sub parseSystemcodeHex; +sub decodePayload; +sub checkVersion; +sub getSystemCodes; my %buttons = ( - '1' => { # Version 1 + '1' => { # Version 1 'hash' => [0x0, 0x9, 0xF, 0x4, 0xA, 0xD, 0x5, 0xB, 0x3, 0x2, 0x1, 0x7, 0xE, 0x6, 0xC, 0x8], - 'C' => { # unit C - 'unit' => "A", - '1' => "on", - '5' => "on", - '6' => "on", - 'A' => "on", - '2' => "off", - '7' => "off", - '8' => "off", - 'B' => "off", + 'C' => { # unit C + 'unit' => 'A', + '1' => 'on', + '5' => 'on', + '6' => 'on', + 'A' => 'on', + '2' => 'off', + '7' => 'off', + '8' => 'off', + 'B' => 'off', }, - '5' => { # unit 5 - 'unit' => "B", - '0' => "on", - '3' => "on", - 'E' => "on", - 'F' => "on", - '4' => "off", - '9' => "off", - 'C' => "off", - 'D' => "off", + '5' => { # unit 5 + 'unit' => 'B', + '0' => 'on', + '3' => 'on', + 'E' => 'on', + 'F' => 'on', + '4' => 'off', + '9' => 'off', + 'C' => 'off', + 'D' => 'off', }, - 'E' => { # unit 5 - 'unit' => "C", - '2' => "on", - '7' => "on", - '8' => "on", - 'B' => "on", - '1' => "off", - '5' => "off", - '6' => "off", - 'A' => "off", + 'E' => { # unit 5 + 'unit' => 'C', + '2' => 'on', + '7' => 'on', + '8' => 'on', + 'B' => 'on', + '1' => 'off', + '5' => 'off', + '6' => 'off', + 'A' => 'off', }, - '7' => { # unit 7 - 'unit' => "D", - '4' => "on", - '9' => "on", - 'C' => "on", - 'D' => "on", - '0' => "off", - '3' => "off", - 'E' => "off", - 'F' => "off", + '7' => { # unit 7 + 'unit' => 'D', + '4' => 'on', + '9' => 'on', + 'C' => 'on', + 'D' => 'on', + '0' => 'off', + '3' => 'off', + 'E' => 'off', + 'F' => 'off', }, - '2' => { # unit 2 - 'unit' => "all", - '2' => "on", - '7' => "on", - '8' => "on", - 'B' => "on", - '1' => "off", - '5' => "off", - '6' => "off", - 'A' => "off", + '2' => { # unit 2 + 'unit' => 'all', + '2' => 'on', + '7' => 'on', + '8' => 'on', + 'B' => 'on', + '1' => 'off', + '5' => 'off', + '6' => 'off', + 'A' => 'off', }, }, - '2' => { # Version 2 + '2' => { # Version 2 'hash' => [0x0, 0x9, 0x5, 0xF, 0x3, 0x6, 0xC, 0x7, 0xE, 0xD, 0x1, 0xB, 0x2, 0xA, 0x4, 0x8], - '0' => { # unit 0 - 'unit' => "A", - '3' => "on", - '4' => "on", - '7' => "on", - 'B' => "on", - '1' => "off", - '2' => "off", - '9' => "off", - 'A' => "off", + '0' => { # unit 0 + 'unit' => 'A', + '3' => 'on', + '4' => 'on', + '7' => 'on', + 'B' => 'on', + '1' => 'off', + '2' => 'off', + '9' => 'off', + 'A' => 'off', }, - '4' => { # unit 4 - 'unit' => "B", - '3' => "on", - '4' => "on", - '7' => "on", - 'B' => "on", - '1' => "off", - '2' => "off", - '9' => "off", - 'A' => "off", + '4' => { # unit 4 + 'unit' => 'B', + '3' => 'on', + '4' => 'on', + '7' => 'on', + 'B' => 'on', + '1' => 'off', + '2' => 'off', + '9' => 'off', + 'A' => 'off', }, - 'C' => { # unit C - 'unit' => "C", - '3' => "on", - '4' => "on", - '7' => "on", - 'B' => "on", - '1' => "off", - '2' => "off", - '9' => "off", - 'A' => "off", + 'C' => { # unit C + 'unit' => 'C', + '3' => 'on', + '4' => 'on', + '7' => 'on', + 'B' => 'on', + '1' => 'off', + '2' => 'off', + '9' => 'off', + 'A' => 'off', }, - '2' => { # unit 2 - 'unit' => "D", - '1' => "on", - '2' => "on", - '9' => "on", - 'A' => "on", - '3' => "off", - '4' => "off", - '7' => "off", - 'B' => "off", + '2' => { # unit 2 + 'unit' => 'D', + '1' => 'on', + '2' => 'on', + '9' => 'on', + 'A' => 'on', + '3' => 'off', + '4' => 'off', + '7' => 'off', + 'B' => 'off', }, - 'A' => { # unit A - 'unit' => "all", - '1' => "on", - '2' => "on", - '9' => "on", - 'A' => "on", - '3' => "off", - '4' => "off", - '7' => "off", - 'B' => "off", + 'A' => { # unit A + 'unit' => 'all', + '1' => 'on', + '2' => 'on', + '9' => 'on', + 'A' => 'on', + '3' => 'off', + '4' => 'off', + '7' => 'off', + 'B' => 'off', }, } ); -sub Define($$) { +sub Define { my ($hash, $def) = @_; - my @a = split("[ \t][ \t]*", $def); + my @a = split m{\s+}xms , $def; my $name = $hash->{NAME}; + my $iodevice; + my $ioname; - return "SD_GT: wrong syntax: define SD_GT <. . .>" if(int(@a) < 2); + if( @a < 3 ) { return 'SD_GT: wrong syntax for define, must be: define SD_GT ' }; - my $iodevice = $a[4] if($a[4]); + $hash->{DEF} = $a[2]; + if ($a[3]) { $iodevice = $a[3] } + if ($a[4]) { readingsSingleUpdate($hash,'SystemCode',$a[4],1) } + if ($a[5]) { readingsSingleUpdate($hash,'Version',$a[5],1) } + $hash->{VersionModule} = $VERSION; $modules{SD_GT}{defptr}{$hash->{DEF}} = $hash; - my $ioname = $modules{SD_GT}{defptr}{ioname} if (exists $modules{SD_GT}{defptr}{ioname} && not $iodevice); - $iodevice = $ioname if not $iodevice; - - $attr{$name}{room} = "SD_GT" if ( not exists( $attr{$name}{room} ) ); # set room, if only undef --> new def + if (exists $modules{SD_GT}{defptr}{ioname} && !$iodevice) { $ioname = $modules{SD_GT}{defptr}{ioname} }; + if (not $iodevice) { $iodevice = $ioname } AssignIoPort($hash, $iodevice); + return; } -sub Set($$$@) { +sub Set { my ($hash, $name, $cmd, @a) = @_; my $ioname = $hash->{IODev}{NAME}; my $repeats = AttrVal($name,'repeats', '5'); my $ret = undef; + my $EMPTY = q{}; - return "\"set $name\" needs at least one argument" unless(defined($cmd)); + if (not defined $cmd) { return "The command \"set $name\" requires at least one of the arguments: \"on\" or \"off\"" }; - if ($cmd eq "?") { - if ($hash->{DEF} ne "LEARN") { - $ret .= "off:noArg " if (ReadingsVal($name, "CodesOff", "") ne ""); - $ret .= "on:noArg " if (ReadingsVal($name, "CodesOn", "") ne ""); + if ($cmd eq q{?}) { + if ($hash->{DEF} ne 'LEARN') { + if (ReadingsVal($name, 'CodesOff', $EMPTY) ne $EMPTY) { $ret .= 'off:noArg ' }; + if (ReadingsVal($name, 'CodesOn', $EMPTY) ne $EMPTY) { $ret .= 'on:noArg ' }; } return $ret; } - + my $sendCodesStr; my @sendCodesAr; my $sendCodesCnt; - my $sendCode = ReadingsVal($name, "SendCode", ""); # load last sendCode - $sendCodesStr = ReadingsVal($name, "CodesOn", "") if ($cmd eq "on"); - $sendCodesStr = ReadingsVal($name, "CodesOff", "") if ($cmd eq "off"); - @sendCodesAr = split(",", $sendCodesStr); - $sendCodesCnt = scalar(@sendCodesAr); - return "$name: No codes available for sending, please press buttons on your remote for learning." if ($sendCodesCnt < 1); + my $sendCode = ReadingsVal($name, 'SendCode', $EMPTY); # load last sendCode + if ($cmd eq 'on') { $sendCodesStr = ReadingsVal($name, 'CodesOn', $EMPTY) }; + if ($cmd eq 'off') { $sendCodesStr = ReadingsVal($name, 'CodesOff', $EMPTY) }; + @sendCodesAr = split /[,]/xms , $sendCodesStr; + $sendCodesCnt = scalar @sendCodesAr; + if ($sendCodesCnt < 1) { return "$name: No codes available for sending, please press buttons on your remote for learning." }; my ($index) = grep { $sendCodesAr[$_] eq $sendCode } (0 .. $sendCodesCnt - 1); - $index = -1 if (not defined($index)); + if (not defined $index) { $index = -1 }; $index++; - $index = 0 if ($index >= $sendCodesCnt); - $sendCode = $sendCodesAr[$index]; # new sendCode + if ($index >= $sendCodesCnt) { $index = 0 }; + $sendCode = $sendCodesAr[$index]; # new sendCode Log3 $name, 3, "$ioname: SD_GT set $name $cmd"; Log3 $name, 4, "$ioname: SD_GT_Set $name $cmd ($sendCodesCnt codes $sendCodesStr - send $sendCode)"; - if ($hash->{DEF} =~ /_all$/) { # send button all - my $systemCode = ReadingsVal($name, "SystemCode", ""); - foreach my $d (keys %defs) { # sucht angelegte SD_GT mit gleichem Sytemcode - if(defined($defs{$d}) && $defs{$d}{TYPE} eq "SD_GT" && $defs{$d}{DEF} =~ /$systemCode/ && $defs{$d}{DEF} =~ /[ABCD]$/ && ReadingsVal($d, "state", "") ne $cmd) { - readingsSingleUpdate($defs{$d}, "state" , $cmd , 1); + if ($hash->{DEF} =~ /_all$/xms) { # send button all + my $systemCode = ReadingsVal($name, 'SystemCode', $EMPTY); + foreach my $d (keys %defs) { # sucht angelegte SD_GT mit gleichem Sytemcode + if(defined($defs{$d}) && $defs{$d}{TYPE} eq 'SD_GT' && $defs{$d}{DEF} =~ /$systemCode/xms && $defs{$d}{DEF} =~ /[ABCD]$/xms && ReadingsVal($d, 'state', $EMPTY) ne $cmd) { + readingsSingleUpdate($defs{$d}, 'state' , $cmd , 1); Log3 $name, 3, "$ioname: SD_GT set $d $cmd"; } } } - - my $msg = "P49#0x" . $sendCode . "#R4"; + + my $msg = 'P49#0x' . $sendCode . '#R4'; Log3 $name, 5, "$ioname: $name SD_GT_Set first set sendMsg $msg"; IOWrite($hash, 'sendMsg', $msg); - $msg = "P49.1#0x" . $sendCode . "#R4"; + $msg = 'P49.1#0x' . $sendCode . '#R4'; Log3 $name, 5, "$ioname: $name SD_GT_Set second set sendMsg $msg"; IOWrite($hash, 'sendMsg', $msg); readingsBeginUpdate($hash); - readingsBulkUpdate($hash, "state", $cmd); - readingsBulkUpdate($hash, "SendCode", $sendCode, 0); + readingsBulkUpdate($hash, 'state', $cmd); + readingsBulkUpdate($hash, 'SendCode', $sendCode, 0); readingsEndUpdate($hash, 1); return $ret; } -sub Undef($$) { +sub Undef { my ($hash, $name) = @_; - delete($modules{SD_GT}{defptr}{$hash->{DEF}}) if(defined($hash->{DEF}) && defined($modules{SD_GT}{defptr}{$hash->{DEF}})); - return undef; + if(defined($hash->{DEF}) && defined($modules{SD_GT}{defptr}{$hash->{DEF}})) {delete($modules{SD_GT}{defptr}{$hash->{DEF}}) }; + return; } -sub Parse($$) { +sub Parse { my ($iohash, $msg) = @_; my $ioname = $iohash->{NAME}; - my ($protocol,$rawData) = split("#",$msg); - $protocol=~ s/^[P](\d+)/$1/; # extract protocol ID, $1 = ID + my ($protocol,$rawData) = split /[#]/xms , $msg; my $devicedef; my $version = 0; my $systemCode = 0; - my $level; # A, B, C, D or all + my $level; # A, B, C, D or all my $state; - + my $EMPTY = q{}; + my ($systemCode1, $systemCode2) = getSystemCodes($rawData); Log3 $ioname, 4, "$ioname: SD_GT_Parse $rawData, possible codes version 1 $systemCode1 or version 2 $systemCode2"; # sucht Version und SytemCode in bereits angelegten SD_GT foreach my $d (keys %defs) { - if(defined($defs{$d}) && $defs{$d}{TYPE} eq "SD_GT") { - $version = ReadingsVal($d, "Version", 0) ; - $systemCode = ReadingsVal($d, "SystemCode", 0); + if($defs{$d}{TYPE} eq 'SD_GT' && defined $defs{$d}) { + $version = ReadingsVal($d, 'Version', 0) ; + $systemCode = ReadingsVal($d, 'SystemCode', 0); Log3 $iohash, 4, "$ioname: SD_GT_Parse found $d, version $version, systemCode $systemCode"; last if ($systemCode1 eq $systemCode && $version == 1); last if ($systemCode2 eq $systemCode && $version == 2); } - $version = 0; # reset version - $systemCode = 0; # reset systemCode + $version = 0; # reset version + $systemCode = 0; # reset systemCode } Log3 $ioname, 4, "$ioname: SD_GT_Parse $rawData, found version $version with systemCode $systemCode"; - if ($version == 0 && $systemCode eq '0') { # Version und systemCode nicht gefunden - $devicedef = "LEARN"; - } else { # Version und systemCode gefunden - my $statecode = substr($rawData,4,1); - my $unit = substr($rawData,5,1); + if ($version == 0 && $systemCode eq '0') { # Version und systemCode nicht gefunden + $devicedef = 'LEARN'; + } else { # Version und systemCode gefunden + my $statecode = substr $rawData,4,1; + my $unit = substr $rawData,5,1; $state = $buttons{$version}->{$unit}->{$statecode}; - $level = $buttons{$version}->{$unit}->{"unit"}; - $devicedef = $systemCode . "_" . $level; + $level = $buttons{$version}->{$unit}->{'unit'}; + $devicedef = $systemCode . '_' . $level; Log3 $ioname, 4, "$ioname: SD_GT_Parse code $rawData, device $devicedef"; } @@ -305,148 +313,150 @@ sub Parse($$) { } my $hash = $def; my $name = $hash->{NAME}; - return "" if(IsIgnored($name)); - + if (IsIgnored($name)) { return $EMPTY }; + my $learnCodesStr; my @learnCodesAr; my $learnCodesCnt; - if ($devicedef eq "LEARN") { - $learnCodesStr = ReadingsVal($name, "LearnCodes", ""); - @learnCodesAr = split(",", $learnCodesStr); - $learnCodesCnt = scalar(@learnCodesAr); + if ($devicedef eq 'LEARN') { + $learnCodesStr = ReadingsVal($name, 'LearnCodes', $EMPTY ); + @learnCodesAr = split /[,]/xms , $learnCodesStr; + $learnCodesCnt = scalar @learnCodesAr; Log3 $name, 3, "$ioname: $name $rawData, $learnCodesCnt learned codes $learnCodesStr"; - if ($learnCodesCnt == 0) { # erster Code empfangen - push(@learnCodesAr,$rawData); + if ($learnCodesCnt == 0) { # erster Code empfangen + push @learnCodesAr, $rawData ; $learnCodesCnt++; Log3 $name, 3, "$ioname: $name code $rawData is first plausible code"; - } elsif (grep /$rawData/, @learnCodesAr) { # Code schon vorhanden - $state = "code already registered, please press another button"; + } elsif (grep {/$rawData/xms} @learnCodesAr) { # Code schon vorhanden + $state = 'code already registered, please press another button'; Log3 $name, 3, "$ioname: $name code $rawData already registered ($learnCodesStr)"; - } else { # Code pruefen und evtl. uebernehmen - push(@learnCodesAr,$rawData); + } else { # Code pruefen und evtl. uebernehmen + push @learnCodesAr, $rawData; ($version, $systemCode) = checkVersion(@learnCodesAr); - if ($version == 0) { # Fehler Version oder Systemcode + if ($version == 0) { # Fehler Version oder Systemcode if ($learnCodesCnt == 1) { @learnCodesAr = (); $systemCode = 0; } else { pop @learnCodesAr; # Wir entfernen das letzte Element des Arrays } - $state = "version not unique, please press another button"; + $state = 'version not unique, please press another button'; Log3 $name, 3, "$ioname: $name ERROR - version not unique"; - } else { # Version und Code OK + } else { # Version und Code OK $learnCodesCnt++; Log3 $name, 3, "$ioname: $name code $learnCodesCnt $rawData, version $version, systemCode $systemCode"; } } - $state = "learned code $learnCodesCnt, please press another button" if (not defined $state); + if (not defined $state) { $state = "learned code $learnCodesCnt, please press another button" }; } - my $CodesOn; - my $CodesOff; - if ($state eq "on") { - $learnCodesStr = ReadingsVal($name, "CodesOn", ""); - @learnCodesAr = split(",", $learnCodesStr); - push(@learnCodesAr,$rawData) if (not grep /$rawData/, @learnCodesAr); + if ($state eq 'on') { + $learnCodesStr = ReadingsVal($name, 'CodesOn', $EMPTY); + @learnCodesAr = split /[,]/xms , $learnCodesStr; + if (not grep {/$rawData/xms} @learnCodesAr) { push @learnCodesAr, $rawData }; } - if ($state eq "off") { - $learnCodesStr = ReadingsVal($name, "CodesOff", ""); - @learnCodesAr = split(",", $learnCodesStr); - push(@learnCodesAr,$rawData) if (not grep /$rawData/, @learnCodesAr); + if ($state eq 'off') { + $learnCodesStr = ReadingsVal($name, 'CodesOff', $EMPTY); + @learnCodesAr = split /[,]/xms , $learnCodesStr; + if (not grep {/$rawData/xms} @learnCodesAr) { push @learnCodesAr, $rawData }; } - - Log3 $name, 4, "$ioname: SD_GT_Parse code $rawData, $name, button $level $state"; - if (defined $level && $level eq "all") { # received button all) { - foreach my $d (keys %defs) { # sucht angelegte SD_GT mit gleichem Sytemcode - if(defined($defs{$d}) && $defs{$d}{TYPE} eq "SD_GT" && $defs{$d}{DEF} =~ /$systemCode/ && $defs{$d}{DEF} =~ /[ABCD]$/ && ReadingsVal($d, "state", "") ne $state) { - readingsSingleUpdate($defs{$d}, "state" , $state , 1); + if (defined $level) { Log3 $name, 4, "$ioname: SD_GT_Parse code $rawData, $name, button $level $state" }; + + if (defined $level && $level eq 'all') { # received button all + foreach my $d (keys %defs) { # sucht angelegte SD_GT mit gleichem Sytemcode + if(defined($defs{$d}) && $defs{$d}{TYPE} eq 'SD_GT' && $defs{$d}{DEF} =~ /$systemCode/xms && $defs{$d}{DEF} =~ /[ABCD]$/xms && ReadingsVal($d, 'state', $EMPTY) ne $state) { + readingsSingleUpdate($defs{$d}, 'state' , $state , 1); DoTrigger($d, undef, 0); Log3 $name, 4, "$ioname: SD_GT_Parse received button $level, set $d $state"; } } } - - $learnCodesStr = join(",", @learnCodesAr); - my $systemCodeDec = hex($systemCode); + + $learnCodesStr = join q{,} , @learnCodesAr; + my $systemCodeDec = hex $systemCode; readingsBeginUpdate($hash); - readingsBulkUpdate($hash, "state", $state); - readingsBulkUpdate($hash, "LearnCodes", $learnCodesStr) if ($devicedef eq "LEARN"); - readingsBulkUpdate($hash, "CodesOn", $learnCodesStr, 0) if ($state eq "on"); - readingsBulkUpdate($hash, "CodesOff", $learnCodesStr, 0) if ($state eq "off"); - if ($devicedef ne "LEARN" || $learnCodesCnt > 5) { - readingsBulkUpdate($hash, "Version", $version, 0) if ($version != 0); - readingsBulkUpdate($hash, "SystemCode", $systemCode, 0) if ($systemCode ne 0); - readingsBulkUpdate($hash, "SystemCodeDec", $systemCodeDec, 0) if ($systemCodeDec != 0); + readingsBulkUpdate($hash, 'state', $state); + if ($devicedef eq 'LEARN') { readingsBulkUpdate($hash, 'LearnCodes', $learnCodesStr) }; + if ($state eq 'on') { readingsBulkUpdate($hash, 'CodesOn', $learnCodesStr, 0) }; + if ($state eq 'off') { readingsBulkUpdate($hash, 'CodesOff', $learnCodesStr, 0) }; + if ($devicedef ne 'LEARN' || $learnCodesCnt > 5) { + if ($version != 0) { readingsBulkUpdate($hash, 'Version', $version, 0) }; + if ($systemCode ne '0') { readingsBulkUpdate($hash, 'SystemCode', $systemCode, 0) }; + if ($systemCodeDec != 0) { readingsBulkUpdate($hash, 'SystemCodeDec', $systemCodeDec, 0) }; } readingsEndUpdate($hash, 1); - return $name; + return $name; } -sub parseSystemcodeHex($$) { +sub parseSystemcodeHex { my $rawData = shift; my $version = shift; - my $systemCode1dec = hex(substr($rawData,0,1)); - my $systemCode2enc = hex(substr($rawData,1,1)); - my $systemCode2dec = 0; # calculate all codes with base syscode2 = 0 - my $systemCode3enc = hex(substr($rawData,2,1)); + my $systemCode1dec = hex substr $rawData,0,1; + my $systemCode2enc = hex substr $rawData,1,1; + my $systemCode2dec = 0; # calculate all codes with base syscode2 = 0 + my $systemCode3enc = hex substr $rawData,2,1; my $systemCode3dec = decodePayload($systemCode3enc, $systemCode2enc, $systemCode1dec, $version); - my $systemCode4enc = hex(substr($rawData,3,1)); + my $systemCode4enc = hex substr $rawData,3,1; my $systemCode4dec = decodePayload($systemCode4enc, $systemCode3enc, $systemCode1dec, $version); - my $systemCode5enc = hex(substr($rawData,4,1)); + my $systemCode5enc = hex substr $rawData,4,1; my $systemCode5dec = decodePayload($systemCode5enc, $systemCode4enc, $systemCode1dec, $version); my $systemCode = ($systemCode1dec<<16) + ($systemCode2dec<<12) + ($systemCode3dec<<8) + ($systemCode4dec<<4) + $systemCode5dec; - my $systemCodeHex = sprintf("%X", $systemCode); + my $systemCodeHex = sprintf '%X', $systemCode; return $systemCodeHex; } -sub checkVersion(@) { +sub checkVersion { my (@rawData) = @_; - my $anzahl = scalar(@rawData); + my $anzahl = scalar @rawData; + my $x = 0; my @codes; - my $systemCode = ""; + my $systemCode = q{}; my $version = 1; - for (my $x = 0; $x < $anzahl; $x++) { + while ($x < $anzahl) { $systemCode = parseSystemcodeHex($rawData[$x], $version); - if ( not grep /$systemCode/, @codes) { - push(@codes,$systemCode); + if ( not grep {/$systemCode/xms} @codes) { + push @codes, $systemCode; } + $x++; } - $anzahl = scalar(@codes); + $anzahl = scalar @codes; + $x = 0; if ($anzahl > 1) { $version = 2; @codes =(); - for (my $x = 0; $x < $anzahl; $x++) { + while ($x < $anzahl) { $systemCode = parseSystemcodeHex($rawData[$x], $version); - if ( not grep /$systemCode/, @codes) { - push(@codes,$systemCode); + if ( not grep {/$systemCode/xms} @codes) { + push @codes, $systemCode; } + $x++; } - $anzahl = scalar(@codes); + $anzahl = scalar @codes; } - if ($anzahl > 1) { # keine eindeutige Version erkannt + if ($anzahl > 1) { # keine eindeutige Version erkannt $version = 0; $systemCode = 0; } return ($version, $systemCode); } -sub decodePayload($$$$) { +sub decodePayload { my $payload = shift; my $index = shift; my $syscodetype = shift; my $version = shift; my $ret = -1; if ($version >= 1) { - my @gt9000_hash = @{ $buttons{$version}->{"hash"} }; + my @gt9000_hash = @{ $buttons{$version}->{'hash'} }; $ret = int($payload) ^ int($gt9000_hash[$index]); } return $ret; } -sub getSystemCodes($) { +sub getSystemCodes { my ($rawData) = shift; my $systemCode1 = parseSystemcodeHex($rawData, 1); my $systemCode2 = parseSystemcodeHex($rawData, 2); @@ -497,6 +507,9 @@ sub getSystemCodes($) {
          The device "SD_GT_LEARN" is no longer needed and can be deleted.

          + If several remote controls are to be taught in, this process must be carried out separately for each remote control. + The "SD_GT_LEARN" device must be deleted before starting to learn a new remote control. +

          Readings:

          • CodesOff: one to four hexadecimal codes for "off" that have been taught and used for sending
          • @@ -548,6 +561,9 @@ sub getSystemCodes($) {
            Das Gerät "SD_GT_LEARN" wird jetzt nicht mehr benötigt und kann gelöscht werden.

            + Sollen mehrere Fernbedienungen angelernt werden, muss dieser Prozess für jede Fernbedienung getrennt durchgeführt werden. + Das Gerät "SD_GT_LEARN" muss jeweils vor Beginn des Anlernens einer neuen Fernbedienung gelöscht werden. +

            Readings:

            • CodesOff: ein bis vier hexadezimale Codes für "off", die angelernt wurden und zum Senden verwendet werden
            • diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 472e0b695..c234b38ee 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,6 +1,6 @@ UPD 2020-05-02_21:10:07 226653 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm -UPD 2020-04-16_21:15:43 19841 FHEM/10_SD_GT.pm +UPD 2020-05-25_21:10:23 20465 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm UPD 2019-12-27_17:45:04 13627 FHEM/14_FLAMINGO.pm UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm From 088a3073e722e37e8a6d83f5954ee644fa839d9b Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 26 May 2020 09:51:28 +0000 Subject: [PATCH 26/35] Automatic updated controls and CHANGED --- CHANGED | 1 + controls_signalduino.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index bdc654e47..b3c56a65b 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,4 @@ +2020-05-26 - 10_SD_GT revised for perlcritic (#847) 2020-05-25 - Update 10_SD_GT.pm Code revised for perlcritic diff --git a/controls_signalduino.txt b/controls_signalduino.txt index c234b38ee..67415d673 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -1,6 +1,6 @@ UPD 2020-05-02_21:10:07 226653 FHEM/00_SIGNALduino.pm UPD 2017-06-23_17:43:38 14541 FHEM/10_FS10.pm -UPD 2020-05-25_21:10:23 20465 FHEM/10_SD_GT.pm +UPD 2020-05-26_11:51:12 20465 FHEM/10_SD_GT.pm UPD 2016-09-18_21:22:06 10111 FHEM/14_BresserTemeo.pm UPD 2019-12-27_17:45:04 13627 FHEM/14_FLAMINGO.pm UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm From fd21022cf336bd6aaf746e84f9d08c12deab98a3 Mon Sep 17 00:00:00 2001 From: HomeAutoUser Date: Thu, 28 May 2020 22:38:03 +0200 Subject: [PATCH 27/35] Dev r34 - id56 - #848 (#849) Update SD_ProtocolData.pm * ID 56 fix def & added doc https://github.com/RFD-FHEM/RFFHEM/issues/848 --- CHANGED | 3 +++ FHEM/lib/SD_ProtocolData.pm | 7 +++++-- controls_signalduino.txt | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGED b/CHANGED index b3c56a65b..49b0340c2 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,6 @@ +2020-05-26 - Update SD_ProtocolData.pm + +* ID 56 fix def & added doc https://github.com/RFD-FHEM/RFFHEM/issues/848 2020-05-26 - 10_SD_GT revised for perlcritic (#847) 2020-05-25 - Update 10_SD_GT.pm diff --git a/FHEM/lib/SD_ProtocolData.pm b/FHEM/lib/SD_ProtocolData.pm index b107669f5..6787f3541 100644 --- a/FHEM/lib/SD_ProtocolData.pm +++ b/FHEM/lib/SD_ProtocolData.pm @@ -1581,7 +1581,10 @@ package lib::SD_ProtocolData; length_min => '24', length_max => '24', }, - "56" => ## Celexon + "56" => ## Celexon Motorleinwand + # https://forum.fhem.de/index.php/topic,52025.0.html @Horst12345 + # MU;P0=5036;P1=-624;P2=591;P3=-227;P4=187;P5=-5048;D=0123412341414123234141414141414141412341232341414141232323234123234141414141414123414141414141414141234141414123234141412341232323250123412341414123234141414141414141412341232341414141232323234123234141414141414123414141414141414141234141414123234141412;CP=4;O; + # MU;P0=-228;P1=185;P2=-625;P3=593;P4=-5050;P5=5050;D=012121234523012301212123030121212121212121212301230301212121230303030123030303030301212123452301230121212303012121212121212121230123030121212123030303012303012121212121212301212121212121212121230121230121230303030301212123;CP=1; { name => 'Celexon', id => '56', @@ -1593,7 +1596,7 @@ package lib::SD_ProtocolData; format => 'twostate', preamble => 'u56#', # prepend to converted message #clientmodule => '', - modulematch => '', + #modulematch => '', length_min => '56', length_max => '68', }, diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 67415d673..394565dd1 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -14,5 +14,5 @@ UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm UPD 2020-04-15_23:37:19 15082 FHEM/90_SIGNALduino_un.pm -UPD 2020-05-02_21:10:07 169560 FHEM/lib/SD_ProtocolData.pm +UPD 2020-05-26_21:53:25 170260 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From 045a6e108d931951038df050cfabe4156d6ab0e8 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 28 May 2020 20:38:19 +0000 Subject: [PATCH 28/35] Automatic updated controls and CHANGED --- CHANGED | 4 ++++ controls_signalduino.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index 49b0340c2..677fdd6a9 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,7 @@ +2020-05-28 - Dev r34 - id56 - #848 (#849) + +Update SD_ProtocolData.pm +* ID 56 fix def & added doc https://github.com/RFD-FHEM/RFFHEM/issues/848 2020-05-26 - Update SD_ProtocolData.pm * ID 56 fix def & added doc https://github.com/RFD-FHEM/RFFHEM/issues/848 diff --git a/controls_signalduino.txt b/controls_signalduino.txt index 394565dd1..a657c25f8 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -14,5 +14,5 @@ UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm UPD 2020-04-12_22:14:20 14325 FHEM/14_SD_WS_Maverick.pm UPD 2018-07-04_21:56:16 37910 FHEM/41_OREGON.pm UPD 2020-04-15_23:37:19 15082 FHEM/90_SIGNALduino_un.pm -UPD 2020-05-26_21:53:25 170260 FHEM/lib/SD_ProtocolData.pm +UPD 2020-05-28_22:38:03 170260 FHEM/lib/SD_ProtocolData.pm UPD 2019-06-08_09:30:54 5181 FHEM/lib/SD_Protocols.pm From f2a74637962cba16f8740feece6837ecddafe28e Mon Sep 17 00:00:00 2001 From: Udo Date: Sat, 6 Jun 2020 17:58:56 +0200 Subject: [PATCH 29/35] SD_UT wrong DEF (#857) * Update 14_SD_UT.pm If the device is created manually with IODev, then DEF is wrong. --- CHANGED | 6 ++++++ FHEM/14_SD_UT.pm | 4 +++- controls_signalduino.txt | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGED b/CHANGED index 677fdd6a9..2efbddcb6 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,9 @@ +2020-06-06 - Update 14_SD_UT.pm + +remove uc +2020-06-06 - Update 14_SD_UT.pm + +If the device is created manually with IODev, then DEF is wrong. 2020-05-28 - Dev r34 - id56 - #848 (#849) Update SD_ProtocolData.pm diff --git a/FHEM/14_SD_UT.pm b/FHEM/14_SD_UT.pm index 2be7bbc60..25f34da9d 100644 --- a/FHEM/14_SD_UT.pm +++ b/FHEM/14_SD_UT.pm @@ -739,7 +739,7 @@ sub SD_UT_Define($$) { my ($hash, $def) = @_; my @a = split("[ \t][ \t]*", $def); - # Argument 0 1 2 3 4 + # Argument 0 1 2 3 4 return "wrong syntax: define SD_UT " if(int(@a) < 3 || int(@a) > 5); return "wrong $a[2]\n\n(allowed modelvalues: " . join(" | ", sort keys %models).")" if $a[2] && ( !grep { $_ eq $a[2] } %models ); ### checks unknown ### @@ -814,8 +814,10 @@ sub SD_UT_Define($$) { ### Attributes | model set after codesyntax ### my $devicetyp = $a[2]; if ($devicetyp eq "unknown") { + $hash->{DEF} = $devicetyp; # model $attr{$name}{model} = "unknown" if( not defined( $attr{$name}{model} ) ); } else { + $hash->{DEF} = $devicetyp . q{ } . $a[3]; # model HEX-Value $attr{$name}{model} = $devicetyp if( not defined( $attr{$name}{model} ) ); } diff --git a/controls_signalduino.txt b/controls_signalduino.txt index a657c25f8..b20003e73 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -7,7 +7,7 @@ UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm -UPD 2020-05-25_11:01:37 137607 FHEM/14_SD_UT.pm +UPD 2020-06-06_17:01:09 137737 FHEM/14_SD_UT.pm UPD 2020-04-15_23:37:43 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm From dd1c0ce6cbe95bc8e7fa2c206aee57c1a50846cf Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Sat, 6 Jun 2020 15:59:12 +0000 Subject: [PATCH 30/35] Automatic updated controls and CHANGED --- CHANGED | 4 ++++ controls_signalduino.txt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGED b/CHANGED index 2efbddcb6..7eb42a287 100644 --- a/CHANGED +++ b/CHANGED @@ -1,3 +1,7 @@ +2020-06-06 - SD_UT wrong DEF (#857) + +* Update 14_SD_UT.pm +If the device is created manually with IODev, then DEF is wrong. 2020-06-06 - Update 14_SD_UT.pm remove uc diff --git a/controls_signalduino.txt b/controls_signalduino.txt index b20003e73..27c433a22 100644 --- a/controls_signalduino.txt +++ b/controls_signalduino.txt @@ -7,7 +7,7 @@ UPD 2020-04-12_22:14:20 19348 FHEM/14_Hideki.pm UPD 2020-04-12_22:14:20 9666 FHEM/14_SD_AS.pm UPD 2020-04-21_16:14:38 24185 FHEM/14_SD_BELL.pm UPD 2019-11-16_19:42:18 12593 FHEM/14_SD_RSL.pm -UPD 2020-06-06_17:01:09 137737 FHEM/14_SD_UT.pm +UPD 2020-06-06_17:58:56 137737 FHEM/14_SD_UT.pm UPD 2020-04-15_23:37:43 68829 FHEM/14_SD_WS.pm UPD 2020-04-12_22:14:20 18427 FHEM/14_SD_WS07.pm UPD 2020-04-15_23:37:36 35356 FHEM/14_SD_WS09.pm From 9e910ac5ff315b006ecd6a778ab5d35a68373c55 Mon Sep 17 00:00:00 2001 From: Udo Date: Mon, 15 Jun 2020 17:41:39 +0200 Subject: [PATCH 31/35] 10_FS10 revised for perlcritic (#860) --- CHANGED | 78 +-- FHEM/10_FS10.pm | 932 +++++++++++++++++++----------------- FHEM/lib/SD_ProtocolData.pm | 31 +- controls_signalduino.txt | 4 +- 4 files changed, 529 insertions(+), 516 deletions(-) diff --git a/CHANGED b/CHANGED index 7eb42a287..2550d0420 100644 --- a/CHANGED +++ b/CHANGED @@ -1,70 +1,30 @@ +2020-06-15 - Update 10_FS10.pm +2020-06-14 - Update 10_FS10.pm +2020-06-14 - Update 10_FS10.pm +2020-06-13 - 10_FS10 revised for perlcritic 2020-06-06 - SD_UT wrong DEF (#857) + Update 14_SD_UT.pm - If the device is created manually with IODev, then DEF is wrong. -* Update 14_SD_UT.pm -If the device is created manually with IODev, then DEF is wrong. -2020-06-06 - Update 14_SD_UT.pm - -remove uc -2020-06-06 - Update 14_SD_UT.pm - -If the device is created manually with IODev, then DEF is wrong. 2020-05-28 - Dev r34 - id56 - #848 (#849) + Update SD_ProtocolData.pm - ID 56 fix def & added doc https://github.com/RFD-FHEM/RFFHEM/issues/848 -Update SD_ProtocolData.pm -* ID 56 fix def & added doc https://github.com/RFD-FHEM/RFFHEM/issues/848 -2020-05-26 - Update SD_ProtocolData.pm - -* ID 56 fix def & added doc https://github.com/RFD-FHEM/RFFHEM/issues/848 2020-05-26 - 10_SD_GT revised for perlcritic (#847) -2020-05-25 - Update 10_SD_GT.pm -Code revised for perlcritic 2020-05-25 - add attribute UTfrequency in 14_SD_UT.pm (#845) + new attribute UTfrequency for individual transmission frequency + Multiple query "$ attrName eq 'model'" removed + change commandref + replace "foreach my $keys (keys %models)" with "if ( exists $models{$attrValue}" in line 1756 + replace "foreach my $keys (sort keys %{$models{RC_10}{buttons}})" with "if ( exists $models{RC_10}{buttons}{$button} )" in line 1845 + replace "foreach my $keys (keys %models)" with "grep { $models{$_}{hex_lengh} =~ /$hex_lengh/ } keys %models;" in line 1745 + delete "$attr{$name}{room} = "SD_UT" if( not defined( $attr{$name}{room} ) );" + change search for models with same hex_length + Reference to autocreate added + rename hex_lengh in hex_length + Check values attribute UTfrequency added + Documentation for UTfrequency attribute added -* SD_UT new attribute UTfrequency for individual transmission frequency -Multiple query "$ attrName eq 'model'" removed -change commandref -replace "foreach my $keys (keys %models)" with "if ( exists $models{$attrValue}" in line 1756 -replace "foreach my $keys (sort keys %{$models{RC_10}{buttons}})" with "if ( exists $models{RC_10}{buttons}{$button} )" in line 1845 -replace "foreach my $keys (keys %models)" with "grep { $models{$_}{hex_lengh} =~ /$hex_lengh/ } keys %models;" in line 1745 -delete "$attr{$name}{room} = "SD_UT" if( not defined( $attr{$name}{room} ) );" -change search for models with same hex_length -2020-05-24 - Update 14_SD_UT.pm - -Reference to autocreate added -2020-05-23 - Update 14_SD_UT.pm - -change commandref engl. -2020-05-22 - Update 14_SD_UT.pm - -change search for models with same hex_length -rename hex_lengh in hex_length -2020-05-20 - Update 14_SD_UT.pm - -replace "foreach my $keys (keys %models)" with "grep { $models{$_}{hex_lengh} =~ /$hex_lengh/ } keys %models;" in line 1745 -delete "$attr{$name}{room} = "SD_UT" if( not defined( $attr{$name}{room} ) );" -2020-05-18 - Update 14_SD_UT.pm - -replace "foreach my $keys (sort keys %{$models{RC_10}{buttons}})" with "if ( exists $models{RC_10}{buttons}{$button} )" in line 1845 -2020-05-17 - Update 14_SD_UT.pm - -replace "foreach my $keys (keys %models)" with "if ( exists $models{$attrValue}" in line 1756 -minor corrections in html_DE -2020-05-17 - Update 14_SD_UT.pm - -update html_DE -2020-05-12 - Update 14_SD_UT.pm - change commandref - -change commandref -2020-05-07 - Update 14_SD_UT.pm - -Check values ​​attribute UTfrequency added -Documentation for UTfrequency attribute added -Multiple query "$ attrName eq 'model'" removed -2020-05-06 - SD_UT new attribute UTfrequency for individual transmission frequency 2020-05-02 - new protocol 104 for remote control TR60C-1 (#844) - -* Update 14_SD_UT.pm 2020-05-02 - Merge branch 'dev-r34' into dev-r34_TR60C-1 2020-05-02 - new protocol 104 for remote control TR60C-1 2020-04-22 - Merge branch 'dev-r34' into dev-r34_operatorFixes @@ -73,7 +33,7 @@ Multiple query "$ attrName eq 'model'" removed 2020-04-21 - new protocol 98 for wireless door bell GEA-028DB (#839) 2020-04-14 - 00_SIGNALduino.pm -Changed stringrefs to coderefs + Changed stringrefs to coderefs 2020-04-13 - Bump dev-r34 to v3.4.4 2020-04-13 - Merge remote-tracking branch 'remotes/origin/dev-r34' into v3.4.3 diff --git a/FHEM/10_FS10.pm b/FHEM/10_FS10.pm index ac41d5b12..041a8049d 100644 --- a/FHEM/10_FS10.pm +++ b/FHEM/10_FS10.pm @@ -1,372 +1,424 @@ ############################################## -# $Id: 10_FS10.pm 331 2017-06-23 17:00:00Z v3.3-dev $ +# $Id: 10_FS10.pm 11 2020-06-06 21:30:00Z elektron-bbs $ # -# FS10 basierend auf dem FS20 Modul (FHEM 5.3), elektron-bbs - -package main; +# FS10 basierend auf dem FS20 Modul angepasst fuer SIGNALduino, elektron-bbs +# +# 2020-06-06 Ueberarbeitung PBP +# 2020-04-28 Einschraenkung bei Kommando "attr FS10_x_xx repetition x" auf gueltige Werte 1 - 9 +# 2019-03-23 Forward declarations and rename subs +# 2018-04-28 FS10_Define IO-Device kann angegeben werden +# 2017-11-25 FS10_Set Checksumme fuer Wiederholung wurde falsch berechnet +# Pause zwischen Wiederholung jetzt immer 200 mS +# SignalRepeats jetzt auch im Abstand von 200 mS +# Anzahl Wiederholungen bei Dimm-Befehlen korrigiert +# Anzahl Dimup/Dimdown auf 1-10 begrenzt +# FS10_Initialize Anzahl Wiederholungen auf 1 bis 9 begrenzt + +package FS10; use strict; use warnings; +use GPUtils qw(GP_Import GP_Export); -my %codes = ( - "0" => "off_1", - "2" => "off_2", - "1" => "on_1", - "3" => "on_2", - "8" => "dimdown_1", # 0 | 8 = 8 - "4" => "dimdown_2", - "9" => "dimup_1", # 1 | 8 = 9 - "5" => "dimup_2", -); +our $VERSION = '1.1'; +# Export to main context with different name +GP_Export(qw( + Initialize + ) +); -use vars qw(%fs10_c2b); # Peter would like to access it from outside +# Import der FHEM Funktionen +BEGIN { + GP_Import(qw( + AssignIoPort + AttrVal + attr + CommandDefine + CommandDelete + IOWrite + IsDummy + IsIgnored + Log3 + modules + SetExtensions + readingsSingleUpdate + )) +}; + +# Forward declarations +sub nibble2dec; +sub dec2nibble; + +my %fs10_c2b; # reverse codes +my %codes = ( + '0' => 'off_1', + '2' => 'off_2', + '1' => 'on_1', + '3' => 'on_2', + '8' => 'dimdown_1', # 0 | 8 = 8 + '4' => 'dimdown_2', + '9' => 'dimup_1', # 1 | 8 = 9 + '5' => 'dimup_2', +); my %models = ( - FS10_ST => 'simple', - FS10_DI => 'dimmer', - FS10_HD => 'dimmer', - FS10_SA => 'timer', - FS10_MS => 'simple', - FS10_S4 => 'remote', - FS10_S8 => 'remote', + FS10_ST => 'simple', + FS10_DI => 'dimmer', + FS10_HD => 'dimmer', + FS10_SA => 'timer', + FS10_MS => 'simple', + FS10_S4 => 'remote', + FS10_S8 => 'remote', ); - -sub -FS10_Initialize($) -{ - my ($hash) = @_; - - foreach my $k (keys %codes) { - $fs10_c2b{$codes{$k}} = $k; - } - - $hash->{Match} = '^P61#[a-fA-F0-9]{8,12}'; - $hash->{SetFn} = "FS10_Set"; - $hash->{DefFn} = "FS10_Define"; - $hash->{UndefFn} = "FS10_Undef"; - $hash->{ParseFn} = "FS10_Parse"; - $hash->{AttrList} = "IODev follow-on-for-timer:1,0 follow-on-timer ". - "do_not_notify:1,0 repetition ". - "ignore:1,0 dummy:1,0 showtime:1,0 ". - "$readingFnAttributes " . - "model:".join(",", sort keys %models); +sub Initialize { + my ($hash) = @_; + for my $k (keys %codes) { + $fs10_c2b{$codes{$k}} = $k; # reverse codes + } + $hash->{Match} = '^P61#[a-fA-F0-9]{8,12}'; + $hash->{SetFn} = \&Set; + $hash->{DefFn} = \&Define; + $hash->{UndefFn} = \&Undef; + $hash->{ParseFn} = \&Parse; + $hash->{AttrFn} = \&Attr; + $hash->{AttrList} = 'IODev follow-on-for-timer:1,0 follow-on-timer '. + 'do_not_notify:1,0 repetition:1,2,3,4,5,6,7,8,9 '. + 'ignore:1,0 dummy:1,0 showtime:1,0 '. + "$main::readingFnAttributes " . + 'model:'.join q{,} , sort keys %models; + $hash->{AutoCreate} = {'FS10.*' => {FILTER => '%NAME', autocreateThreshold => '5:180', GPLOT => q{}}}; + return } -################################### -sub -FS10_Set($@) -{ - my ($hash, $name, @a) = @_; - - my $ret = undef; - my $na = int(@a); # Anzahl in Array - #Log3 $name, 3, "FS10: na $na"; - - return "no set value specified" if ($na < 1); # if($na < 2 || $na > 3); - return "Dummydevice $hash->{NAME}: will not set data" if(IsDummy($hash->{NAME})); - - my $model = AttrVal($name, "model", "FS10_ST"); - my $modelType = $models{$model}; - - my $list .= "off:noArg on:noArg " if ($modelType ne "remote" ); - - $list .= "dimup dimdown " if ($modelType eq "dimmer" ); - - return SetExtensions($hash, $list, $name, @a) if( $a[0] eq "?" ); - return SetExtensions($hash, $list, $name, @a) if( !grep( $_ =~ /^\Q$a[0]\E($|:)/, split( ' ', $list ) ) ); - - my $setstate = $a[0]; - my $sum = 0; - my $temp = ""; - my $ebeneh = substr($hash->{BTN}, 0, 1); - my $ebenel = substr($hash->{BTN}, 1, 1); - my $housecode = $hash->{HC} - 1; - my $kc; - my $SignalRepeats = AttrVal($name,'repetition', '1'); - my $io = $hash->{IODev}; - my $iNum = 2; - - if ($na > 1 && $setstate =~ m/dim/) { # Anzahl dimup / dimdown - $iNum += $a[1]; - Log3 $name, 3, "$io->{NAME} FS10_set: $name $setstate $a[1]"; - } - else { - Log3 $name, 3, "$io->{NAME} FS10_set: $name $setstate"; - } - Log3 $name, 4, "$io->{NAME} FS10_set: $name: hc=$housecode ebeneHL=$ebeneh $ebenel setstate=$setstate"; - - for my $i (1..$iNum) { - if ($i == 1) { - $kc = $fs10_c2b{$setstate."_1"}; - } - else { - $kc = $fs10_c2b{$setstate."_2"}; - } - $kc = $kc & 7; - if (defined($kc)) { - Log3 $name, 4, "$io->{NAME} FS10_set: $name $i. setstate=$setstate kc=$kc"; - - my $newmsg = "P61#0000000000001"; # 12 Bit Praeambel, 1 Pruefbit - - $newmsg .= dec2nibble($kc); # 1. setstate - $sum += $kc; - - $newmsg .= dec2nibble($ebenel); # 2. Ebene low - $sum += $ebenel; - - $newmsg .= dec2nibble($ebeneh); # 3. Ebene high - $sum += $ebeneh; - - $newmsg .= "10001"; # 4. unused - - $newmsg .= dec2nibble($housecode); # 5. housecode - $sum += $housecode; - - if ($sum >= 11) { # 6. Summe - $temp = 18 - $sum; - } else { - $temp = 10 - $sum; - } - $newmsg .= dec2nibble($temp); - - $newmsg .= "#R" . $SignalRepeats; - - IOWrite($hash, 'sendMsg', $newmsg); - - Log3 $name, 4, "$io->{NAME} FS10_set: $i.sendMsg=$newmsg"; - - #if ($i < $iNum) { - # IOWrite($hash, 'raw', 'SR;R=1;P0=-32000;D=0000;') - #} - } - } - - ########################################### - # Set the state of a device to off if on-for-timer is called - if($modules{FS10}{ldata}{$name}) { - CommandDelete(undef, $name . "_timer"); - delete $modules{FS10}{ldata}{$name}; - } - - #################################### - # following timers - if ($setstate eq "on" && AttrVal($name, "follow-on-for-timer", 0)) { - my $dur = AttrVal($name, "follow-on-timer", 0); - if ($dur > 0) { - my $newState = "off"; - my $to = sprintf("%02d:%02d:%02d", $dur/3600, ($dur%3600)/60, $dur%60); - Log3 $name, 3, "$io->{NAME} FS10_set: $name Set_Follow +$to setstate $newState"; - CommandDefine(undef, $name."_timer at +$to "."setstate $name $newState; trigger $name $newState"); - $modules{FS10}{ldata}{$name} = $to; - } - } - - readingsBeginUpdate($hash); - readingsBulkUpdate($hash, "state", $setstate); - readingsEndUpdate($hash, 1); # Notify is done by Dispatch - - return $ret; +sub Attr { + my ( $cmd, $name, $attrName, $attrValue ) = @_; + # $cmd - Vorgangsart, kann die Werte "del" (loeschen) oder "set" (setzen) annehmen + # $name - Geraetename + # $attrName - Attribut-Name + # $attrValue - Attribut-Wert + + if ($cmd eq 'set') { + if ($attrName eq 'repetition') { + if ($attrValue !~ m/^[1-9]$/xms) { return "$name: Unallowed value $attrValue for the attribute repetition (must be 1 - 9)!" }; + } + } + return; } -############################# -sub -FS10_Define($$) -{ - my ($hash, $def) = @_; - my @a = split("[ \t][ \t]*", $def); - - my $u = "wrong syntax: define FS10 housecode_button"; - - return $u if(int(@a) < 3); - - my ($housecode, $btncode) = split("_", $a[2], 2); - - return "Define $a[0]: wrong syntax: housecode_button" - if (!defined($housecode) || !defined($btncode)); - - return "Define $a[0]: wrong housecode format: specify a 1 digit value [1-8]" - if ($housecode !~ m/^[1-8]$/i ); - - return "Define $a[0]: wrong button format: specify a 2 digit value [0-7]" - if ($btncode !~ m/^[0-7]{2}$/i ); # Ebene Low, Ebene High - - $hash->{HC} = $housecode; - $hash->{BTN} = $btncode; - - #my $name = $a[0]; - $hash->{CODE} = $a[2]; - #$hash->{lastMSG} = ""; - $modules{FS10}{defptr}{$a[2]} = $hash; - - AssignIoPort($hash); +sub Set { + my ($hash, $name, @a) = @_; + my $ioname = $hash->{IODev}{NAME}; + my $ret = undef; + my $na = int @a; # Anzahl in Array + + return 'no set value specified' if ($na < 1); # if ($na < 2 || $na > 3); + return "Dummydevice $hash->{NAME}: will not set data" if (IsDummy($hash->{NAME})); + + my $model = AttrVal($name, 'model', 'FS10_ST'); + my $modelType = $models{$model}; + my $alias = AttrVal($name, 'alias', q{}); + my $list; + if ($modelType ne 'remote') { $list .= 'off:noArg on:noArg ' }; + if ($modelType eq 'dimmer' ) { $list .= 'dimup:1,2,3,4,5,6,7,8,9,10 dimdown:1,2,3,4,5,6,7,8,9,10 ' }; + + return SetExtensions($hash, $list, $name, @a) if ( $a[0] eq q{?} ); + return SetExtensions($hash, $list, $name, @a) if ( !grep { /^\Q$a[0]\E($|:)/xms } split q{ } , $list ); + + my $setstate = $a[0]; + my $ebeneh = substr $hash->{BTN}, 0, 1; + my $ebenel = substr $hash->{BTN}, 1, 1; + my $housecode = $hash->{HC} - 1; + my $kc; + my $SignalRepeats = AttrVal($name,'repetition', '0') + 1; + my $dimm = 0; + my $newmsg = 'P61#'; + + if ($model eq 'FS10_MS') { + $SignalRepeats = 1; + } + + if ($SignalRepeats > 10) { + $SignalRepeats = 10; + } + + if ($na > 1 && $setstate =~ m/dim/xms) { # Anzahl dimup / dimdown + $dimm += $a[1]; + if ($dimm < 1 || $dimm > 10) { + Log3 $name, 1, "$ioname: FS10 set $name $setstate $dimm - ERROR dimm value too low or high (1-10)"; + return "FS10 set $name $setstate $dimm - ERROR: dimm value too low or high (1-10)"; + } else { + Log3 $name, 3, "$ioname: FS10 set $name $setstate $dimm $alias"; + } + } else { + Log3 $name, 3, "$ioname: FS10 set $name $setstate $alias"; + } + Log3 $name, 5, "$ioname: FS10 set $name hc=$housecode ebeneHL=$ebeneh$ebenel setstate=$setstate"; + + for my $i (1..2) { + my $sum = 0; + $kc = $fs10_c2b{$setstate . '_' . $i}; + $kc = $kc & 7; + if (defined $kc) { + Log3 $name, 5, "$ioname: FS10 set $name setstate$i=$setstate command=$kc"; + $newmsg .= '0000000000001'; # 12 Bit Praeambel, 1 Pruefbit + $newmsg .= dec2nibble($kc); # 1. setstate + $sum += $kc; + $newmsg .= dec2nibble($ebenel); # 2. Ebene low + $sum += $ebenel; + $newmsg .= dec2nibble($ebeneh); # 3. Ebene high + $sum += $ebeneh; + $newmsg .= '10001'; # 4. unused + $newmsg .= dec2nibble($housecode); # 5. housecode + $sum += $housecode; + $sum = (10 - $sum) & 7; + $newmsg .= dec2nibble($sum); # 6. Summe + if ($dimm == 0) { # ein / aus + if ($i == 1) { # 1. Teil Nachricht + $newmsg .= 'PPP'; # 3*32400=97200 Pause + } else { # 2. Teil Nachricht + if ($SignalRepeats == 1) { + $newmsg .= '#R1'; # 1 Repeat + } else { + $newmsg .= 'PPPPPP#R' . $SignalRepeats; # 6*32400=194400 Pause . Repeats + } + } + } else { # dimmen + if ($i == 1) { # 1. Nachricht + $newmsg .= 'PPPPPPPPPPPPPPPP'; # 16*32400=518400 Pause . 1 Repeat (original remote control) + if ($dimm >= 2) { + $newmsg .= '#R1'; + IOWrite($hash, 'sendMsg', $newmsg); + Log3 $name, 5, "$ioname: FS10 set dimm $dimm, 1. sendMsg=$newmsg"; + $newmsg = 'P61#'; # Reset newmsg fuer 2. Nachricht + } + } else { # 2. Nachricht + if ($dimm == 1) { + $newmsg .= '#R1'; # 1 Repeat + } else { + $newmsg .= 'PPPPPP#R' . $dimm; # 6*32400=194400 Pause . Repeats + Log3 $name, 5, "$ioname: FS10 set dimm $dimm, 2. sendMsg=$newmsg"; + } + } + } + if ($i == 2) { # 2. Nachricht + Log3 $name, 5, "$ioname: FS10 set sendMsg=$newmsg"; + IOWrite($hash, 'sendMsg', $newmsg); + } + } + } + + # Set the state of a device to off if on-for-timer is called + if ($modules{FS10}{ldata}{$name}) { + CommandDelete(undef, $name . '_timer'); + delete $modules{FS10}{ldata}{$name}; + } + + # following timers + if ($setstate eq 'on' && AttrVal($name, 'follow-on-for-timer', 0)) { + my $dur = AttrVal($name, 'follow-on-timer', 0); + if ($dur > 0) { + my $newState = 'off'; + my $to = sprintf '%02d:%02d:%02d', $dur/3600, ($dur%3600)/60, $dur%60; + Log3 $name, 3, "$ioname: FS10_set $name Set_Follow +$to setstate $newState"; + CommandDefine(undef, $name."_timer at +$to "."setstate $name $newState; trigger $name $newState"); + $modules{FS10}{ldata}{$name} = $to; + } + } + + readingsSingleUpdate($hash, 'state', $setstate, 1); + return $ret; } -############################# -sub -FS10_Undef($$) -{ - my ($hash, $name) = @_; - delete($modules{FS10}{defptr}{$hash->{CODE}}) - if(defined($hash->{CODE}) && - defined($modules{FS10}{defptr}{$hash->{CODE}})); - return undef; +sub Define { + # define FS10 _