From de4bb682523dffea38f3109d69a888e946c1e806 Mon Sep 17 00:00:00 2001 From: HomeAuto_User <> Date: Tue, 20 Aug 2019 17:11:29 +0000 Subject: [PATCH] 14_SD_UT.pm: added new model OR28V & fixed RC_10 git-svn-id: https://svn.fhem.de/fhem/trunk@20031 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 1 + fhem/FHEM/14_SD_UT.pm | 148 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 139 insertions(+), 10 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index e43dd1af2..4a4a0260c 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 14_SD_UT: added new model OR28V & fixed RC_10 - feature: 70_ZoneMinder: added cause and notes to alerts. Credits to Obi - bugfix: 73_NUKIBridge: fix "Can't use stringas a HASH ref while strict refs in use" diff --git a/fhem/FHEM/14_SD_UT.pm b/fhem/FHEM/14_SD_UT.pm index f15183280..ee1ab47a5 100644 --- a/fhem/FHEM/14_SD_UT.pm +++ b/fhem/FHEM/14_SD_UT.pm @@ -138,7 +138,7 @@ # MU;P0=-15770;P1=2075;P2=-264;P3=326;P4=-2016;P5=948;D=012121234121234341212121234341234343012125;CP=3;R=208; #} ############################################################################################################################################################################### -# - Chilitec Großhandel 22640 - LED Christbaumkerzen mit Fernbedienung +# - Chilitec Großhandel 22640 - LED Christbaumkerzen mit Fernbedienung [Protocol 14] #{ Taste -: AA802 0010 brightness_minus # Taste Aus: AA804 0100 power_off # Taste FL: AA806 0110 flickering_fast @@ -205,7 +205,7 @@ # get sduino_dummy raw MU;;P1=-419;;P2=380;;P3=-810;;P5=767;;P6=-3912;;P7=-32001;;D=262323232323232151532321515151515321532323232323215321515153232151515153232;;CP=2;;R=0;; #} ############################################################################################################################################################################### -# - Manax | MX-RCS270 , Typ: RCS-10 | MX-RCS250 / mumbi | m-FS300 [Protocol 90] and [additionally Protocol 93] - [ONLY receive !!!] +# - Manax | MX-RCS270 , Typ: RCS-10 | MX-RCS250 / mumbi | m-FS300 [Protocol 90] and [additionally Protocol 93] #{ Manax https://forum.fhem.de/index.php/topic,94327.0.html remote MANAX MX-RCS250 # # i ident | b button | ? unknown @@ -243,8 +243,8 @@ #{ https://github.com/RFD-FHEM/RFFHEM/issues/449 #} ############################################################################################################################################################################### -# Techmar / Garden Lights Fernbedienung, 6148011 Remote control + 12V Outdoor receiver -# https://github.com/RFD-FHEM/RFFHEM/issues/558 @BlackcatSandy +# Techmar / Garden Lights Fernbedienung, 6148011 Remote control + 12V Outdoor receiver [Protocol 95] +#{ https://github.com/RFD-FHEM/RFFHEM/issues/558 @BlackcatSandy # Fernbedienung mit 10 Tasten, 9 Gruppentasten und 1 Master # gesamt 50 Bit, Bit 0-31 Ident, Bit 32-39 Button, Bit 40-47 = Bit 32-39 invertiert, Bit 48-49 wechselt 00|01|02 # Die letzten beiden Bits wechseln bei der Fernbedienung zwischen 00, 01 oder 02. Der Empfänger reagiert aber auch, wenn nur 00 gesendet wird. @@ -253,6 +253,15 @@ # Group_1_on: MU;P0=-972;P1=526;P2=-335;P3=-666;D=01213131312131313121212121312121313131313121312131313121313131312121212121312121313131313121313121212101213131312131313121212121312121313131313121312131313121313131312121212121312121313131313121313121212101213131312131313121212121312121313131313121312131;CP=1;R=44;O; # Group_5_on: MU;P0=-651;P1=530;P2=-345;P3=-969;D=01212121312101010121010101212121210121210101010101210121010101210101010121212121012121210101010121010101212101312101010121010101212121210121210101010101210121010101210101010121212121012121210101010121010101212121312101010121010101212121210121210101010101;CP=1;R=24;O; # Group_8_off: MU;P0=538;P1=-329;P2=-653;P3=-964;D=01020301020202010202020101010102010102020202020102010202020102020202010101010101010201020202020202010202010301020202010202020101010102010102020202020102010202020102020202010101010101010201020202020202010201010301020202010202020101010102010102020202020102;CP=0;R=19;O; +#} +############################################################################################################################################################################### +# - Medion OR28V RF Vista Remote Control (Made in china by X10) [Protocol 68] +#{ !! sendet zwei verschiedene Codes pro Taste (ausser power) !! +# Taste ok MS;P1=-1746;P2=513;P3=-571;P4=-4612;P5=2801;D=24512321212123232121212323212121212323232323;CP=2;SP=4;R=58;#;#; +# Taste ok MS;P1=-1712;P2=518;P3=-544;P4=-4586;P5=2807;D=24512121212123232121232323212121212323232323;CP=2;SP=4;R=58;m2;#;#; +# Taste Vol+ MS;P1=-1620;P2=580;P3=-549;P4=-4561;P5=2812;D=24512121212323232323232323232123212123232323;CP=2;SP=4;R=69;O;m2;#;#; +# Taste Vol+ MS;P1=-1645;P2=574;P3=-535;P4=-4556;P5=2811;D=24512321212323232323212323232123212123232323;CP=2;SP=4;R=57;m2;#;#; +#} ############################################################################################################################################################################### # !!! ToDo´s !!! # - LED lights, counter battery-h reading --> commandref hour_counter module @@ -318,6 +327,55 @@ my %models = ( hex_lengh => "8", Typ => "remote" }, + "OR28V" => { "000000" => "volume_mute", + "000010" => "power", + "000100" => "tv_guide", + "001000" => "volume_minus", + "001001" => "volume_plus", + "001011" => "channel_plus", + "001100" => "channel_minus", + "001101" => "1", + "001110" => "2", + "001111" => "3", + "010000" => "4", + "010001" => "5", + "010010" => "6", + "010011" => "7", + "010100" => "8", + "010101" => "9", + "010110" => "T", + "010111" => "0", + "011000" => "tv_record", + "011010" => "arrow_up", + "011011" => "menu", + "011100" => "tv_play", + "011101" => "arrow_left", + "011110" => "ok", + "011111" => "arrow_right", + "100000" => "back", + "100001" => "video_back", + "100010" => "arrow_down", + "100011" => "video_forward", + "100100" => "video_rewind", + "100101" => "video_play", + "100110" => "video_fastforward", + "100111" => "video_record", + "101000" => "video_stop", + "101001" => "video_pause", + "101111" => "info", + "110000" => "clear", + "110001" => "tv_list", + "110010" => "color_red", + "110011" => "color_green", + "110100" => "color_yellow", + "110101" => "color_blue", + "110110" => "enter", + "110111" => "*", + "111000" => "#", + Protocol => "P68", + hex_lengh => "5", + Typ => "remote" + }, "Novy_840029" => { "0100" => "novy", "0101" => "speed_plus", "0110" => "speed_minus", @@ -515,7 +573,7 @@ my %models = ( ############################# sub SD_UT_Initialize($) { my ($hash) = @_; - $hash->{Match} = "^P(?:14|29|30|34|46|69|76|81|83|86|90|91|91.1|92|93|95)#.*"; + $hash->{Match} = "^P(?:14|29|30|34|46|68|69|76|81|83|86|90|91|91.1|92|93|95)#.*"; $hash->{DefFn} = "SD_UT_Define"; $hash->{UndefFn} = "SD_UT_Undef"; $hash->{ParseFn} = "SD_UT_Parse"; @@ -527,6 +585,7 @@ sub SD_UT_Initialize($) { "MD_2003R.*" => {ATTR => "model:MD_2003R", FILTER => "%NAME", autocreateThreshold => "3:180", GPLOT => ""}, "MD_210R.*" => {ATTR => "model:MD_210R", FILTER => "%NAME", autocreateThreshold => "3:180", GPLOT => ""}, "MD_2018R.*" => {ATTR => "model:MD_2018R", FILTER => "%NAME", autocreateThreshold => "3:180", GPLOT => ""}, + "OR28V.*" => {ATTR => "model:OR28V", FILTER => "%NAME", autocreateThreshold => "3:180", GPLOT => ""}, "Techmar.*" => {ATTR => "model:Techmar", FILTER => "%NAME", autocreateThreshold => "3:180", GPLOT => ""}, "unknown_please_select_model" => {ATTR => "model:unknown", FILTER => "%NAME", autocreateThreshold => "5:180", GPLOT => ""}, }; @@ -553,6 +612,16 @@ sub SD_UT_Define($$) { } } + ### checks Medion OR28V ### + if ($a[2] eq "OR28V") { + if (length($a[3]) > 2) { + return "wrong Value! $a[2] must be an number between 1 - 16"; + } + if ($a[3] < 1 || $a[3] > 16) { + return "wrong address! ($a[3]) $a[2] must be an number between 1 - 16"; + } + } + ### [2] checks CAME_TOP_432EV & Novy_840029 & Unitec_47031 & TR_502MSV ### if (($a[2] eq "CAME_TOP_432EV" || $a[2] eq "Novy_840029" || $a[2] eq "Unitec_47031" || $a[2] eq "TR_502MSV") && not $a[3] =~ /^[0-9a-fA-F]{2}/s) { return "wrong HEX-Value! ($a[3]) $a[2] HEX-Value to short | long or not HEX (0-9 | a-f | A-F){2}"; @@ -741,6 +810,10 @@ sub SD_UT_Set($$$@) { $msg = $models{$model}{Protocol} . "#" . $adr; $msgEnd = "00#R" . $repeats; # Last two bits alternately by transmitter 00, 01 or 02. Receiver also reacts to only 00. + ############ Medion OR28V ############ + } elsif ($model eq "OR28V" && $cmd ne "?") { + $msg = $models{$model}{Protocol} . "#"; + $msgEnd .= "#R" . $repeats; # R1 wird vom SIGNALduino nicht als MS erkannt! } Log3 $name, 4, "$ioname: SD_UT_Set attr_model=$model msg=$msg msgEnd=$msgEnd" if(defined $msgEnd); @@ -763,6 +836,7 @@ sub SD_UT_Set($$$@) { } } + ############ KL_RF01 ############ if ($model eq "KL_RF01") { my $save2 = $save; $save2 =~ tr/01/10/; # invert message (nibble6 invert = nibble4) @@ -771,6 +845,33 @@ sub SD_UT_Set($$$@) { my $invert = $save; $invert =~ tr/01/10/; # invert byte 4 (byte5 = inverted byte 4) $msg .= $save.$invert.$msgEnd; + ############ Medion OR28V ############ + } elsif ($model eq "OR28V") { + my @definition = split(" ", $hash->{DEF}); # split adress from def + my $adr = $definition[1] - 1; # argument 1 - adress + my $checksum = ($adr * 16 + oct("0b$save") + 85) & 0x7f; + my $laststate = ReadingsVal($name, "state", "fehlt"); + my $lastbit0 = ReadingsVal($name, "bit0", "fehlt"); + Log3 $name, 5, "$ioname: SD_UT_Set $name ReadingsVal lastbit0=$lastbit0"; + my $bit0 = "0"; # bit 0 first press a new button + if ($cmd eq $laststate && $cmd ne "power") { + $bit0 = $lastbit0 eq "0" ? "1" : "0"; # toggle bit 0 when press the same button again + } + $bit0 = "1" if ($cmd eq "power"); # bit 0 always 1 by button power + Log3 $name, 5, "$ioname: SD_UT_Set $name ReadingsVal laststate=$laststate cmd=$cmd bit0=$bit0"; + $msg .= $bit0; # bit 0 + $msg .= sprintf ("%07b",$checksum); # bit 1-7 + if (oct("0b$save") > 42) { # button + $msg .= $bit0; # bit 8 = bit 0 + } else { + $msg .= $bit0 eq "0" ? "1" : "0"; # bit 8 = bit 0 inverted + } + $msg .= "0"; # bit 9 always zero + $msg .= $save; # bit 10-15 + $msg .= sprintf ("%04b",$adr); # bit 16-19 + $msg .= $msgEnd; + Log3 $name, 5, "$ioname: SD_UT_Set $name msg=$msg checksum=$checksum"; + readingsSingleUpdate($hash, "bit0" , $bit0, 0); } else { $msg .= $save.$msgEnd; } @@ -918,6 +1019,21 @@ sub SD_UT_Parse($$) { $devicedef = "Tedsen_SKX6xx " . $deviceCode if (!$def); $def = $modules{SD_UT}{defptr}{$devicedef} if (!$def); } + ### OR28V [P68] ### + if ($protocol == 68) { + my $check = (oct( "0b".substr($bitData,9,7) ) + oct( "0b".substr($bitData,16,4)."0000" ) + 85) & 0x7f; + if ($check != oct( "0b".substr($bitData,1,7))) { + Log3 $iohash, 3, "$ioname: SD_UT_Parse device OR28V - checksum - ERROR (rawData:$rawData)"; + return ""; + } else { + Log3 $iohash, 4, "$ioname: SD_UT_Parse device OR28V check length & Protocol OK"; + $deviceCode = oct(substr($rawData,4,1)) + 1; + $devicedef = "OR28V " . $deviceCode; + $def = $modules{SD_UT}{defptr}{$devicedef}; + $model = "OR28V"; + $name = $model."_" . $deviceCode; + } + } ### NEFF SF01_01319004 || BOSCH SF01_01319004_Typ2 [P86] ### if (!$def && $protocol == 86) { $deviceCode = substr($bitData,0,14) . "00"; @@ -937,7 +1053,7 @@ sub SD_UT_Parse($$) { } if ($hlen == 9) { - if (!$def && ($protocol == 91 || $protocol == 91.1)) { + if ($protocol == 91 || $protocol == 91.1) { ### Atlantic Security with all models [P91] or [P91.1 ] with CHECK ### Log3 $iohash, 4, "$ioname: SD_UT device MD_210R check length & Protocol OK"; my @array_rawData = split("",$rawData); @@ -1000,6 +1116,12 @@ sub SD_UT_Parse($$) { $state = "unknown"; $def = undef; } + + ### if receive device _all, set A | B | C | D ### + readingsSingleUpdate($defs{"RC_10_" . $deviceCode ."_A"}, "state" , $state , 1) if (defined $defs{"RC_10_" . $deviceCode ."_A"}); + readingsSingleUpdate($defs{"RC_10_" . $deviceCode ."_B"}, "state" , $state , 1) if (defined $defs{"RC_10_" . $deviceCode ."_B"}); + readingsSingleUpdate($defs{"RC_10_" . $deviceCode ."_C"}, "state" , $state , 1) if (defined $defs{"RC_10_" . $deviceCode ."_C"}); + readingsSingleUpdate($defs{"RC_10_" . $deviceCode ."_D"}, "state" , $state , 1) if (defined $defs{"RC_10_" . $deviceCode ."_D"}); } Log3 $iohash, 4, "$ioname: SD_UT device - RC_10 devicedef: $devicedef"; Log3 $iohash, 4, "$ioname: SD_UT device - RC_10 button: $button | state: $state"; @@ -1177,6 +1299,10 @@ sub SD_UT_Parse($$) { $state = substr($bitData,14,4); $deviceCode = substr($bitData,0,14) . "00" if ($blen >= 14); $deviceCode = sprintf("%X", oct( "0b$deviceCode" ) ); + ############ Medion OR28V ############ Protocol 68 ############ + } elsif ($model eq "OR28V" && $protocol == 68) { + $state = substr($bitData,10,6); + $deviceCode = substr($rawData,4,1); ############ Hoermann HS1-868-BS ############ Protocol 69 ############ } elsif ($model eq "HS1_868_BS" && $protocol == 69) { $state = "receive"; @@ -1541,6 +1667,7 @@ sub SD_UT_tristate2bin($) {