30_DUOFERN.pm 89 KB

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