30_DUOFERN.pm 83 KB

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