30_DUOFERN.pm 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802
  1. ##############################################
  2. # $Id: 30_DUOFERN.pm 16313 2018-03-02 18:48:54Z Telekatz $
  3. package main;
  4. use strict;
  5. use warnings;
  6. use SetExtensions;
  7. my %devices = (
  8. "40" => {"name" => "RolloTron Standard" },
  9. "41" => {"name" => "RolloTron Comfort Slave" },
  10. "42" => {"name" => "Rohrmotor-Aktor" },
  11. "43" => {"name" => "Universalaktor", "chans" => ["01", "02"] },
  12. "46" => {"name" => "Steckdosenaktor" },
  13. "47" => {"name" => "Rohrmotor Steuerung", "format" => "23a"},
  14. "48" => {"name" => "Dimmaktor" },
  15. "49" => {"name" => "Rohrmotor" },
  16. "4B" => {"name" => "Connect-Aktor" },
  17. "4C" => {"name" => "Troll Basis" },
  18. "4E" => {"name" => "SX5", "format" => "24a"},
  19. "61" => {"name" => "RolloTron Comfort Master" },
  20. "62" => {"name" => "Super Fake Device" },
  21. "65" => {"name" => "Bewegungsmelder", "chans" => ["01"]},
  22. "69" => {"name" => "Umweltsensor", "format" => "23a", "chans" => ["01"]},
  23. "70" => {"name" => "Troll Comfort DuoFern" },
  24. "71" => {"name" => "Troll Comfort DuoFern (Lichtmodus)"},
  25. "73" => {"name" => "Raumthermostat" },
  26. "74" => {"name" => "Wandtaster 6fach 230V", "chans" => ["01"]},
  27. "A0" => {"name" => "Handsender (6 Gruppen-48 Geraete)" },
  28. "A1" => {"name" => "Handsender (1 Gruppe-48 Geraete)" },
  29. "A2" => {"name" => "Handsender (6 Gruppen-1 Geraet)" },
  30. "A3" => {"name" => "Handsender (1 Gruppe-1 Geraet)" },
  31. "A4" => {"name" => "Wandtaster" },
  32. "A5" => {"name" => "Sonnensensor" },
  33. "A7" => {"name" => "Funksender UP" },
  34. "A8" => {"name" => "HomeTimer" },
  35. "AA" => {"name" => "Markisenwaechter" },
  36. "AB" => {"name" => "Rauchmelder" },
  37. "AD" => {"name" => "Wandtaster 6fach Bat" },
  38. "E0" => {"name" => "Handzentrale" },
  39. );
  40. my %sensorMsg = (
  41. "0701" => {"name" => "up", "chan" => 6, "state" => "Btn01"},
  42. "0702" => {"name" => "stop", "chan" => 6, "state" => "Btn02"},
  43. "0703" => {"name" => "down", "chan" => 6, "state" => "Btn03"},
  44. "0718" => {"name" => "stepUp", "chan" => 6, "state" => "Btn18"},
  45. "0719" => {"name" => "stepDown", "chan" => 6, "state" => "Btn19"},
  46. "071A" => {"name" => "pressed", "chan" => 6, "state" => "Btn1A"},
  47. "0713" => {"name" => "dawn", "chan" => 5, "state" => "dawn"},
  48. "0709" => {"name" => "dusk", "chan" => 5, "state" => "dusk"},
  49. "0708" => {"name" => "startSun", "chan" => 5, "state" => "on"},
  50. "070A" => {"name" => "endSun", "chan" => 5, "state" => "off"},
  51. "070D" => {"name" => "startWind", "chan" => 5, "state" => "on"},
  52. "070E" => {"name" => "endWind", "chan" => 5, "state" => "off"},
  53. "0711" => {"name" => "startRain", "chan" => 5, "state" => "on"},
  54. "0712" => {"name" => "endRain", "chan" => 5, "state" => "off"},
  55. "071C" => {"name" => "startTemp", "chan" => 5, "state" => "on"},
  56. "071D" => {"name" => "endTemp", "chan" => 5, "state" => "off"},
  57. "071E" => {"name" => "startSmoke", "chan" => 5, "state" => "on"},
  58. "071F" => {"name" => "endSmoke", "chan" => 5, "state" => "off"},
  59. "0720" => {"name" => "startMotion", "chan" => 5, "state" => "on"},
  60. "0721" => {"name" => "endMotion", "chan" => 5, "state" => "off"},
  61. "0723" => {"name" => "closeEnd", "chan" => 5, "state" => "off"},
  62. "0724" => {"name" => "closeStart", "chan" => 5, "state" => "on"},
  63. "0E01" => {"name" => "off", "chan" => 6, "state" => "Btn01"},
  64. "0E02" => {"name" => "off", "chan" => 6, "state" => "Btn02"},
  65. "0E03" => {"name" => "on", "chan" => 6, "state" => "Btn03"},
  66. );
  67. my %statusGroups = (
  68. "21" => [100,101,102,104,105,106,111,112,113,114,50],
  69. "22" => [1,2,3,4,5,6,7,8,9,10],
  70. "23" => [102,107,109,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,140,141,50],
  71. "23a" => [102,107,109,115,116,117,118,119,120,121,122,123,124,125,126,127,133,140,141,50],
  72. "24" => [102,107,115,116,117,118,119,120,121,122,123,124,125,126,127,140,141,400,402,50],
  73. "24a" => [102,107,115,123,124,400,402,404,405,406,407,408,409,410,411,50],
  74. "25" => [300,301,302,303,304,305,306,307,308,309,310,311,312,313],
  75. "26" => [],
  76. "27" => [160,161,162,163,164,165,166,167,168,169,170,171],
  77. );
  78. my %statusMapping = (
  79. "onOff" => ["off", "on"],
  80. "upDown" => ["up", "down"],
  81. "moving" => ["stop","stop"],
  82. "motor" => ["off", "short(160ms)", "long(480ms)", "individual"],
  83. "closeT" => ["off", "30", "60", "90", "120", "150", "180", "210", "240"],
  84. "openS" => ["error", "11", "15", "19"],
  85. "scale10" => [10,0],
  86. "scaleF1" => [2,80],
  87. "scaleF2" => [10,400],
  88. );
  89. my %statusIds = (
  90. 1 => {"name" => "level", "chan" => { "01" => {"position" => 7, "from" => 0, "to" => 6},
  91. "02" => {"position" => 6, "from" => 0, "to" => 6}}},
  92. 2 => {"name" => "timeAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 0, "to" => 0},
  93. "02" => {"position" => 2, "from" => 0, "to" => 0}}},
  94. 3 => {"name" => "duskAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 1, "to" => 1},
  95. "02" => {"position" => 2, "from" => 1, "to" => 1}}},
  96. 4 => {"name" => "dawnAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 6, "to" => 6},
  97. "02" => {"position" => 2, "from" => 6, "to" => 6}}},
  98. 5 => {"name" => "sunAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 2, "to" => 2},
  99. "02" => {"position" => 2, "from" => 2, "to" => 2}}},
  100. 6 => {"name" => "manualMode", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 5, "to" => 5},
  101. "02" => {"position" => 2, "from" => 5, "to" => 5}}},
  102. 7 => {"name" => "modeChange", "map" => "onOff", "chan" => { "01" => {"position" => 7, "from" => 7, "to" => 7},
  103. "02" => {"position" => 6, "from" => 7, "to" => 7}}},
  104. 8 => {"name" => "sunMode", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 4, "to" => 4},
  105. "02" => {"position" => 2, "from" => 4, "to" => 4}}},
  106. 9 => {"name" => "stairwellFunction", "map" => "onOff", "chan" => { "01" => {"position" => 4, "from" => 7, "to" => 7},
  107. "02" => {"position" => 0, "from" => 7, "to" => 7}}},
  108. 10 => {"name" => "stairwellTime", "map" => "scale10", "chan" => { "01" => {"position" => 5, "from" => 0, "to" => 14},
  109. "02" => {"position" => 1, "from" => 0, "to" => 14}}},
  110. 50 => {"name" => "moving", "map" => "moving", "chan" => { "01" => {"position" => 0, "from" => 0, "to" => 0},
  111. "02" => {"position" => 0, "from" => 0, "to" => 0}}},
  112. 100 => {"name" => "sunAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 0, "from" => 2, "to" => 2}}},
  113. 101 => {"name" => "timeAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 0, "from" => 0, "to" => 0}}},
  114. 102 => {"name" => "position", "invert" => 100, "chan" => { "01" => {"position" => 7, "from" => 0, "to" => 6}}},
  115. 104 => {"name" => "duskAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 0, "from" => 3, "to" => 3}}},
  116. 105 => {"name" => "dawnAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 1, "from" => 3, "to" => 3}}},
  117. 106 => {"name" => "manualMode", "map" => "onOff", "chan" => { "01" => {"position" => 0, "from" => 7, "to" => 7}}},
  118. 107 => {"name" => "manualMode", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 5, "to" => 5}}},
  119. 109 => {"name" => "runningTime", "chan" => { "01" => {"position" => 6, "from" => 0, "to" => 7}}},
  120. 111 => {"name" => "sunPosition", "invert" => 100, "chan" => { "01" => {"position" => 6, "from" => 0, "to" => 6}}},
  121. 112 => {"name" => "ventilatingPosition", "invert" => 100, "chan" => { "01" => {"position" => 2, "from" => 0, "to" => 6}}},
  122. 113 => {"name" => "ventilatingMode", "map" => "onOff", "chan" => { "01" => {"position" => 2, "from" => 7, "to" => 7}}},
  123. 114 => {"name" => "sunMode", "map" => "onOff", "chan" => { "01" => {"position" => 6, "from" => 7, "to" => 7}}},
  124. 115 => {"name" => "timeAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 0, "to" => 0}}},
  125. 116 => {"name" => "sunAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 2, "to" => 2}}},
  126. 117 => {"name" => "dawnAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 2, "from" => 1, "to" => 1}}},
  127. 118 => {"name" => "duskAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 1, "to" => 1}}},
  128. 119 => {"name" => "rainAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 7, "to" => 7}}},
  129. 120 => {"name" => "windAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 6, "to" => 6}}},
  130. 121 => {"name" => "sunPosition", "invert" => 100, "chan" => { "01" => {"position" => 5, "from" => 0, "to" => 6}}},
  131. 122 => {"name" => "sunMode", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 4, "to" => 4}}},
  132. 123 => {"name" => "ventilatingPosition", "invert" => 100, "chan" => { "01" => {"position" => 4, "from" => 0, "to" => 6}}},
  133. 124 => {"name" => "ventilatingMode", "map" => "onOff", "chan" => { "01" => {"position" => 4, "from" => 7, "to" => 7}}},
  134. 125 => {"name" => "reversal", "map" => "onOff", "chan" => { "01" => {"position" => 7, "from" => 7, "to" => 7}}},
  135. 126 => {"name" => "rainDirection", "map" => "upDown", "chan" => { "01" => {"position" => 2, "from" => 3, "to" => 3}}},
  136. 127 => {"name" => "windDirection", "map" => "upDown", "chan" => { "01" => {"position" => 2, "from" => 2, "to" => 2}}},
  137. 128 => {"name" => "slatRunTime", "chan" => { "01" => {"position" => 0, "from" => 0, "to" => 5}}},
  138. 129 => {"name" => "tiltAfterMoveLevel", "map" => "onOff", "chan" => { "01" => {"position" => 0, "from" => 6, "to" => 6}}},
  139. 130 => {"name" => "tiltInVentPos", "map" => "onOff", "chan" => { "01" => {"position" => 0, "from" => 7, "to" => 7}}},
  140. 131 => {"name" => "defaultSlatPos", "chan" => { "01" => {"position" => 1, "from" => 0, "to" => 6}}},
  141. 132 => {"name" => "tiltAfterStopDown", "map" => "onOff", "chan" => { "01" => {"position" => 1, "from" => 7, "to" => 7}}},
  142. 133 => {"name" => "motorDeadTime", "map" => "motor", "chan" => { "01" => {"position" => 2, "from" => 4, "to" => 5}}},
  143. 134 => {"name" => "tiltInSunPos", "map" => "onOff", "chan" => { "01" => {"position" => 5, "from" => 7, "to" => 7}}},
  144. 135 => {"name" => "slatPosition", "chan" => { "01" => {"position" => 9, "from" => 0, "to" => 6}}},
  145. 136 => {"name" => "blindsMode", "map" => "onOff", "chan" => { "01" => {"position" => 9, "from" => 7, "to" => 7}}},
  146. 140 => {"name" => "windMode", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 3, "to" => 3}}},
  147. 141 => {"name" => "rainMode", "map" => "onOff", "chan" => { "01" => {"position" => 2, "from" => 0, "to" => 0}}},
  148. 160 => {"name" => "temperatureThreshold1","map" => "scaleF1", "chan" => { "01" => {"position" => 4, "from" => 0, "to" => 7}}},
  149. 161 => {"name" => "temperatureThreshold2","map" => "scaleF1", "chan" => { "01" => {"position" => 5, "from" => 0, "to" => 7}}},
  150. 162 => {"name" => "temperatureThreshold3","map" => "scaleF1", "chan" => { "01" => {"position" => 6, "from" => 0, "to" => 7}}},
  151. 163 => {"name" => "temperatureThreshold4","map" => "scaleF1", "chan" => { "01" => {"position" => 7, "from" => 0, "to" => 7}}},
  152. 164 => {"name" => "desired-temp", "map" => "scaleF1", "chan" => { "01" => {"position" => 9, "from" => 0, "to" => 7}}},
  153. 165 => {"name" => "measured-temp", "map" => "scaleF2", "chan" => { "01" => {"position" => 1, "from" => 0, "to" => 10}}},
  154. 166 => {"name" => "output", "map" => "onOff", "chan" => { "01" => {"position" => 0, "from" => 3, "to" => 3}}},
  155. 167 => {"name" => "manualOverride", "map" => "onOff", "chan" => { "01" => {"position" => 0, "from" => 4, "to" => 4}}},
  156. 168 => {"name" => "actTempLimit", "chan" => { "01" => {"position" => 0, "from" => 5, "to" => 6}}},
  157. 169 => {"name" => "timeAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 2, "from" => 3, "to" => 3}}},
  158. 170 => {"name" => "manualMode", "map" => "onOff", "chan" => { "01" => {"position" => 2, "from" => 4, "to" => 4}}},
  159. 171 => {"name" => "measured-temp2", "map" => "scaleF2", "chan" => { "01" => {"position" => 3, "from" => 0, "to" => 10}}},
  160. 300 => {"name" => "level", "chan" => { "01" => {"position" => 7, "from" => 0, "to" => 6}}},
  161. 301 => {"name" => "manualMode", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 5, "to" => 5}}},
  162. 302 => {"name" => "timeAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 0, "to" => 0}}},
  163. 303 => {"name" => "duskAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 1, "to" => 1}}},
  164. 304 => {"name" => "sunAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 2, "to" => 2}}},
  165. 305 => {"name" => "sunMode", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 4, "to" => 4}}},
  166. 306 => {"name" => "dawnAutomatic", "map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 6, "to" => 6}}},
  167. 307 => {"name" => "runningTime", "chan" => { "01" => {"position" => 5, "from" => 0, "to" => 7}}},
  168. 308 => {"name" => "intermediateValue", "chan" => { "01" => {"position" => 6, "from" => 0, "to" => 6}}},
  169. 309 => {"name" => "intermediateMode", "map" => "onOff", "chan" => { "01" => {"position" => 6, "from" => 7, "to" => 7}}},
  170. 310 => {"name" => "modeChange", "map" => "onOff", "chan" => { "01" => {"position" => 7, "from" => 7, "to" => 7}}},
  171. 311 => {"name" => "stairwellFunction", "map" => "onOff", "chan" => { "01" => {"position" => 1, "from" => 7, "to" => 7}}},
  172. 312 => {"name" => "stairwellTime", "map" => "scale10", "chan" => { "01" => {"position" => 2, "from" => 0, "to" => 14}}},
  173. 313 => {"name" => "saveIntermediateOnStop","map" => "onOff", "chan" => { "01" => {"position" => 3, "from" => 7, "to" => 7}}},
  174. 400 => {"name" => "obstacle", "chan" => { "01" => {"position" => 2, "from" => 4, "to" => 4}}},
  175. 401 => {"name" => "obstacleDetection", "map" => "onOff", "chan" => { "01" => {"position" => 2, "from" => 5, "to" => 5}}},
  176. 402 => {"name" => "block", "chan" => { "01" => {"position" => 2, "from" => 6, "to" => 6}}},
  177. 403 => {"name" => "blockDetection", "map" => "onOff", "chan" => { "01" => {"position" => 2, "from" => 7, "to" => 7}}},
  178. 404 => {"name" => "lightCurtain", "chan" => { "01" => {"position" => 0, "from" => 7, "to" => 7}}},
  179. 405 => {"name" => "automaticClosing", "map" => "closeT", "chan" => { "01" => {"position" => 1, "from" => 0, "to" => 3}}},
  180. 406 => {"name" => "openSpeed", "map" => "openS", "chan" => { "01" => {"position" => 1, "from" => 4, "to" => 6}}},
  181. 407 => {"name" => "2000cycleAlarm", "map" => "onOff", "chan" => { "01" => {"position" => 1, "from" => 7, "to" => 7}}},
  182. 408 => {"name" => "wicketDoor", "map" => "onOff", "chan" => { "01" => {"position" => 5, "from" => 7, "to" => 7}}},
  183. 409 => {"name" => "backJump", "map" => "onOff", "chan" => { "01" => {"position" => 9, "from" => 0, "to" => 0}}},
  184. 410 => {"name" => "10minuteAlarm", "map" => "onOff", "chan" => { "01" => {"position" => 9, "from" => 1, "to" => 1}}},
  185. 411 => {"name" => "light", "map" => "onOff", "chan" => { "01" => {"position" => 9, "from" => 2, "to" => 2}}},
  186. 999 => {"name" => "version", "chan" => { "01" => {"position" => 8, "from" => 0, "to" => 7},
  187. "02" => {"position" => 8, "from" => 0, "to" => 7}}},
  188. );
  189. my %commands = (
  190. "remotePair" => {"cmd" => {"noArg" => "06010000000000000000"}},
  191. "remoteUnpair" => {"cmd" => {"noArg" => "06020000000000000000"}},
  192. "up" => {"cmd" => {"noArg" => "0701tt00000000000000"}},
  193. "stop" => {"cmd" => {"noArg" => "07020000000000000000"}},
  194. "down" => {"cmd" => {"noArg" => "0703tt00000000000000"}},
  195. "position" => {"cmd" => {"value" => "0707ttnn000000000000"}, "invert" => 100},
  196. "level" => {"cmd" => {"value" => "0707ttnn000000000000"}},
  197. "sunMode" => {"cmd" => {"on" => "070801FF000000000000",
  198. "off" => "070A0100000000000000"}},
  199. "dusk" => {"cmd" => {"noArg" => "070901FF000000000000"}},
  200. "reversal" => {"cmd" => {"noArg" => "070C0000000000000000"}},
  201. "modeChange" => {"cmd" => {"noArg" => "070C0000000000000000"}},
  202. "windMode" => {"cmd" => {"on" => "070D01FF000000000000",
  203. "off" => "070E0100000000000000"}},
  204. "rainMode" => {"cmd" => {"on" => "071101FF000000000000",
  205. "off" => "07120100000000000000"}},
  206. "dawn" => {"cmd" => {"noArg" => "071301FF000000000000"}},
  207. "rainDirection" => {"cmd" => {"down" => "071400FD000000000000",
  208. "up" => "071400FE000000000000"}},
  209. "windDirection" => {"cmd" => {"down" => "071500FD000000000000",
  210. "up" => "071500FE000000000000"}},
  211. "tempUp" => {"cmd" => {"noArg" => "0718tt00000000000000"}},
  212. "tempDown" => {"cmd" => {"noArg" => "0719tt00000000000000"}},
  213. "toggle" => {"cmd" => {"noArg" => "071A0000000000000000"}},
  214. "slatPosition" => {"cmd" => {"value" => "071B00000000nn000000"}},
  215. "desired-temp" => {"cmd" => {"value" => "0722tt0000wwww000000"}, "min" => -40, "max" => 80, "multi" => 10, "offset" => 400 },
  216. "sunAutomatic" => {"cmd" => {"on" => "080100FD000000000000",
  217. "off" => "080100FE000000000000"}},
  218. "sunPosition" => {"cmd" => {"value" => "080100nn000000000000"}, "invert" => 100},
  219. "ventilatingMode" => {"cmd" => {"on" => "080200FD000000000000",
  220. "off" => "080200FE000000000000"}},
  221. "ventilatingPosition" => {"cmd" => {"value" => "080200nn000000000000"}, "invert" => 100},
  222. "intermediateMode" => {"cmd" => {"on" => "080200FD000000000000",
  223. "off" => "080200FE000000000000"}},
  224. "intermediateValue" => {"cmd" => {"value" => "080200nn000000000000"}},
  225. "saveIntermediateOnStop"=>{"cmd" => {"on" => "080200FB000000000000",
  226. "off" => "080200FC000000000000"}},
  227. "runningTime" => {"cmd" => {"value" => "0803nn00000000000000"}, "min" => 0, "max" => 150 },
  228. "timeAutomatic" => {"cmd" => {"on" => "080400FD000000000000",
  229. "off" => "080400FE000000000000"}},
  230. "duskAutomatic" => {"cmd" => {"on" => "080500FD000000000000",
  231. "off" => "080500FE000000000000"}},
  232. "manualMode" => {"cmd" => {"on" => "080600FD000000000000",
  233. "off" => "080600FE000000000000"}},
  234. "windAutomatic" => {"cmd" => {"on" => "080700FD000000000000",
  235. "off" => "080700FE000000000000"}},
  236. "rainAutomatic" => {"cmd" => {"on" => "080800FD000000000000",
  237. "off" => "080800FE000000000000"}},
  238. "dawnAutomatic" => {"cmd" => {"on" => "080900FD000000000000",
  239. "off" => "080900FE000000000000"}},
  240. "tiltInSunPos" => {"cmd" => {"on" => "080C00FD000000000000",
  241. "off" => "080C00FE000000000000"}},
  242. "tiltInVentPos" => {"cmd" => {"on" => "080D00FD000000000000",
  243. "off" => "080D00FE000000000000"}},
  244. "tiltAfterMoveLevel" => {"cmd" => {"on" => "080E00FD000000000000",
  245. "off" => "080E00FE000000000000"}},
  246. "tiltAfterStopDown" => {"cmd" => {"on" => "080F00FD000000000000",
  247. "off" => "080F00FE000000000000"}},
  248. "defaultSlatPos" => {"cmd" => {"value" => "0810nn00000000000000"}},
  249. "blindsMode" => {"cmd" => {"on" => "081100FD000000000000",
  250. "off" => "081100FE000000000000"}},
  251. "slatRunTime" => {"cmd" => {"value" => "0812nn00000000000000"}, "min" => 0, "max" => 50 },
  252. "motorDeadTime" => {"cmd" => {"off" => "08130000000000000000",
  253. "short" => "08130100000000000000",
  254. "long" => "08130200000000000000"}},
  255. "stairwellFunction" => {"cmd" => {"on" => "081400FD000000000000",
  256. "off" => "081400FE000000000000"}},
  257. "stairwellTime" => {"cmd" => {"value" => "08140000wwww00000000"}, "min" => 0, "max" => 3200, "multi" => 10},
  258. "reset" => {"cmd" => {"settings" => "0815CB00000000000000",
  259. "full" => "0815CC00000000000000"}},
  260. "10minuteAlarm" => {"cmd" => {"on" => "081700FD000000000000",
  261. "off" => "081700FE000000000000"}},
  262. "automaticClosing" => {"cmd" => {"off" => "08180000000000000000",
  263. "30" => "08180001000000000000",
  264. "60" => "08180002000000000000",
  265. "90" => "08180003000000000000",
  266. "120" => "08180004000000000000",
  267. "150" => "08180005000000000000",
  268. "180" => "08180006000000000000",
  269. "210" => "08180007000000000000",
  270. "240" => "08180008000000000000"}},
  271. "2000cycleAlarm" => {"cmd" => {"on" => "081900FD000000000000",
  272. "off" => "081900FE000000000000"}},
  273. "openSpeed" => {"cmd" => {"11" => "081A0001000000000000",
  274. "15" => "081A0002000000000000",
  275. "19" => "081A0003000000000000"}},
  276. "backJump" => {"cmd" => {"on" => "081B00FD000000000000",
  277. "off" => "081B00FE000000000000"}},
  278. "temperatureThreshold1"=> {"cmd" => {"value" => "081E00000001nn000000"}, "min" => -40, "max" => 80, "multi" => 2, "offset" => 80 },
  279. "temperatureThreshold2"=> {"cmd" => {"value" => "081E0000000200nn0000"}, "min" => -40, "max" => 80, "multi" => 2, "offset" => 80 },
  280. "temperatureThreshold3"=> {"cmd" => {"value" => "081E000000040000nn00"}, "min" => -40, "max" => 80, "multi" => 2, "offset" => 80 },
  281. "temperatureThreshold4"=> {"cmd" => {"value" => "081E00000008000000nn"}, "min" => -40, "max" => 80, "multi" => 2, "offset" => 80 },
  282. "actTempLimit" => {"cmd" => {"1" => "081Ett00001000000000",
  283. "2" => "081Ett00003000000000",
  284. "3" => "081Ett00005000000000",
  285. "4" => "081Ett00007000000000"}},
  286. "on" => {"cmd" => {"noArg" => "0E03tt00000000000000"}},
  287. "off" => {"cmd" => {"noArg" => "0E02tt00000000000000"}},
  288. );
  289. my %wCmds = (
  290. "interval" => {"enable" => 0x80, "min" => 1, "max" => 100, "offset" => 0,
  291. "reg" => 7, "byte" => 0, "size" => 1, "count" => 1,
  292. "mask" => 0xff, "shift" =>0},
  293. "DCF" => {"enable" => 0x02, "min" => 0, "max" => 0, "offset" => 0,
  294. "reg" => 7, "byte" => 1, "size" => 1, "count" => 1,
  295. "mask" => 0x02, "shift" =>0},
  296. "timezone" => {"enable" => 0x00, "min" => 0, "max" => 23, "offset" => 0,
  297. "reg" => 7, "byte" => 4, "size" => 1, "count" => 1,
  298. "mask" => 0xff, "shift" =>0},
  299. "latitude" => {"enable" => 0x00, "min" => 0, "max" => 90, "offset" => 0,
  300. "reg" => 7, "byte" => 5, "size" => 1, "count" => 1,
  301. "mask" => 0xff, "shift" =>0},
  302. "longitude" => {"enable" => 0x00, "min" => -90, "max" => 90, "offset" => 256,
  303. "reg" => 7, "byte" => 7, "size" => 1, "count" => 1,
  304. "mask" => 0xff, "shift" =>0},
  305. "triggerWind" => {"enable" => 0x20, "min" => 1, "max" => 31, "offset" => 0,
  306. "reg" => 6, "byte" => 0, "size" => 1, "count" => 5,
  307. "mask" => 0x7f, "shift" =>0},
  308. "triggerRain" => {"enable" => 0x80, "min" => 0, "max" => 0, "offset" => 0,
  309. "reg" => 6, "byte" => 0, "size" => 1, "count" => 1,
  310. "mask" => 0x80, "shift" =>0},
  311. "triggerTemperature" => {"enable" => 0x80, "min" => -40, "max" => 80, "offset" => 40,
  312. "reg" => 6, "byte" => 5, "size" => 1, "count" => 5,
  313. "mask" => 0xff, "shift" =>0},
  314. "triggerDawn" => {"enable" => 0x10000000,"min" => 1, "max" => 100, "offset" => -1,
  315. "reg" => 0, "byte" => 0, "size" => 4, "count" => 5,
  316. "mask" => 0x1000007F,"shift" =>0},
  317. "triggerDusk" => {"enable" => 0x20000000,"min" => 1, "max" => 100, "offset" => -1,
  318. "reg" => 0, "byte" => 0, "size" => 4, "count" => 5,
  319. "mask" => 0x201FC000,"shift" => 14},
  320. "triggerSun" => {"enable" => 0x20000000,"min" => 1, "max" => 0x3FFFFFFF, "offset" => 0,
  321. "reg" => 3, "byte" => 0, "size" => 4, "count" => 5,
  322. "mask" => 0x3FFFFFC0,"shift" => 0},
  323. "triggerSunDirection" => {"enable" => 0x00, "min" => 1, "max" => 0xFF, "offset" => 0,
  324. "reg" => 3, "byte" => 1, "size" => 4, "count" => 5,
  325. "mask" => 0x000000FF,"shift" => 0},
  326. "triggerSunHeight" => {"enable" => 0x00, "min" => 1, "max" => 0x1FFF,"offset" => 0,
  327. "reg" => 3, "byte" => 1, "size" => 4, "count" => 5,
  328. "mask" => 0x00001F80,"shift" => 0},
  329. );
  330. my %commandsStatus = (
  331. "getStatus" => "0F",
  332. "getWeather" => "13",
  333. "getTime" => "10",
  334. );
  335. my %setsBasic = (
  336. "reset:settings,full" => "",
  337. "remotePair:noArg" => "",
  338. "remoteUnpair:noArg" => "",
  339. );
  340. my %setsReset = (
  341. "reset:settings,full" => "",
  342. );
  343. my %setsPair = (
  344. "remotePair:noArg" => "",
  345. "remoteUnpair:noArg" => "",
  346. );
  347. my %setsDefaultRollerShutter = (
  348. "getStatus:noArg" => "",
  349. "up:noArg" => "",
  350. "down:noArg" => "",
  351. "stop:noArg" => "",
  352. "toggle:noArg" => "",
  353. "dusk:noArg" => "",
  354. "dawn:noArg" => "",
  355. "sunMode:on,off" => "",
  356. "position:slider,0,1,100" => "",
  357. "sunPosition:slider,0,1,100" => "",
  358. "ventilatingPosition:slider,0,1,100" => "",
  359. "dawnAutomatic:on,off" => "",
  360. "duskAutomatic:on,off" => "",
  361. "manualMode:on,off" => "",
  362. "sunAutomatic:on,off" => "",
  363. "timeAutomatic:on,off" => "",
  364. "ventilatingMode:on,off" => "",
  365. );
  366. my %setsRolloTube = (
  367. "windAutomatic:on,off" => "",
  368. "rainAutomatic:on,off" => "",
  369. "windDirection:up,down" => "",
  370. "rainDirection:up,down" => "",
  371. "windMode:on,off" => "",
  372. "rainMode:on,off" => "",
  373. "reversal:on,off" => "",
  374. );
  375. my %setsTroll = (
  376. "windAutomatic:on,off" => "",
  377. "rainAutomatic:on,off" => "",
  378. "windDirection:up,down" => "",
  379. "rainDirection:up,down" => "",
  380. "windMode:on,off" => "",
  381. "rainMode:on,off" => "",
  382. "runningTime:slider,0,1,150" => "",
  383. "motorDeadTime:off,short,long" => "",
  384. "reversal:on,off" => "",
  385. );
  386. my %setsBlinds = (
  387. "tiltInSunPos:on,off" => "",
  388. "tiltInVentPos:on,off" => "",
  389. "tiltAfterMoveLevel:on,off" => "",
  390. "tiltAfterStopDown:on,off" => "",
  391. "defaultSlatPos:slider,0,1,100" => "",
  392. "slatRunTime:slider,0,1,50" => "",
  393. "slatPosition:slider,0,1,100" => "",
  394. );
  395. my %setsSwitchActor = (
  396. "getStatus:noArg" => "",
  397. "dawnAutomatic:on,off" => "",
  398. "duskAutomatic:on,off" => "",
  399. "manualMode:on,off" => "",
  400. "sunAutomatic:on,off" => "",
  401. "timeAutomatic:on,off" => "",
  402. "sunMode:on,off" => "",
  403. "modeChange:on,off" => "",
  404. "stairwellFunction:on,off" => "",
  405. "stairwellTime:slider,0,10,3200" => "",
  406. "on:noArg" => "",
  407. "off:noArg" => "",
  408. "dusk:noArg" => "",
  409. "dawn:noArg" => "",
  410. );
  411. my %setsUmweltsensor = (
  412. "getStatus:noArg" => "",
  413. "getWeather:noArg" => "",
  414. "getTime:noArg" => "",
  415. );
  416. my %setsUmweltsensor00 = (
  417. "getWeather:noArg" => "",
  418. "getTime:noArg" => "",
  419. "getConfig:noArg" => "",
  420. "writeConfig:noArg" => "",
  421. "DCF:on,off" => "",
  422. "interval:off,1,2,3,4,5,6,7,8,9,10,15,20,30,40,50,60,70,80,90,100" => "",
  423. "latitude" => "",
  424. "longitude" => "",
  425. "timezone" => "",
  426. "time:noArg" => "",
  427. "triggerDawn" => "",
  428. "triggerDusk" => "",
  429. "triggerRain:on,off" => "",
  430. "triggerSun" => "",
  431. "triggerSunDirection" => "",
  432. "triggerSunHeight" => "",
  433. "triggerTemperature" => "",
  434. "triggerWind" => "",
  435. );
  436. my %setsUmweltsensor01 = (
  437. "windAutomatic:on,off" => "",
  438. "rainAutomatic:on,off" => "",
  439. "windDirection:up,down" => "",
  440. "rainDirection:up,down" => "",
  441. "windMode:on,off" => "",
  442. "rainMode:on,off" => "",
  443. "runningTime:slider,0,1,100" => "",
  444. "reversal:on,off" => "",
  445. );
  446. my %setsSX5 = (
  447. "getStatus:noArg" => "",
  448. "up:noArg" => "",
  449. "down:noArg" => "",
  450. "stop:noArg" => "",
  451. "position:slider,0,1,100" => "",
  452. "ventilatingPosition:slider,0,1,100" => "",
  453. "manualMode:on,off" => "",
  454. "timeAutomatic:on,off" => "",
  455. "ventilatingMode:on,off" => "",
  456. "10minuteAlarm:on,off" => "",
  457. "automaticClosing:off,30,60,90,120,150,180,210,240" => "",
  458. "2000cycleAlarm:on,off" => "",
  459. "openSpeed:11,15,19" => "",
  460. "backJump:on,off" => "",
  461. );
  462. my %setsDimmer = (
  463. "getStatus:noArg" => "",
  464. "level:slider,0,1,100" => "",
  465. "on:noArg" => "",
  466. "off:noArg" => "",
  467. "dawnAutomatic:on,off" => "",
  468. "duskAutomatic:on,off" => "",
  469. "manualMode:on,off" => "",
  470. "sunAutomatic:on,off" => "",
  471. "timeAutomatic:on,off" => "",
  472. "sunMode:on,off" => "",
  473. "modeChange:on,off" => "",
  474. "stairwellFunction:on,off" => "",
  475. "stairwellTime:slider,0,10,3200" => "",
  476. "runningTime:slider,0,1,255" => "",
  477. "intermediateMode:on,off" => "",
  478. "intermediateValue:slider,0,1,100" => "",
  479. "saveIntermediateOnStop:on,off" => "",
  480. "dusk:noArg" => "",
  481. "dawn:noArg" => "",
  482. );
  483. my $tempSetList = "4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0";
  484. my %setsThermostat = (
  485. "getStatus:noArg" => "",
  486. "tempUp:noArg" => "",
  487. "tempDown:noArg" => "",
  488. "manualMode:on,off" => "",
  489. "timeAutomatic:on,off" => "",
  490. "temperatureThreshold1:$tempSetList" => "",
  491. "temperatureThreshold2:$tempSetList" => "",
  492. "temperatureThreshold3:$tempSetList" => "",
  493. "temperatureThreshold4:$tempSetList" => "",
  494. "actTempLimit:1,2,3,4" => "",
  495. "desired-temp:$tempSetList" => "",
  496. );
  497. my $duoStatusRequest = "0DFFnn400000000000000000000000000000yyyyyy01";
  498. my $duoCommand = "0Dccnnnnnnnnnnnnnnnnnnnn000000zzzzzzyyyyyy00";
  499. my $duoCommand2 = "0Dccnnnnnnnnnnnnnnnnnnnn000000000000yyyyyy01";
  500. my $duoWeatherConfig = "0D001B400000000000000000000000000000yyyyyy00";
  501. my $duoWeatherWriteConfig = "0DFF1Brrnnnnnnnnnnnnnnnnnnnn00000000yyyyyy00";
  502. my $duoSetTime = "0D0110800001mmmmmmmmnnnnnn0000000000yyyyyy00";
  503. #####################################
  504. sub
  505. DUOFERN_Initialize($)
  506. {
  507. my ($hash) = @_;
  508. $hash->{Match} = "^(06|0F).{42}";
  509. $hash->{SetFn} = "DUOFERN_Set";
  510. $hash->{DefFn} = "DUOFERN_Define";
  511. $hash->{UndefFn} = "DUOFERN_Undef";
  512. $hash->{ParseFn} = "DUOFERN_Parse";
  513. $hash->{RenameFn} = "DUOFERN_Rename";
  514. $hash->{AttrFn} = "DUOFERN_Attr";
  515. $hash->{AttrList} = "IODev timeout toggleUpDown ignore:1,0 positionInverse:1,0 ". $readingFnAttributes;
  516. #$hash->{AutoCreate}=
  517. # { "DUOFERN" => { GPLOT => "", FILTER => "%NAME" } };
  518. }
  519. ###################################
  520. sub
  521. DUOFERN_Set($@)
  522. {
  523. my ($hash, @a) = @_;
  524. my @b = @a;
  525. return "set $hash->{NAME} needs at least one parameter" if(@a < 2);
  526. my $me = shift @a;
  527. my $cmd = shift @a;
  528. my $arg = shift @a;
  529. my $arg2 = shift @a;
  530. my $code = substr($hash->{CODE},0,6);
  531. my $name = $hash->{NAME};
  532. my %sets;
  533. %sets = (%setsBasic, %setsDefaultRollerShutter, %setsRolloTube) if ($hash->{CODE} =~ /^49..../);
  534. %sets = (%setsBasic, %setsDefaultRollerShutter, %setsTroll, ("blindsMode:on,off"=> "")) if ($hash->{CODE} =~ /^(42|4B|4C|70)..../);
  535. %sets = (%setsBasic, %setsDefaultRollerShutter, %setsTroll) if ($hash->{CODE} =~ /^47..../);
  536. %sets = (%setsBasic, %setsDefaultRollerShutter) if ($hash->{CODE} =~ /^(40|41|61)..../);
  537. %sets = (%setsReset, %setsUmweltsensor) if ($hash->{CODE} =~ /^69....$/);
  538. %sets = (%setsUmweltsensor00) if ($hash->{CODE} =~ /^69....00/);
  539. %sets = (%setsDefaultRollerShutter, %setsUmweltsensor01, %setsPair) if ($hash->{CODE} =~ /^69....01/);
  540. %sets = (%setsSwitchActor, %setsPair) if ($hash->{CODE} =~ /^43....(01|02)/);
  541. %sets = (%setsReset, "getStatus:noArg"=> "") if ($hash->{CODE} =~ /^(43|65|74)....$/);
  542. %sets = (%setsBasic, %setsSwitchActor) if ($hash->{CODE} =~ /^(46|71)..../);
  543. %sets = (%setsBasic, %setsSX5) if ($hash->{CODE} =~ /^4E..../);
  544. %sets = (%setsBasic, %setsDimmer) if ($hash->{CODE} =~ /^48..../);
  545. %sets = (%setsBasic, %setsThermostat) if ($hash->{CODE} =~ /^73..../);
  546. %sets = (%setsSwitchActor, %setsPair) if ($hash->{CODE} =~ /^(65|74)....01/);
  547. my $blindsMode=ReadingsVal($name, "blindsMode", "off");
  548. %sets = (%sets, %setsBlinds) if ($blindsMode eq "on");
  549. my $list = join(" ", sort keys %sets);
  550. if (exists $commandsStatus{$cmd}) {
  551. my $buf = $duoStatusRequest;
  552. $buf =~ s/nn/$commandsStatus{$cmd}/;
  553. $buf =~ s/yyyyyy/$code/;
  554. IOWrite( $hash, $buf );
  555. return undef;
  556. } elsif ($cmd eq "clear") {
  557. my @cH = ($hash);
  558. delete $_->{READINGS} foreach (@cH);
  559. return undef;
  560. } elsif ($cmd eq "getConfig") {
  561. my $buf = $duoWeatherConfig;
  562. $buf =~ s/yyyyyy/$code/;
  563. IOWrite( $hash, $buf );
  564. return undef;
  565. } elsif ($cmd eq "writeConfig") {
  566. my $buf;
  567. for(my $x=0; $x<8; $x++) {
  568. my $regV = ReadingsVal($name, ".reg$x", "00000000000000000000");
  569. my $reg = sprintf("%02x",$x+0x81);
  570. $buf= $duoWeatherWriteConfig;
  571. $buf =~ s/yyyyyy/$code/;
  572. $buf =~ s/rr/$reg/;
  573. $buf =~ s/nnnnnnnnnnnnnnnnnnnn/$regV/;
  574. IOWrite( $hash, $buf );
  575. }
  576. delete $hash->{READINGS}{configModified};
  577. return undef;
  578. } elsif ($cmd eq "time") {
  579. my $buf = $duoSetTime;
  580. my ($sec,$min,$hour,$mday,$month,$year,$wday,$yday,$isdst) = localtime;
  581. $wday = ($wday==0 ? 7 : $wday-1);
  582. my $m = sprintf("%02d%02d%02d%02d", $year-100, $month+1,$wday, $mday);
  583. my $n = sprintf("%02d%02d%02d", $hour, $min, $sec);
  584. $buf =~ s/mmmmmmmm/$m/;
  585. $buf =~ s/nnnnnn/$n/;
  586. $buf =~ s/yyyyyy/$code/;
  587. IOWrite( $hash, $buf );
  588. return undef;
  589. } elsif (exists $wCmds{$cmd}) {
  590. return "This command is not allowed for this device." if ($hash->{CODE} !~ /^69....00/);
  591. my $regs;
  592. my @regsA;
  593. my @args = @b;
  594. my $reg;
  595. splice(@args,0,2);
  596. return "Missing argument" if(@args < 1);
  597. splice(@args,@args,0,"off","off","off","off");
  598. for(my $x=0; $x<8; $x++) {
  599. $regs .= ReadingsVal($name, ".reg$x", "00000000000000000000");
  600. }
  601. if ($cmd eq "triggerSun") {
  602. foreach (@args) {
  603. if ($_ ne "off") {
  604. my @args2 = split(/:/, $_);
  605. my $temp = $_;
  606. return "Missing argument" if(@args2 < 3);
  607. return "Wrong argument $_" if ($args2[0] !~ m/^\d+$/ || $args2[0] < 1 || $args2[0] > 100);
  608. return "Wrong argument $_" if ($args2[1] !~ m/^\d+$/ || $args2[1] < 1 || $args2[1] > 30);
  609. return "Wrong argument $_" if ($args2[2] !~ m/^\d+$/ || $args2[2] < 1 || $args2[2] > 30);
  610. $_ = (($args2[0]-1)<<12) | (($args2[1]-1)<<19) | (($args2[2]-1)<<24);
  611. if(@args2 > 3) {
  612. return "Wrong argument $temp" if ($args2[3] !~ m/^[-\d]+$/ || $args2[3] < -5 || $args2[3] > 26);
  613. $_ |= ((($args2[3]+5)<<7) | 0x40);
  614. };
  615. }
  616. }
  617. }
  618. if ($cmd eq "triggerSunDirection") {
  619. for(my $x=0; $x<5; $x++) {
  620. if ($args[$x] ne "off") {
  621. my @args2 = split(/:/, $args[$x]);
  622. return "Missing argument" if(@args2 < 2);
  623. return "Wrong argument $args[$x]" if ($args2[0] !~ m/^\d+(\.\d+|)$/ || $args2[0] < 0 || $args2[0] > 315);
  624. return "Wrong argument $args[$x]" if ($args2[1] !~ m/^\d+$/ || $args2[1] < 45 || $args2[1] > 180);
  625. $args2[0] = int(($args2[0]+11.25)/22.5);
  626. $args2[1] = int(($args2[1]+22.5)/45);
  627. $args2[0] = 15 - ($args2[1]*2) if (($args2[0] + $args2[1]*2) > 15);
  628. $args[$x] = ($args2[0]+$args2[1]) | (($args2[1])<<4) | 0x80;
  629. } else {
  630. my @tSunHeight = map{hex($_)} unpack 'x66A2x8A2x8A2x8A2x8A2', $regs;
  631. if ($tSunHeight[$x] & 0x18) {
  632. $args[$x] = 0x81;
  633. } else {
  634. $args[$x] = 0x01;
  635. }
  636. }
  637. }
  638. }
  639. if ($cmd eq "triggerSunHeight") {
  640. for(my $x=0; $x<5; $x++) {
  641. if ($args[$x] ne "off") {
  642. my @args2 = split(/:/, $args[$x]);
  643. return "Missing argument" if(@args2 < 2);
  644. return "Wrong argument1 $args[$x]" if ($args2[0] !~ m/^\d+$/ || $args2[0] < 0 || $args2[0] > 90);
  645. return "Wrong argument2 $args[$x]" if ($args2[1] !~ m/^\d+$/ || $args2[1] < 20 || $args2[1] > 60);
  646. $args2[0] = int(($args2[0]+6.5)/13);
  647. $args2[1] = int(($args2[1]+13)/26);
  648. $args2[0] = 7 - ($args2[1]*2) if (($args2[0] + $args2[1]*2) > 7);
  649. $args[$x] = (($args2[0]+$args2[1])<<8) | (($args2[1])<<11) | 0x80;
  650. } else {
  651. my @tSunDir = map{hex($_)} unpack 'x68A2x8A2x8A2x8A2x8A2', $regs;
  652. if ($tSunDir[$x] & 0x70) {
  653. $args[$x] = 0x0180;
  654. } else {
  655. $args[$x] = 0x0100;
  656. }
  657. }
  658. }
  659. }
  660. for (my $c = 0; $c<$wCmds{$cmd}{count}; $c++) {
  661. my $pad = 0;
  662. if ($wCmds{$cmd}{size} == 4) {
  663. $pad = int($c / 2)*2;
  664. $pad = $c if ($cmd =~ m/^triggerSun.*/);
  665. };
  666. my $regStart = ($wCmds{$cmd}{reg} * 10 + $wCmds{$cmd}{byte} + $pad + $c * $wCmds{$cmd}{size} )*2;
  667. $reg = hex(substr($regs, $regStart, $wCmds{$cmd}{size} * 2));
  668. if(($args[$c] =~ m/^[-\d]+$/) && ($args[$c] >= $wCmds{$cmd}{min}) && ($args[$c] <= $wCmds{$cmd}{max})) {
  669. $reg &= ~($wCmds{$cmd}{mask});
  670. $reg |= $wCmds{$cmd}{enable};
  671. $reg |= (($args[$c] + $wCmds{$cmd}{offset})<<$wCmds{$cmd}{shift}) & $wCmds{$cmd}{mask} ;
  672. } elsif (($args[$c] eq "off") && ($wCmds{$cmd}{enable} > 0)) {
  673. $reg &= ~($wCmds{$cmd}{enable});
  674. } elsif (($args[$c] eq "on") && ($wCmds{$cmd}{min} == 0) && ($wCmds{$cmd}{max} == 0)) {
  675. $reg |= $wCmds{$cmd}{enable};
  676. } else {
  677. return "wrong argument ".$args[$c];
  678. }
  679. my $size = $wCmds{$cmd}{size}*2;
  680. substr($regs, $regStart ,$size, sprintf("%0".$size."x",$reg));
  681. }
  682. @regsA = unpack('(A20)*', $regs);
  683. readingsBeginUpdate($hash);
  684. for(my $x=0; $x<8; $x++) {
  685. readingsBulkUpdate($hash, ".reg$x", $regsA[$x], 0);
  686. #readingsBulkUpdate($hash, "reg$x", $regsA[$x], 0);
  687. }
  688. readingsBulkUpdate($hash, "configModified", 1, 0);
  689. readingsEndUpdate($hash, 1);
  690. DUOFERN_DecodeWeatherSensorConfig($hash);
  691. return undef;
  692. } elsif(exists $commands{$cmd}) {
  693. my $subCmd;
  694. my $chanNo = "01";
  695. my $argV = "00";
  696. my $argW = "0000";
  697. my $timer ="00";
  698. my $buf;
  699. my $command;
  700. my $positionInverse = AttrVal($name,"positionInverse",0);
  701. if ($cmd eq "remotePair") {
  702. $buf = $duoCommand2;
  703. } else {
  704. $buf = $duoCommand;
  705. }
  706. $chanNo = $hash->{chanNo} if ($hash->{chanNo});
  707. if(exists $commands{$cmd}{cmd}{noArg}) {
  708. $timer= "01" if ($arg && ($arg eq "timer"));
  709. $subCmd = "noArg";
  710. $argV = "00";
  711. } elsif (exists $commands{$cmd}{cmd}{value}) {
  712. $timer= "01" if ($arg2 && ($arg2 eq "timer"));
  713. my $maxArg = (exists $commands{$cmd}{max} ? $commands{$cmd}{max} : 100);
  714. my $minArg = (exists $commands{$cmd}{min} ? $commands{$cmd}{min} : 0);
  715. my $mulArg = (exists $commands{$cmd}{multi} ? $commands{$cmd}{multi} : 1);
  716. my $offArg = (exists $commands{$cmd}{offset} ? $commands{$cmd}{offset} : 0);
  717. $maxArg = 255 if (($code =~ m/^48..../) && ($cmd eq "runningTime"));
  718. return "Missing argument" if (!defined($arg));
  719. return "Wrong argument $arg" if ($arg !~ m/^\d+(\.\d+|)$/ || $arg < $minArg || $arg > $maxArg);
  720. $subCmd = "value";
  721. if((exists $commands{$cmd}{invert}) && ($positionInverse eq "1")) {
  722. $arg = $commands{$cmd}{invert} - $arg;
  723. }
  724. $argV = sprintf "%02x", $arg * $mulArg + $offArg;
  725. $argW = sprintf "%04x", $arg * $mulArg + $offArg;
  726. } else {
  727. return "Missing argument" if (!defined($arg));
  728. $timer= "01" if ($arg2 && ($arg2 eq "timer"));
  729. $subCmd = $arg;
  730. $argV = "00";
  731. }
  732. return "Wrong argument $arg" if (!exists $commands{$cmd}{cmd}{$subCmd});
  733. my $position = ReadingsVal($name, "position", -1);
  734. my $toggleUpDown = AttrVal($name, "toggleUpDown", "0");
  735. my $moving = ReadingsVal($name, "moving", "stop");
  736. my $timeAutomatic = ReadingsVal($name, "timeAutomatic", "on");
  737. my $dawnAutomatic = ReadingsVal($name, "dawnAutomatic", "on");
  738. my $duskAutomatic = ReadingsVal($name, "duskAutomatic", "on");
  739. if(($positionInverse eq "1")) {
  740. $position = 100 - $position;
  741. }
  742. if ($moving ne "stop") {
  743. if ($cmd =~ m/^(up|down|toggle)$/) {
  744. $cmd = "stop" if ($toggleUpDown);
  745. }
  746. }
  747. readingsSingleUpdate($hash, "moving", "moving", 1) if (($cmd eq "toggle") && ($position > -1));
  748. readingsSingleUpdate($hash, "moving", "up", 1) if (($cmd eq "dawn") && ($dawnAutomatic eq "on") && ($position > 0));
  749. readingsSingleUpdate($hash, "moving", "down", 1) if (($cmd eq "dusk") && ($duskAutomatic eq "on") && ($position < 100) && ($position > -1));
  750. if ($timer eq "00" || $timeAutomatic eq "on") {
  751. readingsSingleUpdate($hash, "moving", "up", 1) if (($cmd eq "up") && ($position > 0));
  752. readingsSingleUpdate($hash, "moving", "down", 1) if (($cmd eq "down") && ($position < 100) && ($position > -1));
  753. }
  754. if ($cmd eq "position") {
  755. if ($arg > $position) {
  756. readingsSingleUpdate($hash, "moving", "down", 1);
  757. } elsif ($arg < $position) {
  758. readingsSingleUpdate($hash, "moving", "up", 1);
  759. } else {
  760. readingsSingleUpdate($hash, "moving", "stop", 1);
  761. }
  762. }
  763. $command = $commands{$cmd}{cmd}{$subCmd};
  764. $buf =~ s/yyyyyy/$code/;
  765. $buf =~ s/nnnnnnnnnnnnnnnnnnnn/$command/;
  766. $buf =~ s/nn/$argV/;
  767. $buf =~ s/tt/$timer/;
  768. $buf =~ s/wwww/$argW/;
  769. $buf =~ s/cc/$chanNo/;
  770. IOWrite( $hash, $buf );
  771. if ($hash->{device}) {
  772. $hash = $defs{$hash->{device}};
  773. }
  774. my $ret = "set_".$cmd;
  775. $ret = $ret." ".$arg if($arg);
  776. $ret = $ret." ".$arg2 if($arg2);
  777. DoTrigger($name, $ret);
  778. return ("",1);
  779. }
  780. return SetExtensions($hash, $list, @b);
  781. }
  782. #####################################
  783. sub
  784. DUOFERN_Define($$)
  785. {
  786. my ($hash, $def) = @_;
  787. my @a = split("[ \t][ \t]*", $def);
  788. return "wrong syntax: define <name> DUOFERN <code>"
  789. if(int(@a) < 3 || int(@a) > 5);
  790. return "Define $a[0]: wrong CODE format: specify a 6 digit hex value"
  791. if($a[2] !~ m/^[a-f0-9]{6,8}$/i);
  792. my $code = uc($a[2]);
  793. $hash->{CODE} = $code;
  794. my $name = $hash->{NAME};
  795. if(length($code) == 8) {# define a channel
  796. my $chn = substr($code, 6, 2);
  797. my $devCode = substr($code, 0, 6);
  798. my $devHash = $modules{DUOFERN}{defptr}{$devCode};
  799. return "please define a device with code:".$devCode." first" if(!$devHash);
  800. my $devName = $devHash->{NAME};
  801. $hash->{device} = $devName; #readable ref to device name
  802. $hash->{chanNo} = $chn; #readable ref to Channel
  803. $devHash->{"channel_$chn"} = $name; #reference in device as well
  804. }
  805. $modules{DUOFERN}{defptr}{$code} = $hash;
  806. AssignIoPort($hash);
  807. if (exists $devices{substr($hash->{CODE},0,2)}) {
  808. $hash->{SUBTYPE} = $devices{substr($hash->{CODE},0,2)}{name};
  809. $hash->{MODEL} = $devices{substr($hash->{CODE},0,2)}{name};
  810. } else {
  811. $hash->{SUBTYPE} = "unknown";
  812. }
  813. readingsSingleUpdate($hash, "state", "Initialized", 1);
  814. return undef if (AttrVal($name,"ignore",0) != 0);
  815. if ($hash->{CODE} =~ m/^(40|41|42|43|46|47|48|49|4B|4C|4E|61|62|65|69|70|71|73|74)....$/) {
  816. $hash->{helper}{timeout}{t} = 30;
  817. InternalTimer(gettimeofday()+$hash->{helper}{timeout}{t}, "DUOFERN_StatusTimeout", $hash, 0);
  818. $hash->{helper}{timeout}{count} = 2;
  819. }
  820. return undef;
  821. }
  822. #####################################
  823. sub
  824. DUOFERN_Undef($$)
  825. {
  826. my ($hash, $name) = @_;
  827. my $devName = $hash->{device};
  828. my $code = $hash->{DEF};
  829. my $chn = substr($code,6,2);
  830. if ($chn){# delete a channel
  831. my $devHash = $defs{$devName};
  832. delete $devHash->{"channel_$chn"} if ($devName);
  833. }
  834. else{# delete a device
  835. CommandDelete(undef,$hash->{$_}) foreach (grep(/^channel_/,keys %{$hash}));
  836. }
  837. delete($modules{CUL_HM}{defptr}{$code});
  838. return undef;
  839. }
  840. #####################################
  841. sub
  842. DUOFERN_Rename($$$)
  843. {
  844. my ($name, $oldName) = @_;
  845. my $hash = $defs{$name};
  846. if ($hash->{chanNo}) {# we are channel, inform the device
  847. my $devHash = $defs{$hash->{device}};
  848. $devHash->{"channel_".$hash->{chanNo}} = $name;
  849. } else {# we are a device - inform channels if exist
  850. foreach (grep (/^channel_/, keys%{$hash})){
  851. my $chnHash = $defs{$hash->{$_}};
  852. $chnHash->{device} = $name;
  853. }
  854. }
  855. return;
  856. }
  857. #####################################
  858. sub
  859. DUOFERN_Attr(@)
  860. {
  861. my ($cmd,$name,$aName,$aVal) = @_;
  862. if($aName eq "timeout") {
  863. if ($cmd eq "set"){
  864. return "timeout must be between 0 and 180" if ($aVal !~ m/^\d+$/ || $aVal < 0 || $aVal > 180);
  865. }
  866. }
  867. return undef;
  868. }
  869. #####################################
  870. sub
  871. DUOFERN_Parse($$)
  872. {
  873. my ($hash,$msg) = @_;
  874. my $code = substr($msg,30,6);
  875. $code = substr($msg,36,6) if ($msg =~ m/81.{42}/);
  876. return $hash->{NAME} if ($code eq "FFFFFF");
  877. my $def = $modules{DUOFERN}{defptr}{$code};
  878. my $def01;
  879. my $def02;
  880. if(!$def) {
  881. DoTrigger("global","UNDEFINED DUOFERN_$code DUOFERN $code");
  882. $def = $modules{DUOFERN}{defptr}{$code};
  883. if(!$def) {
  884. Log3 $hash, 4, "DUOFERN UNDEFINED, code $code";
  885. return "UNDEFINED DUOFERN_$code DUOFERN $code $msg";
  886. }
  887. }
  888. $hash = $def;
  889. my $name = $hash->{NAME};
  890. return $name if (AttrVal($name,"ignore",0) != 0);
  891. #Device paired
  892. if ($msg =~ m/0602.{40}/) {
  893. readingsSingleUpdate($hash, "state", "paired", 1);
  894. delete $hash->{READINGS}{unpaired};
  895. Log3 $hash, 1, "DUOFERN device paired, code $code";
  896. #Device unpaired
  897. } elsif ($msg =~ m/0603.{40}/) {
  898. readingsBeginUpdate($hash);
  899. readingsBulkUpdate($hash, "unpaired", 1 , 1);
  900. readingsBulkUpdate($hash, "state", "unpaired" , 1);
  901. readingsEndUpdate($hash, 1); # Notify is done by Dispatch
  902. Log3 $hash, 1, "DUOFERN device unpaired, code $code";
  903. #Status Nachricht Aktor
  904. } elsif ($msg =~ m/0FFF0F.{38}/) {
  905. my $format = substr($msg, 6, 2);
  906. my $ver = substr($msg, 24, 1).".".substr($msg, 25, 1);
  907. my $state;
  908. my @chHash;
  909. if(exists $devices{substr($code,0,2)}{format}) {
  910. $format = $devices{substr($code,0,2)}{format};
  911. }
  912. readingsSingleUpdate($hash, "version", $ver, 0);
  913. RemoveInternalTimer($hash);
  914. delete $hash->{helper}{timeout};
  915. if(exists $devices{substr($code,0,2)}{chans}) {
  916. readingsSingleUpdate($hash, "state", "OK", 1);
  917. foreach my $chan (@{$devices{substr($code,0,2)}{chans}}) {
  918. my $defChan = $modules{DUOFERN}{defptr}{$code.$chan};
  919. if(!$defChan) {
  920. DoTrigger("global","UNDEFINED DUOFERN_$code"."_$chan DUOFERN $code".$chan);
  921. $defChan = $modules{DUOFERN}{defptr}{$code.$chan};
  922. }
  923. push(@chHash,$defChan);
  924. }
  925. } else {
  926. push(@chHash,$hash);
  927. }
  928. if(exists $statusGroups{$format}) {
  929. foreach my $hashA (@chHash){
  930. my %statusValue;
  931. my $positionInverse = AttrVal($name,"positionInverse",0);
  932. readingsBeginUpdate($hashA);
  933. foreach my $statusId (@{$statusGroups{$format}}) {
  934. if(exists $statusIds{$statusId}) {
  935. my $chan= (exists $hashA->{chanNo} ? $hashA->{chanNo} : "01");
  936. my $stName = $statusIds{$statusId}{name};
  937. my $stPos = $statusIds{$statusId}{chan}{$chan}{position};
  938. my $stFrom = $statusIds{$statusId}{chan}{$chan}{from};
  939. my $stTo = $statusIds{$statusId}{chan}{$chan}{to};
  940. my $stLen = $stTo - $stFrom + 1;
  941. my $value = hex(substr($msg, ($stLen > 8 ? 6 : 8) + $stPos*2, ($stLen > 8 ? 4 : 2)));
  942. $value = ($value >> $stFrom) & ((1<<$stLen) - 1);
  943. if((exists $statusIds{$statusId}{invert}) && ($positionInverse eq "1")) {
  944. $value = $statusIds{$statusId}{invert} - $value;
  945. }
  946. if((exists $statusIds{$statusId}{map}) && (exists $statusMapping{$statusIds{$statusId}{map}})) {
  947. if ($statusIds{$statusId}{map} =~ m/scaleF.*/) {
  948. $value = sprintf("%0.1f",($value - $statusMapping{$statusIds{$statusId}{map}}[1]) / $statusMapping{$statusIds{$statusId}{map}}[0]);
  949. } elsif ($statusIds{$statusId}{map} =~ m/scale.*/) {
  950. $value = ($value - $statusMapping{$statusIds{$statusId}{map}}[1]) / $statusMapping{$statusIds{$statusId}{map}}[0];
  951. } else {
  952. $value = $statusMapping{$statusIds{$statusId}{map}}[$value];
  953. }
  954. }
  955. $statusValue{$stName} = $value;
  956. readingsBulkUpdate($hashA, $stName, $value, 1);
  957. }
  958. }
  959. if (defined($statusValue{blindsMode}) && ($statusValue{blindsMode} eq "off")) {
  960. delete($hash->{READINGS}{tiltInSunPos});
  961. delete($hash->{READINGS}{tiltInVentPos});
  962. delete($hash->{READINGS}{tiltAfterMoveLevel});
  963. delete($hash->{READINGS}{tiltAfterStopDown});
  964. delete($hash->{READINGS}{defaultSlatPos});
  965. delete($hash->{READINGS}{slatRunTime});
  966. delete($hash->{READINGS}{slatPosition});
  967. }
  968. $state = "x";
  969. if ($format =~ m/^(21|23|23a|24|24a)/) {
  970. $state = $statusValue{position} if defined($statusValue{position});
  971. if($positionInverse eq "1") {
  972. $state = "opened" if ($state eq "100");
  973. $state = "closed" if ($state eq "0");
  974. } else {
  975. $state = "opened" if ($state eq "0");
  976. $state = "closed" if ($state eq "100");
  977. }
  978. } elsif ($format =~ m/^(22|25)/) {
  979. $state = $statusValue{level} if defined($statusValue{level});
  980. $state = "off" if ($state eq "0");
  981. $state = "on" if ($state eq "100");
  982. } elsif ($format =~ m/^(27)/) {
  983. my $temperature1 = "x";
  984. my $desiredTemp = "x";
  985. $temperature1 = $statusValue{"measured-temp"} if defined($statusValue{"measured-temp"});
  986. $desiredTemp = $statusValue{"desired-temp"} if defined($statusValue{"desired-temp"});
  987. $state = "T: $temperature1 desired: $desiredTemp";
  988. }
  989. $state = "light curtain" if (defined($statusValue{"lightCurtain"}) && $statusValue{"lightCurtain"} eq "1");
  990. $state = "obstacle" if (defined($statusValue{"obstacle"}) && $statusValue{"obstacle"} eq "1");
  991. $state = "block" if (defined($statusValue{"block"}) && $statusValue{"block"} eq "1");
  992. readingsBulkUpdate($hashA, "state", $state, 1) if ($state ne "x");
  993. readingsEndUpdate($hashA, 1); # Notify is done by Dispatch
  994. DoTrigger($hashA->{NAME}, undef);
  995. }
  996. } else {
  997. Log3 $hash, 3, "DUOFERN unknown msg: $msg";
  998. }
  999. #Wandtaster, Funksender UP, Handsender, Sensoren
  1000. } elsif ($msg =~ m/0F..(07|0E).{38}/) {
  1001. my $id = substr($msg, 4, 4);
  1002. if (!(exists $sensorMsg{$id})) {
  1003. Log3 $hash, 3, "DUOFERN unknown msg: $msg";
  1004. }
  1005. my $chan = substr($msg, $sensorMsg{$id}{chan}*2 + 2 , 2);
  1006. $chan = "01" if ($code =~ m/^(61|70|71)..../);
  1007. my @chans;
  1008. if ($sensorMsg{$id}{chan} == 5) {
  1009. my $chanCount = 5;
  1010. $chanCount = 4 if ($code =~ m/^(73)..../);
  1011. for(my $x=0; $x<$chanCount; $x++) {
  1012. if((0x01<<$x) & hex($chan)) {
  1013. push(@chans, $x+1);
  1014. }
  1015. }
  1016. } else {
  1017. push(@chans, $chan);
  1018. }
  1019. if($code =~ m/^(65|69|74).*/) {
  1020. $def01 = $modules{DUOFERN}{defptr}{$code."00"};
  1021. if(!$def01) {
  1022. DoTrigger("global","UNDEFINED DUOFERN_$code"."_sensor DUOFERN $code"."00");
  1023. $def01 = $modules{DUOFERN}{defptr}{$code."00"};
  1024. }
  1025. $hash = $def01 if ($def01);
  1026. }
  1027. foreach (@chans) {
  1028. $chan = $_;
  1029. if($id =~ m/..(1A|18|19|01|02|03)/) {
  1030. if(($id =~ m/..1A/) || ($id =~ m/0E../) || ($code =~ m/^(A0|A2)..../)) {
  1031. readingsSingleUpdate($hash, "state", $sensorMsg{$id}{state}.".".$chan, 1);
  1032. } else {
  1033. readingsSingleUpdate($hash, "state", $sensorMsg{$id}{state}, 1);
  1034. }
  1035. readingsSingleUpdate($hash, "channel$chan", $sensorMsg{$id}{name}, 1);
  1036. } else {
  1037. if(($code !~ m/^(69|73).*/) || ($id =~ m/..(11|12)/)) {
  1038. $chan="";
  1039. }
  1040. if($code =~ m/^(65|A5|AA|AB)..../) {
  1041. readingsSingleUpdate($hash, "state", $sensorMsg{$id}{state}, 1);
  1042. }
  1043. readingsSingleUpdate($hash, "event", $sensorMsg{$id}{name}.$chan, 1);
  1044. DoTrigger($hash->{NAME},$sensorMsg{$id}{name}.$chan);
  1045. }
  1046. }
  1047. #Umweltsensor Wetter
  1048. } elsif ($msg =~ m/0F011322.{36}/) {
  1049. $def01 = $modules{DUOFERN}{defptr}{$code."00"};
  1050. if(!$def01) {
  1051. DoTrigger("global","UNDEFINED DUOFERN_$code"."_sensor DUOFERN $code"."00");
  1052. $def01 = $modules{DUOFERN}{defptr}{$code."00"};
  1053. }
  1054. $hash = $def01;
  1055. my $brightnessExp = (hex(substr($msg, 8, 4)) & 0x0400 ? 1000 : 1);
  1056. my $brightness = (hex(substr($msg, 8, 4)) & 0x01FF) * $brightnessExp;
  1057. my $sunDirection = hex(substr($msg, 14, 2)) * 1.5 ;
  1058. my $sunHeight = hex(substr($msg, 16, 2)) - 90 ;
  1059. my $temperature = ((hex(substr($msg, 18, 4)) & 0x7FFF)-400)/10 ;
  1060. my $isRaining = (hex(substr($msg, 18, 4)) & 0x8000 ? 1 : 0);
  1061. my $wind = (hex(substr($msg, 22, 4)) & 0x03FF) / 10;
  1062. my $state = "T: ".$temperature;
  1063. $state .= " W: ".$wind;
  1064. $state .= " IR: ".$isRaining;
  1065. $state .= " B: ".$brightness;
  1066. readingsBeginUpdate($hash);
  1067. readingsBulkUpdate($hash, "brightness", $brightness, 1);
  1068. readingsBulkUpdate($hash, "sunDirection", $sunDirection, 1);
  1069. readingsBulkUpdate($hash, "sunHeight", $sunHeight, 1);
  1070. readingsBulkUpdate($hash, "temperature", $temperature, 1);
  1071. readingsBulkUpdate($hash, "isRaining", $isRaining, 1);
  1072. readingsBulkUpdate($hash, "state", $state, 1);
  1073. readingsBulkUpdate($hash, "wind", $wind, 1);
  1074. readingsEndUpdate($hash, 1); # Notify is done by Dispatch
  1075. #Umweltsensor Zeit
  1076. } elsif ($msg =~ m/0FFF1020.{36}/) {
  1077. $def01 = $modules{DUOFERN}{defptr}{$code."00"};
  1078. if(!$def01) {
  1079. DoTrigger("global","UNDEFINED DUOFERN_$code"."_sensor DUOFERN $code"."00");
  1080. $def01 = $modules{DUOFERN}{defptr}{$code."00"};
  1081. }
  1082. $hash = $def01;
  1083. my $year = substr($msg, 12, 2);
  1084. my $month = substr($msg, 14, 2);
  1085. my $day = substr($msg, 18, 2);
  1086. my $hour = substr($msg, 20, 2);
  1087. my $minute = substr($msg, 22, 2);
  1088. my $second = substr($msg, 24, 2);
  1089. readingsBeginUpdate($hash);
  1090. readingsBulkUpdate($hash, "date", "20".$year."-".$month."-".$day, 1);
  1091. readingsBulkUpdate($hash, "time", $hour.":".$minute.":".$second, 1);
  1092. readingsEndUpdate($hash, 1); # Notify is done by Dispatch
  1093. #Umweltsensor Konfiguration
  1094. } elsif ($msg =~ m/0FFF1B2[1-8].{36}/) {
  1095. my $reg = substr($msg, 6, 2)-21;
  1096. my $regVal = substr($msg, 8, 20);
  1097. $def01 = $modules{DUOFERN}{defptr}{$code."00"};
  1098. if(!$def01) {
  1099. DoTrigger("global","UNDEFINED DUOFERN_$code"."_sensor DUOFERN $code"."00");
  1100. $def01 = $modules{DUOFERN}{defptr}{$code."00"};
  1101. }
  1102. $hash = $def01;
  1103. delete $hash->{READINGS}{configModified};
  1104. readingsSingleUpdate($hash, ".reg$reg", "$regVal", 1);
  1105. #readingsSingleUpdate($hash, "reg$reg", "$regVal", 1);
  1106. DUOFERN_DecodeWeatherSensorConfig($hash);
  1107. #Rauchmelder Batterie
  1108. } elsif ($msg =~ m/0FFF1323.{36}/) {
  1109. my $battery = (hex(substr($msg, 8, 2)) <= 10 ? "low" : "ok");
  1110. my $batteryLevel = hex(substr($msg, 8, 2));
  1111. readingsBeginUpdate($hash);
  1112. readingsBulkUpdate($hash, "battery", $battery, 1);
  1113. readingsBulkUpdate($hash, "batteryLevel", $batteryLevel, 1);
  1114. readingsEndUpdate($hash, 1); # Notify is done by Dispatch
  1115. #ACK, Befehl vom Aktor empfangen
  1116. } elsif ($msg =~ m/810003CC.{36}/) {
  1117. $hash->{helper}{timeout}{t} = AttrVal($hash->{NAME}, "timeout", "60");
  1118. InternalTimer(gettimeofday()+$hash->{helper}{timeout}{t}, "DUOFERN_StatusTimeout", $hash, 0);
  1119. $hash->{helper}{timeout}{count} = 4;
  1120. #NACK, Befehl nicht vom Aktor empfangen
  1121. } elsif ($msg =~ m/810108AA.{36}/) {
  1122. readingsSingleUpdate($hash, "state", "MISSING ACK", 1);
  1123. foreach (grep (/^channel_/, keys%{$hash})){
  1124. my $chnHash = $defs{$hash->{$_}};
  1125. readingsSingleUpdate($chnHash, "state", "MISSING ACK", 1);
  1126. }
  1127. Log3 $hash, 3, "DUOFERN error: $name MISSING ACK";
  1128. } else {
  1129. Log3 $hash, 3, "DUOFERN unknown msg: $msg";
  1130. }
  1131. DoTrigger($def01->{NAME}, undef) if ($def01);
  1132. DoTrigger($def02->{NAME}, undef) if ($def02);
  1133. return $name;
  1134. }
  1135. #####################################
  1136. sub
  1137. DUOFERN_DecodeWeatherSensorConfig($)
  1138. {
  1139. my ($hash) = @_;
  1140. my $name = $hash->{NAME};
  1141. my @regs;
  1142. for(my $x=0; $x<8; $x++) {
  1143. $regs[$x] = ReadingsVal($name, ".reg$x", "00000000000000000000");
  1144. }
  1145. my @tWind = map{hex($_)} unpack '(A2)*', substr($regs[6], 0,10);
  1146. my @tTemp = map{hex($_)} unpack '(A2)*', substr($regs[6], 10,10);
  1147. my @duskDawn = map{hex($_)} unpack '(A8)*', substr($regs[0],0,16).substr($regs[1],0,16).substr($regs[2],0,8);
  1148. my @tDawn;
  1149. my @tDusk;
  1150. my @tSun = map{hex($_)} unpack 'A8x2A8x2A8x2A8x2A8x2', $regs[3].$regs[4].$regs[5];
  1151. my @tSunDir = map{hex($_)} unpack 'x8A2x8A2x8A2x8A2x8A2', $regs[3].$regs[4].$regs[5];
  1152. my @tSunHeight = map{hex($_)} unpack 'x6A2x8A2x8A2x8A2x8A2', $regs[3].$regs[4].$regs[5];
  1153. for(my $x=0; $x<5; $x++){
  1154. $tWind[$x] = ($tWind[$x] & 0x20 ? ($tWind[$x] & 0x1F) : "off");
  1155. $tTemp[$x] = ($tTemp[$x] & 0x80 ? ($tTemp[$x] & 0x7F)-40 : "off");
  1156. $tDawn[$x] = ($duskDawn[$x] & 0x7F) +1;
  1157. $tDusk[$x] = (($duskDawn[$x]>>14) & 0x7F) +1;
  1158. $tDawn[$x] = "off" if(!($duskDawn[$x]>>28 & 0x1));
  1159. $tDusk[$x] = "off" if(!($duskDawn[$x]>>28 & 0x2));
  1160. if((($tSun[$x])>>28) & 0x2) {
  1161. my @temp;
  1162. push(@temp,((($tSun[$x])>>12) & 0x7F) + 1);
  1163. push(@temp,((($tSun[$x])>>19) & 0x1F) + 1);
  1164. push(@temp,((($tSun[$x])>>24) & 0x1F) + 1);
  1165. if($tSun[$x] & 0x40) {
  1166. push(@temp,((($tSun[$x])>>7) & 0x1F) -5);
  1167. }
  1168. $tSun[$x]=join(":",@temp);
  1169. } else {
  1170. $tSun[$x]="off";
  1171. }
  1172. if((($tSunDir[$x])>>4) & 0x07) {
  1173. my @temp;
  1174. push(@temp,(($tSunDir[$x])) & 0x0F);
  1175. push(@temp,(($tSunDir[$x])>>4) & 0x07);
  1176. $temp[0] =($temp[0]-$temp[1]) * 22.5;
  1177. $temp[1] = $temp[1] * 45;
  1178. $tSunDir[$x]=join(":",@temp);
  1179. } else {
  1180. $tSunDir[$x]="off";
  1181. }
  1182. if((($tSunHeight[$x])>>3) & 0x07) {
  1183. my @temp;
  1184. push(@temp,(($tSunHeight[$x])) & 0x07);
  1185. push(@temp,(($tSunHeight[$x])>>3) & 0x03);
  1186. $temp[0] =($temp[0]-$temp[1]) * 13;
  1187. $temp[1] = $temp[1] * 26;
  1188. $tSunHeight[$x]=join(":",@temp);
  1189. } else {
  1190. $tSunHeight[$x]="off";
  1191. }
  1192. }
  1193. my $tRain = (hex(substr($regs[6], 0, 2)) & 0x80 ? "on" : "off");
  1194. my $interval = (hex(substr($regs[7], 0, 2)) & 0x80 ? (hex(substr($regs[7], 0, 2)) & 0x7F) : "off");
  1195. my $DCF = (hex(substr($regs[7], 2, 2)) & 0x02 ? "on" : "off");
  1196. my $latitude = hex(substr($regs[7], 10, 2));
  1197. my $longitude = hex(substr($regs[7], 14, 2));
  1198. my $timezone = hex(substr($regs[7], 8, 2));
  1199. $latitude -= 256 if($latitude > 127);
  1200. $longitude -= 256 if($longitude > 127);
  1201. readingsBeginUpdate($hash);
  1202. readingsBulkUpdate($hash, "DCF", $DCF, 1);
  1203. readingsBulkUpdate($hash, "interval", $interval, 1);
  1204. readingsBulkUpdate($hash, "latitude", $latitude, 1);
  1205. readingsBulkUpdate($hash, "longitude", $longitude, 1);
  1206. readingsBulkUpdate($hash, "timezone", $timezone, 1);
  1207. readingsBulkUpdate($hash, "triggerRain", $tRain, 1);
  1208. readingsBulkUpdate($hash, "triggerTemperature", join(" ",@tTemp), 1);
  1209. readingsBulkUpdate($hash, "triggerWind", join(" ",@tWind), 1);
  1210. readingsBulkUpdate($hash, "triggerDusk", join(" ",@tDusk), 1);
  1211. readingsBulkUpdate($hash, "triggerDawn", join(" ",@tDawn), 1);
  1212. readingsBulkUpdate($hash, "triggerSun", join(" ",@tSun), 1);
  1213. readingsBulkUpdate($hash, "triggerSunDirection",join(" ",@tSunDir), 1);
  1214. readingsBulkUpdate($hash, "triggerSunHeight", join(" ",@tSunHeight),1);
  1215. readingsEndUpdate($hash, 1);
  1216. }
  1217. #####################################
  1218. sub
  1219. DUOFERN_StatusTimeout($)
  1220. {
  1221. my ($hash) = @_;
  1222. my $code = substr($hash->{CODE},0,6);
  1223. my $name = $hash->{NAME};
  1224. if ($hash->{helper}{timeout}{count} > 0) {
  1225. my $buf = $duoStatusRequest;
  1226. $buf =~ s/nn/$commandsStatus{getStatus}/;
  1227. $buf =~ s/yyyyyy/$code/;
  1228. if ($hash->{helper}{timeout}{cmd}) {
  1229. IOWrite( $hash, $hash->{helper}{timeout}{cmd} );
  1230. } else {
  1231. IOWrite( $hash, $buf );
  1232. }
  1233. $hash->{helper}{timeout}{count} -= 1;
  1234. InternalTimer(gettimeofday()+$hash->{helper}{timeout}{t}, "DUOFERN_StatusTimeout", $hash, 0);
  1235. Log3 $hash, 3, "DUOFERN no ACK, request Status";
  1236. } else {
  1237. readingsSingleUpdate($hash, "state", "MISSING STATUS", 1);
  1238. foreach (grep (/^channel_/, keys%{$hash})){
  1239. my $chnHash = $defs{$hash->{$_}};
  1240. readingsSingleUpdate($chnHash, "state", "MISSING STATUS", 1);
  1241. }
  1242. Log3 $hash, 3, "DUOFERN error: $name MISSING STATUS";
  1243. }
  1244. return undef;
  1245. }
  1246. 1;
  1247. =pod
  1248. =item summary controls Rademacher DuoFern devices
  1249. =item summary_DE steuert Rademacher DuoFern Ger&auml;te
  1250. =begin html
  1251. <a name="DUOFERN"></a>
  1252. <h3>DUOFERN</h3>
  1253. <ul>
  1254. Support for DuoFern devices via the <a href="#DUOFERNSTICK">DuoFern USB Stick</a>.<br>
  1255. <br><br>
  1256. <a name="DUOFERN_define"></a>
  1257. <b>Define</b>
  1258. <ul>
  1259. <code>define &lt;name&gt; DUOFERN &lt;code&gt;</code>
  1260. <br><br>
  1261. &lt;code&gt; specifies the radio code of the DuoFern device<br><br>
  1262. Example:<br>
  1263. <ul>
  1264. <code>define myDuoFern DUOFERN 49ABCD</code><br>
  1265. </ul>
  1266. </ul>
  1267. <br>
  1268. <a name="DUOFERN_set"></a>
  1269. <b>Set</b>
  1270. <ul>
  1271. <b>Universal commands (available to most actors):</b><br><br>
  1272. <ul>
  1273. <li><b>remotePair</b><br>
  1274. Activates the pairing mode of the actor.<br>
  1275. Some actors accept this command in unpaired mode up to two hours afte power up.
  1276. </li><br>
  1277. <li><b>remoteUnpair</b><br>
  1278. Activates the unpairing mode of the actor.
  1279. </li><br>
  1280. <li><b>getStatus</b><br>
  1281. Sends a status request message to the DuoFern device.
  1282. </li><br>
  1283. <li><b>manualMode [on|off]</b><br>
  1284. Activates the manual mode. If manual mode is active
  1285. all automatic functions will be ignored.
  1286. </li><br>
  1287. <li><b>timeAutomatic [on|off]</b><br>
  1288. Activates the timer automatic.
  1289. </li><br>
  1290. <li><b>sunAutomatic [on|off]</b><br>
  1291. Activates the sun automatic.
  1292. </li><br>
  1293. <li><b>dawnAutomatic [on|off]</b><br>
  1294. Activates the dawn automatic.
  1295. </li><br>
  1296. <li><b>duskAutomatic [on|off]</b><br>
  1297. Activates the dusk automatic.
  1298. </li><br>
  1299. <li><b>dusk</b><br>
  1300. Move roller shutter downwards or switch on switch/dimming actor
  1301. if duskAutomatic is activated.
  1302. </li><br>
  1303. <li><b>dawn</b><br>
  1304. Move roller shutter upwards or switch off switch/dimming actor
  1305. if dawnAutomatic is activated.
  1306. </li><br>
  1307. <li><b>sunMode [on|off]</b><br>
  1308. Activates the sun mode. If sun automatic is activated,
  1309. the roller shutter will move to the sunPosition or a switch/dimming
  1310. actor will shut off.
  1311. </li><br>
  1312. <li><b>reset [settings|full]</b><br>
  1313. settings: Clear all settings and endpoints of the actor.<br>
  1314. full: Complete reset of the actor including pairs.
  1315. </li><br>
  1316. </ul>
  1317. <b>Roller shutter actor commands:</b><br><br>
  1318. <ul>
  1319. <li><b>up [timer]</b><br>
  1320. Move the roller shutter upwards. If parameter <b>timer</b> is used the command will
  1321. only be executed if timeAutomatic is activated.
  1322. </li><br>
  1323. <li><b>down [timer]</b><br>
  1324. Move the roller shutter downwards. If parameter <b>timer</b> is used the command will
  1325. only be executed if timeAutomatic is activated.
  1326. </li><br>
  1327. <li><b>stop</b><br>
  1328. Stop motion.
  1329. </li><br>
  1330. <li><b>position &lt;value&gt; [timer]</b><br>
  1331. Set roller shutter to a desired absolut level. If parameter <b>timer</b> is used the
  1332. command will only be executed if timeAutomatic is activated.
  1333. </li><br>
  1334. <li><b>toggle</b><br>
  1335. Switch the roller shutter through the sequence up/stop/down/stop.
  1336. </li><br>
  1337. <li><b>rainAutomatic [on|off]</b><br>
  1338. Activates the rain automatic.
  1339. </li><br>
  1340. <li><b>windAutomatic [on|off]</b><br>
  1341. Activates the wind automatic.
  1342. </li><br>
  1343. <li><b>sunPosition &lt;value&gt;</b><br>
  1344. Set the sun position.
  1345. </li><br>
  1346. <li><b>ventilatingMode [on|off]</b><br>
  1347. Activates the ventilating mode. If activated, the roller
  1348. shutter will stop on ventilatingPosition when moving down.
  1349. </li><br>
  1350. <li><b>ventilatingPosition &lt;value&gt;</b><br>
  1351. Set the ventilating position.
  1352. </li><br>
  1353. <li><b>windMode [on|off]</b><br>
  1354. Activates the wind mode. If wind automatic and wind mode is
  1355. activated, the roller shutter moves in windDirection and ignore any automatic
  1356. or manual command.<br>
  1357. The wind mode ends 15 minutes after last activation automatically.
  1358. </li><br>
  1359. <li><b>windDirection [up|down]</b><br>
  1360. Movemet direction for wind mode.
  1361. </li><br>
  1362. <li><b>rainMode [on|off]</b><br>
  1363. Activates the rain mode. If rain automatic and rain mode is
  1364. activated, the roller shutter moves in rainDirection and ignore any automatic
  1365. command.<br>
  1366. The rain mode ends 15 minutes after last activation automatically.
  1367. </li><br>
  1368. <li><b>rainDirection [up|down]</b><br>
  1369. Movemet direction for rain mode.
  1370. </li><br>
  1371. <li><b>runningTime &lt;sec&gt;</b><br>
  1372. Set the motor running time.
  1373. </li><br>
  1374. <li><b>motorDeadTime [off|short|long]</b><br>
  1375. Set the motor dead time.
  1376. </li><br>
  1377. <li><b>reversal [on|off]</b><br>
  1378. Reversal of direction of rotation.
  1379. </li><br>
  1380. </ul>
  1381. <b>Switch/dimming actor commands:</b><br><br>
  1382. <ul>
  1383. <li><b>on [timer]</b><br>
  1384. Switch on the actor. If parameter <b>timer</b> is used the command will
  1385. only be executed if timeAutomatic is activated.
  1386. </li><br>
  1387. <li><b>off [timer]</b><br>
  1388. Switch off the actor. If parameter <b>timer</b> is used the command will
  1389. only be executed if timeAutomatic is activated.
  1390. </li><br>
  1391. <li><a href="#setExtensions">set extensions</a> are supported.
  1392. </li><br>
  1393. <li><b>level &lt;value&gt; [timer]</b><br>
  1394. Set actor to a desired absolut level. If parameter <b>timer</b> is used the
  1395. command will only be executed if timeAutomatic is activated.
  1396. </li><br>
  1397. <li><b>modeChange [on|off]</b><br>
  1398. Inverts the on/off state of a switch actor or change then modus of a dimming actor.
  1399. </li><br>
  1400. <li><b>stairwellFunction [on|off]</b><br>
  1401. Activates the stairwell function of a switch/dimming actor.
  1402. </li><br>
  1403. <li><b>stairwellTime &lt;sec&gt;</b><br>
  1404. Set the stairwell time.
  1405. </li><br>
  1406. </ul>
  1407. <b>Blind actor commands:</b><br><br>
  1408. <ul>
  1409. <li><b>blindsMode [on|off]</b><br>
  1410. Activates the blinds mode.
  1411. </li><br>
  1412. <li><b>slatPosition &lt;value&gt;</b><br>
  1413. Set the slat to a desired absolut level.
  1414. </li><br>
  1415. <li><b>defaultSlatPos &lt;value&gt;</b><br>
  1416. Set the default slat position.
  1417. </li><br>
  1418. <li><b>slatRunTime &lt;msec&gt;</b><br>
  1419. Set the slat running time.
  1420. </li><br>
  1421. <li><b>tiltInSunPos [on|off]</b><br>
  1422. Tilt slat after blind moved to sun position.
  1423. </li><br>
  1424. <li><b>tiltInVentPos [on|off]</b><br>
  1425. Tilt slat after blind moved to ventilation position.
  1426. </li><br>
  1427. <li><b>tiltAfterMoveLevel [on|off]</b><br>
  1428. Tilt slat after blind moved to an absolute position.
  1429. </li><br>
  1430. <li><b>tiltAfterStopDown [on|off]</b><br>
  1431. Tilt slat after stopping blind while moving down.
  1432. </li><br>
  1433. </ul>
  1434. <b>Thermostat commands:</b><br><br>
  1435. <ul>
  1436. <li><b>desired-temp &lt;temp&gt; [timer]</b><br>
  1437. Set desired temperature. &lt;temp&gt; must be between -40 and 80
  1438. Celsius, and precision is half a degree. If parameter <b>timer</b>
  1439. is used the command will only be executed if timeAutomatic is activated.
  1440. </li><br>
  1441. <li><b>tempUp [timer]</b><br>
  1442. Increases the desired temperature by half a degree. If parameter <b>timer</b>
  1443. is used the command will only be executed if timeAutomatic is activated.
  1444. </li><br>
  1445. <li><b>tempDown [timer]</b><br>
  1446. Decrease the desired temperature by half a degree. If parameter <b>timer</b>
  1447. is used the command will only be executed if timeAutomatic is activated.
  1448. </li><br>
  1449. <li><b>temperatureThreshold[1|2|3|4] &lt;temp&gt;</b><br>
  1450. Set temperature threshold 1 to 4. &lt;temp&gt; must be between -40 and 80
  1451. Celsius, and precision is half a degree.
  1452. </li><br>
  1453. <li><b>actTempLimit [timer]</b><br>
  1454. Set desired temperature to the selected temperatureThreshold. If parameter
  1455. <b>timer</b> is used the command will only be executed if timeAutomatic is
  1456. activated.
  1457. </li><br>
  1458. </ul>
  1459. <b>SX5 commands:</b><br><br>
  1460. <ul>
  1461. <li><b>10minuteAlarm [on|off]</b><br>
  1462. Activates the alarm sound of the SX5 when the door is left open for longer than 10 minutes.
  1463. </li><br>
  1464. <li><b>2000cycleAlarm [on|off]</b><br>
  1465. Activates the alarm sounds of the SX5 when the SX5 has run 2000 cycles.
  1466. </li><br>
  1467. <li><b>automaticClosing [off|30|60|90|120|150|180|210|240]</b><br>
  1468. Set the automatic closing time of the SX5 (sec).
  1469. </li><br>
  1470. <li><b>openSpeed [11|15|19]</b><br>
  1471. Set the open speed of the SX5 (cm/sec).
  1472. </li><br>
  1473. <li><b>backJump [on|off]</b><br>
  1474. If activated the SX5 moves briefly in the respective opposite direction after reaching the end point.
  1475. </li><br>
  1476. <li><b>getConfig</b><br>
  1477. Sends a config request message to the weather sensor.
  1478. </li><br>
  1479. </ul>
  1480. <b>Weather sensor commands:</b><br><br>
  1481. <ul>
  1482. <li><b>getConfig</b><br>
  1483. Sends a configuration request message.
  1484. </li><br>
  1485. <li><b>getTime</b><br>
  1486. Sends a time request message.
  1487. </li><br>
  1488. <li><b>getWeather</b><br>
  1489. Sends a weather data request message.
  1490. </li><br>
  1491. <li><b>writeConfig</b><br>
  1492. Write the configuration back to the weather sensor.
  1493. </li><br>
  1494. <li><b>DCF [on|off]</b><br>
  1495. Switch the DCF receiver on or off.
  1496. </li><br>
  1497. <li><b>time</b><br>
  1498. Set the current system time to the weather sensor.
  1499. </li><br>
  1500. <li><b>interval &lt;value&gt;</b><br>
  1501. Set the interval time for automatic transmittion of the weather data.<br>
  1502. &lt;value&gt;: off or 1 to 100 minutes
  1503. </li><br>
  1504. <li><b>latitude &lt;value&gt;</b><br>
  1505. Set the latitude of the weather sensor position<br>
  1506. &lt;value&gt;: 0 to 90
  1507. </li><br>
  1508. <li><b>longitude &lt;value&gt;</b><br>
  1509. Set the longitude of the weather sensor position<br>
  1510. &lt;value&gt;: -90 to 90
  1511. </li><br>
  1512. <li><b>timezone &lt;value&gt;</b><br>
  1513. Set the time zone of the weather sensor<br>
  1514. &lt;value&gt;: 0 to 23
  1515. </li><br>
  1516. <li><b>triggerDawn &lt;value1&gt; ... [&lt;value5&gt;]</b><br>
  1517. Sets up to 5 trigger values for a dawn event.<br>
  1518. &lt;value[n]&gt;: off or 1 to 100 lux
  1519. </li><br>
  1520. <li><b>triggerDusk &lt;value1&gt; ... [&lt;value5&gt;]</b><br>
  1521. Sets up to 5 trigger values for a dusk event.<br>
  1522. &lt;value[n]&gt;: off or 1 to 100 Lux
  1523. </li><br>
  1524. <li><b>triggerRain [on|off]</b><br>
  1525. Switch the trigger of the rain event on or off.
  1526. </li><br>
  1527. <li><b>triggerSun &lt;value1&gt;:&lt;sun1&gt;:&lt;shadow1&gt;[:&lt;temperature1&gt;] ... [&lt;value5&gt;:&lt;sun5&gt;:&lt;shadow5&gt;[:&lt;temperature5&gt;]]</b><br>
  1528. Sets up to 5 trigger values for a sun event.<br>
  1529. &lt;value[n]&gt;: off or 1 to 100 kLux<br>
  1530. &lt;sun[n]&gt;: time to detect sun, 1 to 30 minutes<br>
  1531. &lt;shadow[n]&gt;: time to detect shadow, 1 to 30 minutes<br>
  1532. &lt;temperature[n]&gt;: optional minimum temperature, -5 to 26 &deg;C
  1533. </li><br>
  1534. <li><b>triggerSunDirction &lt;startangle1&gt;:&lt;width1&gt; ... [&lt;startangle5&gt;:&lt;width5&gt;]</b><br>
  1535. If enabled, the respective sun event will only be triggered, if sunDirection is in the specified range.<br>
  1536. &lt;startangle[n]&gt;: off or 0 to 292.5 degrees (stepsize 22.5&deg;)<br>
  1537. &lt;width[n]&gt;: 45 to 180 degrees (stepsize 45&deg;)<br>
  1538. </li><br>
  1539. <li><b>triggerSunHeight &lt;startangle1&gt;:&lt;width1&gt; ... [&lt;startangle5&gt;:&lt;width5&gt;]</b><br>
  1540. If enabled, the respective sun event will only be triggered, if sunHeight is in the specified range.<br>
  1541. &lt;startangle[n]&gt;: off or 0 to 65 degrees (stepsize 13&deg;)<br>
  1542. &lt;width[n]&gt;: 26 or 52 degrees<br>
  1543. </li><br>
  1544. <li><b>triggerTemperature &lt;value1&gt; ... [&lt;value5&gt;]</b><br>
  1545. Sets up to 5 trigger values for a temperature event.<br>
  1546. &lt;value[n]&gt;: off or -40 to 80 &deg;C
  1547. </li><br>
  1548. <li><b>triggerWind &lt;value1&gt; ... [&lt;value5&gt;]</b><br>
  1549. Sets up to 5 trigger values for a wind event.<br>
  1550. &lt;value[n]&gt;: off or 1 to 31 m/s
  1551. </li><br>
  1552. </ul><br>
  1553. </ul>
  1554. <br>
  1555. <a name="DUOFERN_get"></a>
  1556. <b>Get</b> <ul>N/A</ul><br>
  1557. <a name="DUOFERN_attr"></a>
  1558. <b>Attributes</b>
  1559. <ul>
  1560. <li><a href="#IODev">IODev</a></li><br>
  1561. <li><b>timeout &lt;sec&gt;</b><br>
  1562. After sending a command to an actor, the actor must respond with its status within this time. If no status message is received,
  1563. up to two getStatus commands are resend.<br>
  1564. Default 60s.
  1565. </li><br>
  1566. <li><b>toggleUpDown</b><br>
  1567. If attribute is set, a stop command is send instead of the up or down command if the roller shutter is moving.
  1568. </li><br>
  1569. <li><b>positionInverse</b><br>
  1570. If attribute is set, the position value of the roller shutter is inverted.
  1571. </li><br>
  1572. </ul>
  1573. <br>
  1574. </ul>
  1575. =end html
  1576. =cut