30_DUOFERN.pm 83 KB

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