10_RESIDENTS.pm 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658
  1. ###############################################################################
  2. # $Id: 10_RESIDENTS.pm 14136 2017-04-29 16:31:46Z loredo $
  3. package main;
  4. use strict;
  5. use warnings;
  6. use Data::Dumper;
  7. use Time::Local;
  8. require RESIDENTStk;
  9. # initialize ##################################################################
  10. sub RESIDENTS_Initialize($) {
  11. my ($hash) = @_;
  12. $hash->{InitDevFn} = "RESIDENTStk_InitializeDev";
  13. $hash->{DefFn} = "RESIDENTStk_Define";
  14. $hash->{UndefFn} = "RESIDENTStk_Undefine";
  15. $hash->{SetFn} = "RESIDENTStk_Set";
  16. $hash->{AttrFn} = "RESIDENTStk_Attr";
  17. $hash->{NotifyFn} = "RESIDENTStk_Notify";
  18. $hash->{AttrPrefix} = "rgr_";
  19. $hash->{AttrList} =
  20. "disable:1,0 disabledForIntervals do_not_notify:1,0 "
  21. . "rgr_states:multiple-strict,home,gotosleep,asleep,awoken,absent,gone rgr_lang:EN,DE rgr_noDuration:0,1 rgr_showAllStates:0,1 rgr_wakeupDevice "
  22. . $readingFnAttributes;
  23. }
  24. # module Fn ####################################################################
  25. sub RESIDENTS_UpdateReadings (@) {
  26. my ($hash) = @_;
  27. my $name = $hash->{NAME};
  28. my $state = ReadingsVal( $name, "state", "none" );
  29. my $presence = ReadingsVal( $name, "presence", "absent" );
  30. my $state_home = 0;
  31. my $state_gotosleep = 0;
  32. my $state_asleep = 0;
  33. my $state_awoken = 0;
  34. my $state_absent = 0;
  35. my $state_gone = 0;
  36. my $state_total = 0;
  37. my $state_totalPresent = 0;
  38. my $state_totalAbsent = 0;
  39. my $state_totalGuests = 0;
  40. my $state_totalGuestsPresent = 0;
  41. my $state_totalGuestsAbsent = 0;
  42. my $state_totalRoommates = 0;
  43. my $state_totalRoommatesPresent = 0;
  44. my $state_totalRoommatesAbsent = 0;
  45. my $state_guestDev = 0;
  46. my $residentsDevs_home = "-";
  47. my $residentsDevs_absent = "-";
  48. my $residentsDevs_asleep = "-";
  49. my $residentsDevs_awoken = "-";
  50. my $residentsDevs_gone = "-";
  51. my $residentsDevs_gotosleep = "-";
  52. my $residentsDevs_wakeup = "-";
  53. my $residentsDevs_wayhome = "-";
  54. my $residentsDevs_wayhomeDelayed = "-";
  55. my $residentsDevs_totalAbsent = "-";
  56. my $residentsDevs_totalPresent = "-";
  57. my $residentsDevs_totalAbsentGuest = "-";
  58. my $residentsDevs_totalPresentGuest = "-";
  59. my $residentsDevs_totalAbsentRoommates = "-";
  60. my $residentsDevs_totalPresentRoommates = "-";
  61. my $residents_home = "-";
  62. my $residents_absent = "-";
  63. my $residents_asleep = "-";
  64. my $residents_awoken = "-";
  65. my $residents_gone = "-";
  66. my $residents_gotosleep = "-";
  67. my $residents_wakeup = "-";
  68. my $residents_wayhome = "-";
  69. my $residents_wayhomeDelayed = "-";
  70. my $residents_totalAbsent = "-";
  71. my $residents_totalPresent = "-";
  72. my $residents_totalAbsentGuest = "-";
  73. my $residents_totalPresentGuest = "-";
  74. my $residents_totalAbsentRoommates = "-";
  75. my $residents_totalPresentRoommates = "-";
  76. my $wayhome = 0;
  77. my $wayhomeDelayed = 0;
  78. my $wakeup = 0;
  79. my $newstate;
  80. my @registeredRoommates =
  81. split( /,/, $hash->{ROOMMATES} )
  82. if ( defined( $hash->{ROOMMATES} )
  83. && $hash->{ROOMMATES} ne "" );
  84. my @registeredGuests =
  85. split( /,/, $hash->{GUESTS} )
  86. if ( defined( $hash->{GUESTS} )
  87. && $hash->{GUESTS} ne "" );
  88. # count child states for ROOMMATE devices
  89. foreach my $roommate (@registeredRoommates) {
  90. $state_total++;
  91. $state_totalRoommates++;
  92. my $roommateName =
  93. AttrVal( $roommate,
  94. AttrVal( $roommate, "rr_realname", "group" ), "" );
  95. Log3 $name, 5,
  96. "RESIDENTS $name: considering $roommate for state change";
  97. if ( ReadingsVal( $roommate, "state", "initialized" ) eq "home" ) {
  98. $state_home++;
  99. $residentsDevs_home .= "," . $roommate
  100. if ( $residentsDevs_home ne "-" );
  101. $residentsDevs_home = $roommate
  102. if ( $residentsDevs_home eq "-" );
  103. $residents_home .= ", " . $roommateName
  104. if ( $roommateName ne "" && $residents_home ne "-" );
  105. $residents_home = $roommateName
  106. if ( $roommateName ne "" && $residents_home eq "-" );
  107. $state_totalPresent++;
  108. $state_totalRoommatesPresent++;
  109. $residentsDevs_totalPresent .= "," . $roommate
  110. if ( $residentsDevs_totalPresent ne "-" );
  111. $residentsDevs_totalPresent = $roommate
  112. if ( $residentsDevs_totalPresent eq "-" );
  113. $residentsDevs_totalPresentRoommates .= "," . $roommate
  114. if ( $residentsDevs_totalPresentRoommates ne "-" );
  115. $residentsDevs_totalPresentRoommates = $roommate
  116. if ( $residentsDevs_totalPresentRoommates eq "-" );
  117. $residents_totalPresent .= ", " . $roommateName
  118. if ( $roommateName ne "" && $residents_totalPresent ne "-" );
  119. $residents_totalPresent = $roommateName
  120. if ( $roommateName ne "" && $residents_totalPresent eq "-" );
  121. $residents_totalPresentRoommates .= ", " . $roommateName
  122. if ( $roommateName ne ""
  123. && $residents_totalPresentRoommates ne "-" );
  124. $residents_totalPresentRoommates = $roommateName
  125. if ( $roommateName ne ""
  126. && $residents_totalPresentRoommates eq "-" );
  127. }
  128. elsif (
  129. ReadingsVal( $roommate, "state", "initialized" ) eq "gotosleep" )
  130. {
  131. $state_gotosleep++;
  132. $residentsDevs_gotosleep .= "," . $roommate
  133. if ( $residentsDevs_gotosleep ne "-" );
  134. $residentsDevs_gotosleep = $roommate
  135. if ( $residentsDevs_gotosleep eq "-" );
  136. $residents_gotosleep .= ", " . $roommateName
  137. if ( $roommateName ne "" && $residents_gotosleep ne "-" );
  138. $residents_gotosleep = $roommateName
  139. if ( $roommateName ne "" && $residents_gotosleep eq "-" );
  140. $state_totalPresent++;
  141. $state_totalRoommatesPresent++;
  142. $residentsDevs_totalPresent .= "," . $roommate
  143. if ( $residentsDevs_totalPresent ne "-" );
  144. $residentsDevs_totalPresent = $roommate
  145. if ( $residentsDevs_totalPresent eq "-" );
  146. $residentsDevs_totalPresentRoommates .= "," . $roommate
  147. if ( $residentsDevs_totalPresentRoommates ne "-" );
  148. $residentsDevs_totalPresentRoommates = $roommate
  149. if ( $residentsDevs_totalPresentRoommates eq "-" );
  150. $residents_totalPresent .= ", " . $roommateName
  151. if ( $roommateName ne "" && $residents_totalPresent ne "-" );
  152. $residents_totalPresent = $roommateName
  153. if ( $roommateName ne "" && $residents_totalPresent eq "-" );
  154. $residents_totalPresentRoommates .= ", " . $roommateName
  155. if ( $roommateName ne ""
  156. && $residents_totalPresentRoommates ne "-" );
  157. $residents_totalPresentRoommates = $roommateName
  158. if ( $roommateName ne ""
  159. && $residents_totalPresentRoommates eq "-" );
  160. }
  161. elsif ( ReadingsVal( $roommate, "state", "initialized" ) eq "asleep" ) {
  162. $state_asleep++;
  163. $residentsDevs_asleep .= "," . $roommate
  164. if ( $residentsDevs_asleep ne "-" );
  165. $residentsDevs_asleep = $roommate
  166. if ( $residentsDevs_asleep eq "-" );
  167. $residents_asleep .= ", " . $roommateName
  168. if ( $roommateName ne "" && $residents_asleep ne "-" );
  169. $residents_asleep = $roommateName
  170. if ( $roommateName ne "" && $residents_asleep eq "-" );
  171. $state_totalPresent++;
  172. $state_totalRoommatesPresent++;
  173. $residentsDevs_totalPresent .= "," . $roommate
  174. if ( $residentsDevs_totalPresent ne "-" );
  175. $residentsDevs_totalPresent = $roommate
  176. if ( $residentsDevs_totalPresent eq "-" );
  177. $residentsDevs_totalPresentRoommates .= "," . $roommate
  178. if ( $residentsDevs_totalPresentRoommates ne "-" );
  179. $residentsDevs_totalPresentRoommates = $roommate
  180. if ( $residentsDevs_totalPresentRoommates eq "-" );
  181. $residents_totalPresent .= ", " . $roommateName
  182. if ( $roommateName ne "" && $residents_totalPresent ne "-" );
  183. $residents_totalPresent = $roommateName
  184. if ( $roommateName ne "" && $residents_totalPresent eq "-" );
  185. $residents_totalPresentRoommates .= ", " . $roommateName
  186. if ( $roommateName ne ""
  187. && $residents_totalPresentRoommates ne "-" );
  188. $residents_totalPresentRoommates = $roommateName
  189. if ( $roommateName ne ""
  190. && $residents_totalPresentRoommates eq "-" );
  191. }
  192. elsif ( ReadingsVal( $roommate, "state", "initialized" ) eq "awoken" ) {
  193. $state_awoken++;
  194. $residentsDevs_awoken .= "," . $roommate
  195. if ( $residentsDevs_awoken ne "-" );
  196. $residentsDevs_awoken = $roommate
  197. if ( $residentsDevs_awoken eq "-" );
  198. $residents_awoken .= ", " . $roommateName
  199. if ( $roommateName ne "" && $residents_awoken ne "-" );
  200. $residents_awoken = $roommateName
  201. if ( $roommateName ne "" && $residents_awoken eq "-" );
  202. $state_totalPresent++;
  203. $state_totalRoommatesPresent++;
  204. $residentsDevs_totalPresent .= "," . $roommate
  205. if ( $residentsDevs_totalPresent ne "-" );
  206. $residentsDevs_totalPresent = $roommate
  207. if ( $residentsDevs_totalPresent eq "-" );
  208. $residentsDevs_totalPresentRoommates .= "," . $roommate
  209. if ( $residentsDevs_totalPresentRoommates ne "-" );
  210. $residentsDevs_totalPresentRoommates = $roommate
  211. if ( $residentsDevs_totalPresentRoommates eq "-" );
  212. $residents_totalPresent .= ", " . $roommateName
  213. if ( $roommateName ne "" && $residents_totalPresent ne "-" );
  214. $residents_totalPresent = $roommateName
  215. if ( $roommateName ne "" && $residents_totalPresent eq "-" );
  216. $residents_totalPresentRoommates .= ", " . $roommateName
  217. if ( $roommateName ne ""
  218. && $residents_totalPresentRoommates ne "-" );
  219. $residents_totalPresentRoommates = $roommateName
  220. if ( $roommateName ne ""
  221. && $residents_totalPresentRoommates eq "-" );
  222. }
  223. elsif ( ReadingsVal( $roommate, "state", "initialized" ) eq "absent" ) {
  224. $state_absent++;
  225. $residentsDevs_absent .= "," . $roommate
  226. if ( $residentsDevs_absent ne "-" );
  227. $residentsDevs_absent = $roommate
  228. if ( $residentsDevs_absent eq "-" );
  229. $residents_absent .= ", " . $roommateName
  230. if ( $roommateName ne "" && $residents_absent ne "-" );
  231. $residents_absent = $roommateName
  232. if ( $roommateName ne "" && $residents_absent eq "-" );
  233. $state_totalAbsent++;
  234. $state_totalRoommatesAbsent++;
  235. $residentsDevs_totalAbsent .= "," . $roommate
  236. if ( $residentsDevs_totalAbsent ne "-" );
  237. $residentsDevs_totalAbsent = $roommate
  238. if ( $residentsDevs_totalAbsent eq "-" );
  239. $residentsDevs_totalAbsentRoommates .= "," . $roommate
  240. if ( $residentsDevs_totalAbsentRoommates ne "-" );
  241. $residentsDevs_totalAbsentRoommates = $roommate
  242. if ( $residentsDevs_totalAbsentRoommates eq "-" );
  243. $residents_totalAbsent .= ", " . $roommateName
  244. if ( $roommateName ne "" && $residents_totalAbsent ne "-" );
  245. $residents_totalAbsent = $roommateName
  246. if ( $roommateName ne "" && $residents_totalAbsent eq "-" );
  247. $residents_totalAbsentRoommates .= ", " . $roommateName
  248. if ( $roommateName ne ""
  249. && $residents_totalAbsentRoommates ne "-" );
  250. $residents_totalAbsentRoommates = $roommateName
  251. if ( $roommateName ne ""
  252. && $residents_totalAbsentRoommates eq "-" );
  253. }
  254. elsif ( ReadingsVal( $roommate, "state", "initialized" ) eq "gone" ) {
  255. $state_gone++;
  256. $residentsDevs_gone .= "," . $roommate
  257. if ( $residentsDevs_gone ne "-" );
  258. $residentsDevs_gone = $roommate
  259. if ( $residentsDevs_gone eq "-" );
  260. $residents_gone .= ", " . $roommateName
  261. if ( $roommateName ne "" && $residents_gone ne "-" );
  262. $residents_gone = $roommateName
  263. if ( $roommateName ne "" && $residents_gone eq "-" );
  264. $state_totalAbsent++;
  265. $state_totalRoommatesAbsent++;
  266. $residentsDevs_totalAbsent .= "," . $roommate
  267. if ( $residentsDevs_totalAbsent ne "-" );
  268. $residentsDevs_totalAbsent = $roommate
  269. if ( $residentsDevs_totalAbsent eq "-" );
  270. $residentsDevs_totalAbsentRoommates .= "," . $roommate
  271. if ( $residentsDevs_totalAbsentRoommates ne "-" );
  272. $residentsDevs_totalAbsentRoommates = $roommate
  273. if ( $residentsDevs_totalAbsentRoommates eq "-" );
  274. $residents_totalAbsent .= ", " . $roommateName
  275. if ( $roommateName ne "" && $residents_totalAbsent ne "-" );
  276. $residents_totalAbsent = $roommateName
  277. if ( $roommateName ne "" && $residents_totalAbsent eq "-" );
  278. $residents_totalAbsentRoommates .= ", " . $roommateName
  279. if ( $roommateName ne ""
  280. && $residents_totalAbsentRoommates ne "-" );
  281. $residents_totalAbsentRoommates = $roommateName
  282. if ( $roommateName ne ""
  283. && $residents_totalAbsentRoommates eq "-" );
  284. }
  285. if ( ReadingsVal( $roommate, "wakeup", "0" ) > 0 ) {
  286. $wakeup++;
  287. $residentsDevs_wakeup .= "," . $roommate
  288. if ( $residentsDevs_wakeup ne "-" );
  289. $residentsDevs_wakeup = $roommate
  290. if ( $residentsDevs_wakeup eq "-" );
  291. $residents_wakeup .= ", " . $roommateName
  292. if ( $roommateName ne "" && $residents_wakeup ne "-" );
  293. $residents_wakeup = $roommateName
  294. if ( $roommateName ne "" && $residents_wakeup eq "-" );
  295. }
  296. if ( ReadingsVal( $roommate, "wayhome", "0" ) > 0 ) {
  297. $wayhome++;
  298. $residentsDevs_wayhome .= "," . $roommate
  299. if ( $residentsDevs_wayhome ne "-" );
  300. $residentsDevs_wayhome = $roommate
  301. if ( $residentsDevs_wayhome eq "-" );
  302. $residents_wayhome .= ", " . $roommateName
  303. if ( $roommateName ne "" && $residents_wayhome ne "-" );
  304. $residents_wayhome = $roommateName
  305. if ( $roommateName ne "" && $residents_wayhome eq "-" );
  306. if ( ReadingsVal( $roommate, "wayhome", "0" ) == 2 ) {
  307. $wayhomeDelayed++;
  308. $residentsDevs_wayhomeDelayed .= "," . $roommate
  309. if ( $residentsDevs_wayhomeDelayed ne "-" );
  310. $residentsDevs_wayhomeDelayed = $roommate
  311. if ( $residentsDevs_wayhomeDelayed eq "-" );
  312. $residents_wayhomeDelayed .= ", " . $roommateName
  313. if ( $roommateName ne ""
  314. && $residents_wayhomeDelayed ne "-" );
  315. $residents_wayhomeDelayed = $roommateName
  316. if ( $roommateName ne ""
  317. && $residents_wayhomeDelayed eq "-" );
  318. }
  319. }
  320. }
  321. # count child states for GUEST devices
  322. foreach my $guest (@registeredGuests) {
  323. $state_guestDev++;
  324. my $guestName =
  325. AttrVal( $guest, AttrVal( $guest, "rg_realname", "group" ), "" );
  326. Log3 $name, 5, "RESIDENTS $name: considering $guest for state change";
  327. if ( ReadingsVal( $guest, "state", "initialized" ) eq "home" ) {
  328. $state_home++;
  329. $state_totalPresent++;
  330. $state_totalGuestsPresent++;
  331. $state_totalGuests++;
  332. $state_total++;
  333. $residentsDevs_totalPresentGuest .= "," . $guest
  334. if ( $residentsDevs_totalPresentGuest ne "-" );
  335. $residentsDevs_totalPresentGuest = $guest
  336. if ( $residentsDevs_totalPresentGuest eq "-" );
  337. $residents_totalPresentGuest .= ", " . $guestName
  338. if ( $guestName ne ""
  339. && $residents_totalPresentGuest ne "-" );
  340. $residents_totalPresentGuest = $guestName
  341. if ( $guestName ne ""
  342. && $residents_totalPresentGuest eq "-" );
  343. $residentsDevs_totalPresent .= "," . $guest
  344. if ( $residentsDevs_totalPresent ne "-" );
  345. $residentsDevs_totalPresent = $guest
  346. if ( $residentsDevs_totalPresent eq "-" );
  347. $residents_totalPresent .= ", " . $guestName
  348. if ( $guestName ne ""
  349. && $residents_totalPresent ne "-" );
  350. $residents_totalPresent = $guestName
  351. if ( $guestName ne ""
  352. && $residents_totalPresent eq "-" );
  353. }
  354. elsif ( ReadingsVal( $guest, "state", "initialized" ) eq "gotosleep" ) {
  355. $state_gotosleep++;
  356. $state_totalPresent++;
  357. $state_totalGuestsPresent++;
  358. $state_totalGuests++;
  359. $state_total++;
  360. $residentsDevs_totalPresentGuest .= "," . $guest
  361. if ( $residentsDevs_totalPresentGuest ne "-" );
  362. $residentsDevs_totalPresentGuest = $guest
  363. if ( $residentsDevs_totalPresentGuest eq "-" );
  364. $residents_totalPresentGuest .= ", " . $guestName
  365. if ( $guestName ne ""
  366. && $residents_totalPresentGuest ne "-" );
  367. $residents_totalPresentGuest = $guestName
  368. if ( $guestName ne ""
  369. && $residents_totalPresentGuest eq "-" );
  370. $residentsDevs_totalPresent .= "," . $guest
  371. if ( $residentsDevs_totalPresent ne "-" );
  372. $residentsDevs_totalPresent = $guest
  373. if ( $residentsDevs_totalPresent eq "-" );
  374. $residents_totalPresent .= ", " . $guestName
  375. if ( $guestName ne ""
  376. && $residents_totalPresent ne "-" );
  377. $residents_totalPresent = $guestName
  378. if ( $guestName ne ""
  379. && $residents_totalPresent eq "-" );
  380. }
  381. elsif ( ReadingsVal( $guest, "state", "initialized" ) eq "asleep" ) {
  382. $state_asleep++;
  383. $state_totalPresent++;
  384. $state_totalGuestsPresent++;
  385. $state_totalGuests++;
  386. $state_total++;
  387. $residentsDevs_totalPresentGuest .= "," . $guest
  388. if ( $residentsDevs_totalPresentGuest ne "-" );
  389. $residentsDevs_totalPresentGuest = $guest
  390. if ( $residentsDevs_totalPresentGuest eq "-" );
  391. $residents_totalPresentGuest .= ", " . $guestName
  392. if ( $guestName ne ""
  393. && $residents_totalPresentGuest ne "-" );
  394. $residents_totalPresentGuest = $guestName
  395. if ( $guestName ne ""
  396. && $residents_totalPresentGuest eq "-" );
  397. $residentsDevs_totalPresent .= "," . $guest
  398. if ( $residentsDevs_totalPresent ne "-" );
  399. $residentsDevs_totalPresent = $guest
  400. if ( $residentsDevs_totalPresent eq "-" );
  401. $residents_totalPresent .= ", " . $guestName
  402. if ( $guestName ne ""
  403. && $residents_totalPresent ne "-" );
  404. $residents_totalPresent = $guestName
  405. if ( $guestName ne ""
  406. && $residents_totalPresent eq "-" );
  407. }
  408. elsif ( ReadingsVal( $guest, "state", "initialized" ) eq "awoken" ) {
  409. $state_awoken++;
  410. $state_totalPresent++;
  411. $state_totalGuestsPresent++;
  412. $state_totalGuests++;
  413. $state_total++;
  414. $residentsDevs_totalPresentGuest .= "," . $guest
  415. if ( $residentsDevs_totalPresentGuest ne "-" );
  416. $residentsDevs_totalPresentGuest = $guest
  417. if ( $residentsDevs_totalPresentGuest eq "-" );
  418. $residents_totalPresentGuest .= ", " . $guestName
  419. if ( $guestName ne ""
  420. && $residents_totalPresentGuest ne "-" );
  421. $residents_totalPresentGuest = $guestName
  422. if ( $guestName ne ""
  423. && $residents_totalPresentGuest eq "-" );
  424. $residentsDevs_totalPresent .= "," . $guest
  425. if ( $residentsDevs_totalPresent ne "-" );
  426. $residentsDevs_totalPresent = $guest
  427. if ( $residentsDevs_totalPresent eq "-" );
  428. $residents_totalPresent .= ", " . $guestName
  429. if ( $guestName ne ""
  430. && $residents_totalPresent ne "-" );
  431. $residents_totalPresent = $guestName
  432. if ( $guestName ne ""
  433. && $residents_totalPresent eq "-" );
  434. }
  435. elsif ( ReadingsVal( $guest, "state", "initialized" ) eq "absent" ) {
  436. $state_absent++;
  437. $state_totalAbsent++;
  438. $state_totalGuestsAbsent++;
  439. $state_totalGuests++;
  440. $state_total++;
  441. $residentsDevs_totalAbsentGuest .= "," . $guest
  442. if ( $residentsDevs_totalAbsentGuest ne "-" );
  443. $residentsDevs_totalAbsentGuest = $guest
  444. if ( $residentsDevs_totalAbsentGuest eq "-" );
  445. $residents_totalAbsentGuest .= ", " . $guestName
  446. if ( $guestName ne ""
  447. && $residents_totalAbsentGuest ne "-" );
  448. $residents_totalAbsentGuest = $guestName
  449. if ( $guestName ne ""
  450. && $residents_totalAbsentGuest eq "-" );
  451. $residentsDevs_totalAbsent .= "," . $guest
  452. if ( $residentsDevs_totalAbsent ne "-" );
  453. $residentsDevs_totalAbsent = $guest
  454. if ( $residentsDevs_totalAbsent eq "-" );
  455. $residents_totalAbsent .= ", " . $guestName
  456. if ( $guestName ne ""
  457. && $residents_totalAbsent ne "-" );
  458. $residents_totalAbsent = $guestName
  459. if ( $guestName ne ""
  460. && $residents_totalAbsent eq "-" );
  461. }
  462. if ( ReadingsVal( $guest, "wakeup", "0" ) > 0 ) {
  463. $wakeup++;
  464. $residentsDevs_wakeup .= "," . $guest
  465. if ( $residentsDevs_wakeup ne "-" );
  466. $residentsDevs_wakeup = $guest
  467. if ( $residentsDevs_wakeup eq "-" );
  468. $residents_wakeup .= ", " . $guestName
  469. if ( $guestName ne "" && $residents_wakeup ne "-" );
  470. $residents_wakeup = $guestName
  471. if ( $guestName ne "" && $residents_wakeup eq "-" );
  472. }
  473. if ( ReadingsVal( $guest, "wayhome", "0" ) > 0 ) {
  474. $wayhome++;
  475. $residents_wayhome .= "," . $guest
  476. if ( $residents_wayhome ne "-" );
  477. $residents_wayhome = $guest if ( $residents_wayhome eq "-" );
  478. $residents_wayhome .= ", " . $guestName
  479. if ( $guestName ne "" && $residents_wayhome ne "-" );
  480. $residents_wayhome = $guestName
  481. if ( $guestName ne "" && $residents_wayhome eq "-" );
  482. if ( ReadingsVal( $guest, "wayhome", "0" ) == 2 ) {
  483. $wayhomeDelayed++;
  484. $residentsDevs_wayhomeDelayed .= "," . $guest
  485. if ( $residentsDevs_wayhomeDelayed ne "-" );
  486. $residentsDevs_wayhomeDelayed = $guest
  487. if ( $residentsDevs_wayhomeDelayed eq "-" );
  488. $residents_wayhomeDelayed .= ", " . $guestName
  489. if ( $guestName ne ""
  490. && $residents_wayhomeDelayed ne "-" );
  491. $residents_wayhomeDelayed = $guestName
  492. if ( $guestName ne ""
  493. && $residents_wayhomeDelayed eq "-" );
  494. }
  495. }
  496. }
  497. # update counter
  498. readingsBulkUpdateIfChanged( $hash, "residentsTotal", $state_total );
  499. readingsBulkUpdateIfChanged( $hash, "residentsTotalGuests",
  500. $state_totalGuests );
  501. readingsBulkUpdateIfChanged( $hash, "residentsTotalGuestsPresent",
  502. $state_totalGuestsPresent );
  503. readingsBulkUpdateIfChanged(
  504. $hash,
  505. "residentsTotalGuestsPresentDevs",
  506. $residentsDevs_totalPresentGuest
  507. );
  508. readingsBulkUpdateIfChanged( $hash, "residentsTotalGuestsPresentNames",
  509. $residents_totalPresentGuest );
  510. readingsBulkUpdateIfChanged( $hash, "residentsTotalGuestsAbsent",
  511. $state_totalGuestsAbsent );
  512. readingsBulkUpdateIfChanged(
  513. $hash,
  514. "residentsTotalGuestsAbsentDevs",
  515. $residentsDevs_totalAbsentGuest
  516. );
  517. readingsBulkUpdateIfChanged( $hash, "residentsTotalGuestsAbsentNames",
  518. $residents_totalAbsentGuest );
  519. readingsBulkUpdateIfChanged( $hash, "residentsTotalRoommates",
  520. $state_totalRoommates );
  521. readingsBulkUpdateIfChanged( $hash, "residentsTotalRoommatesPresent",
  522. $state_totalRoommatesPresent );
  523. readingsBulkUpdateIfChanged(
  524. $hash,
  525. "residentsTotalRoommatesPresentDevs",
  526. $residentsDevs_totalPresentRoommates
  527. );
  528. readingsBulkUpdateIfChanged(
  529. $hash,
  530. "residentsTotalRoommatesPresentNames",
  531. $residents_totalPresentRoommates
  532. );
  533. readingsBulkUpdateIfChanged( $hash, "residentsTotalRoommatesAbsent",
  534. $state_totalRoommatesAbsent );
  535. readingsBulkUpdateIfChanged(
  536. $hash,
  537. "residentsTotalRoommatesAbsentDevs",
  538. $residentsDevs_totalAbsentRoommates
  539. );
  540. readingsBulkUpdateIfChanged(
  541. $hash,
  542. "residentsTotalRoommatesAbsentNames",
  543. $residents_totalAbsentRoommates
  544. );
  545. readingsBulkUpdateIfChanged( $hash, "residentsTotalPresent",
  546. $state_totalPresent );
  547. readingsBulkUpdateIfChanged( $hash, "residentsTotalPresentDevs",
  548. $residentsDevs_totalPresent );
  549. readingsBulkUpdateIfChanged( $hash, "residentsTotalPresentNames",
  550. $residents_totalPresent );
  551. readingsBulkUpdateIfChanged( $hash, "residentsTotalAbsent",
  552. $state_totalAbsent );
  553. readingsBulkUpdateIfChanged( $hash, "residentsTotalAbsentDevs",
  554. $residentsDevs_totalAbsent );
  555. readingsBulkUpdateIfChanged( $hash, "residentsTotalAbsentNames",
  556. $residents_totalAbsent );
  557. readingsBulkUpdateIfChanged( $hash, "residentsHome", $state_home );
  558. readingsBulkUpdateIfChanged( $hash, "residentsHomeDevs",
  559. $residentsDevs_home );
  560. readingsBulkUpdateIfChanged( $hash, "residentsHomeNames", $residents_home );
  561. readingsBulkUpdateIfChanged( $hash, "residentsGotosleep",
  562. $state_gotosleep );
  563. readingsBulkUpdateIfChanged( $hash, "residentsGotosleepDevs",
  564. $residentsDevs_gotosleep );
  565. readingsBulkUpdateIfChanged( $hash, "residentsGotosleepNames",
  566. $residents_gotosleep );
  567. readingsBulkUpdateIfChanged( $hash, "residentsAsleep", $state_asleep );
  568. readingsBulkUpdateIfChanged( $hash, "residentsAsleepDevs",
  569. $residentsDevs_asleep );
  570. readingsBulkUpdateIfChanged( $hash, "residentsAsleepNames",
  571. $residents_asleep );
  572. readingsBulkUpdateIfChanged( $hash, "residentsAwoken", $state_awoken );
  573. readingsBulkUpdateIfChanged( $hash, "residentsAwokenDevs",
  574. $residentsDevs_awoken );
  575. readingsBulkUpdateIfChanged( $hash, "residentsAwokenNames",
  576. $residents_awoken );
  577. readingsBulkUpdateIfChanged( $hash, "residentsAbsent", $state_absent );
  578. readingsBulkUpdateIfChanged( $hash, "residentsAbsentDevs",
  579. $residentsDevs_absent );
  580. readingsBulkUpdateIfChanged( $hash, "residentsAbsentNames",
  581. $residents_absent );
  582. readingsBulkUpdateIfChanged( $hash, "residentsGone", $state_gone );
  583. readingsBulkUpdateIfChanged( $hash, "residentsGoneDevs",
  584. $residentsDevs_gone );
  585. readingsBulkUpdateIfChanged( $hash, "residentsGoneNames", $residents_gone );
  586. readingsBulkUpdateIfChanged( $hash, "residentsTotalWakeup", $wakeup );
  587. readingsBulkUpdateIfChanged( $hash, "residentsTotalWakeupDevs",
  588. $residentsDevs_wakeup );
  589. readingsBulkUpdateIfChanged( $hash, "residentsTotalWakeupNames",
  590. $residents_wakeup );
  591. readingsBulkUpdateIfChanged( $hash, "residentsTotalWayhome", $wayhome );
  592. readingsBulkUpdateIfChanged( $hash, "residentsTotalWayhomeDevs",
  593. $residentsDevs_wayhome );
  594. readingsBulkUpdateIfChanged( $hash, "residentsTotalWayhomeNames",
  595. $residents_wayhome );
  596. readingsBulkUpdateIfChanged( $hash, "residentsTotalWayhomeDelayed",
  597. $wayhomeDelayed );
  598. readingsBulkUpdateIfChanged( $hash, "residentsTotalWayhomeDelayedDevs",
  599. $residentsDevs_wayhomeDelayed );
  600. readingsBulkUpdateIfChanged( $hash, "residentsTotalWayhomeDelayedNames",
  601. $residents_wayhomeDelayed );
  602. #
  603. # state calculation
  604. #
  605. # gotosleep
  606. if ( $state_home == 0
  607. && $state_gotosleep > 0
  608. && $state_asleep >= 0
  609. && $state_awoken == 0 )
  610. {
  611. $newstate = "gotosleep";
  612. }
  613. # asleep
  614. elsif ($state_home == 0
  615. && $state_gotosleep == 0
  616. && $state_asleep > 0
  617. && $state_awoken == 0 )
  618. {
  619. $newstate = "asleep";
  620. }
  621. # awoken
  622. elsif ($state_home == 0
  623. && $state_gotosleep >= 0
  624. && $state_asleep >= 0
  625. && $state_awoken > 0 )
  626. {
  627. $newstate = "awoken";
  628. }
  629. # general presence
  630. elsif ($state_home > 0
  631. || $state_gotosleep > 0
  632. || $state_asleep > 0
  633. || $state_awoken > 0 )
  634. {
  635. $newstate = "home";
  636. }
  637. # absent
  638. elsif ($state_absent > 0
  639. && $state_home == 0
  640. && $state_gotosleep == 0
  641. && $state_asleep == 0
  642. && $state_awoken == 0 )
  643. {
  644. $newstate = "absent";
  645. }
  646. # gone
  647. elsif ($state_gone > 0
  648. && $state_absent == 0
  649. && $state_home == 0
  650. && $state_gotosleep == 0
  651. && $state_asleep == 0
  652. && $state_awoken == 0 )
  653. {
  654. $newstate = "gone";
  655. }
  656. # none
  657. elsif ($state_totalGuests == 0
  658. && $state_totalRoommates == 0
  659. && $state_gone == 0
  660. && $state_absent == 0
  661. && $state_home == 0
  662. && $state_gotosleep == 0
  663. && $state_asleep == 0
  664. && $state_awoken == 0 )
  665. {
  666. $newstate = "none";
  667. }
  668. # unspecified; this should not happen
  669. else {
  670. $newstate = "unspecified";
  671. }
  672. # calculate presence state
  673. my $newpresence =
  674. ( $newstate ne "none" && $newstate ne "gone" && $newstate ne "absent" )
  675. ? "present"
  676. : "absent";
  677. Log3 $name, 4,
  678. "RESIDENTS $name: calculation result - residentsTotal:$state_total residentsTotalRoommates:$state_totalRoommates residentsTotalRoommatesPresent:$state_totalRoommatesPresent residentsTotalRoommatesAbsent:$state_totalRoommatesAbsent residentsTotalGuests:$state_totalGuests residentsTotalGuestsPresent:$state_totalGuestsPresent residentsTotalGuestsAbsent:$state_totalGuestsAbsent residentsTotalPresent:$state_totalPresent residentsTotalAbsent:$state_totalAbsent residentsHome:$state_home residentsGotosleep:$state_gotosleep residentsAsleep:$state_asleep residentsAwoken:$state_awoken residentsAbsent:$state_absent residentsGone:$state_gone presence:$newpresence state:$newstate";
  679. # safe current time
  680. my $datetime = FmtDateTime(time);
  681. # if state changed
  682. if ( $state ne $newstate ) {
  683. # stop any running wakeup-timers in case state changed
  684. my $wakeupState = AttrVal( $name, "wakeup", 0 );
  685. if ($wakeupState) {
  686. my $wakeupDeviceList = AttrVal( $name, "rgr_wakeupDevice", 0 );
  687. for my $wakeupDevice ( split /,/, $wakeupDeviceList ) {
  688. next if !$wakeupDevice;
  689. if ( IsDevice( $wakeupDevice, "dummy" ) ) {
  690. # forced-stop only if resident is not present anymore
  691. if ( $newpresence eq "present" ) {
  692. fhem "set $wakeupDevice:FILTER=running!=0 end";
  693. }
  694. else {
  695. fhem "set $wakeupDevice:FILTER=running!=0 stop";
  696. }
  697. }
  698. }
  699. }
  700. # if newstate is asleep, start sleep timer
  701. readingsBulkUpdate( $hash, "lastSleep", $datetime )
  702. if ( $newstate eq "asleep" );
  703. # if prior state was asleep, update sleep statistics
  704. if ( $state eq "asleep"
  705. && ReadingsVal( $name, "lastSleep", "" ) ne "" )
  706. {
  707. readingsBulkUpdate( $hash, "lastAwake", $datetime );
  708. readingsBulkUpdate(
  709. $hash,
  710. "lastDurSleep",
  711. RESIDENTStk_TimeDiff(
  712. $datetime, ReadingsVal( $name, "lastSleep", "" )
  713. )
  714. );
  715. readingsBulkUpdate(
  716. $hash,
  717. "lastDurSleep_cr",
  718. RESIDENTStk_TimeDiff(
  719. $datetime, ReadingsVal( $name, "lastSleep", "" ), "min"
  720. )
  721. );
  722. }
  723. readingsBulkUpdate( $hash, "lastState",
  724. ReadingsVal( $name, "state", "initialized" ) );
  725. readingsBulkUpdate( $hash, "state", $newstate );
  726. }
  727. # if presence changed
  728. if ( $newpresence ne $presence ) {
  729. readingsBulkUpdate( $hash, "presence", $newpresence );
  730. # update statistics
  731. if ( $newpresence eq "present" ) {
  732. readingsBulkUpdate( $hash, "lastArrival", $datetime );
  733. # absence duration
  734. if ( ReadingsVal( $name, "lastDeparture", "-" ) ne "-" ) {
  735. readingsBulkUpdate(
  736. $hash,
  737. "lastDurAbsence",
  738. RESIDENTStk_TimeDiff(
  739. $datetime, ReadingsVal( $name, "lastDeparture", "-" )
  740. )
  741. );
  742. readingsBulkUpdate(
  743. $hash,
  744. "lastDurAbsence_cr",
  745. RESIDENTStk_TimeDiff(
  746. $datetime, ReadingsVal( $name, "lastDeparture", "-" ),
  747. "min"
  748. )
  749. );
  750. }
  751. }
  752. else {
  753. readingsBulkUpdate( $hash, "lastDeparture", $datetime );
  754. # presence duration
  755. if ( ReadingsVal( $name, "lastArrival", "-" ) ne "-" ) {
  756. readingsBulkUpdate(
  757. $hash,
  758. "lastDurPresence",
  759. RESIDENTStk_TimeDiff(
  760. $datetime, ReadingsVal( $name, "lastArrival", "-" )
  761. )
  762. );
  763. readingsBulkUpdate(
  764. $hash,
  765. "lastDurPresence_cr",
  766. RESIDENTStk_TimeDiff(
  767. $datetime, ReadingsVal( $name, "lastArrival", "-" ),
  768. "min"
  769. )
  770. );
  771. }
  772. }
  773. }
  774. # calculate duration timers
  775. RESIDENTStk_DurationTimer( $hash, 1 );
  776. }
  777. 1;
  778. =pod
  779. =item helper
  780. =item summary combines ROOMMATE and GUEST devices to a residential community
  781. =item summary_de fasst ROOMMATE und GUEST Geräte zu einer Wohngemeinschaft zusammen
  782. =begin html
  783. <p>
  784. <a name="RESIDENTS" id="RESIDENTS"></a>
  785. </p>
  786. <h3>
  787. RESIDENTS
  788. </h3>
  789. <ul>
  790. <a name="RESIDENTSdefine" id="RESIDENTSdefine"></a> <b>Define</b>
  791. <ul>
  792. <code>define &lt;rgr_ResidentsName&gt; RESIDENTS</code><br>
  793. <br>
  794. Provides a special virtual device to represent a group of individuals living at your home.<br>
  795. It locically combines individual states of <a href="#ROOMMATE">ROOMMATE</a> and <a href="#GUEST">GUEST</a> devices and allows state changes for all members.<br>
  796. Based on the current state and other readings, you may trigger other actions within FHEM.<br>
  797. <br>
  798. Example:<br>
  799. <ul>
  800. <code># Standalone<br>
  801. define rgr_Residents RESIDENTS</code>
  802. </ul>
  803. </ul><br>
  804. <br>
  805. <a name="RESIDENTSset" id="RESIDENTSset"></a> <b>Set</b>
  806. <ul>
  807. <code>set &lt;rgr_ResidentsName&gt; &lt;command&gt; [&lt;parameter&gt;]</code><br>
  808. <br>
  809. Currently, the following commands are defined.<br>
  810. <ul>
  811. <li>
  812. <b>addGuest</b> &nbsp;&nbsp;-&nbsp;&nbsp; creates a new GUEST device and adds it to the current RESIDENTS group. Just enter the dummy name and there you go.
  813. </li>
  814. <li>
  815. <b>addRoommate</b> &nbsp;&nbsp;-&nbsp;&nbsp; creates a new ROOMMATE device and adds it to the current RESIDENTS group. Just enter the first name and there you go.
  816. </li>
  817. <li>
  818. <b>removeGuest</b> &nbsp;&nbsp;-&nbsp;&nbsp; shows all GUEST members and allows to delete their dummy devices easily.
  819. </li>
  820. <li>
  821. <b>removeRoommate</b> &nbsp;&nbsp;-&nbsp;&nbsp; shows all ROOMMATE members and allows to delete their dummy devices easily.
  822. </li>
  823. <li>
  824. <b>state</b> &nbsp;&nbsp;home,gotosleep,asleep,awoken,absent,gone&nbsp;&nbsp; switch between states for all group members at once; see attribute rgr_states to adjust list shown in FHEMWEB
  825. </li>
  826. <li>
  827. <b>create</b> &nbsp;&nbsp;wakeuptimer&nbsp;&nbsp; add several pre-configurations provided by RESIDENTS Toolkit. See separate section for details.
  828. </li>
  829. </ul>
  830. <ul>
  831. <u>Note:</u> If you would like to restrict access to admin set-commands (-> addGuest, addRoommate, removeGuest, create) you may set your FHEMWEB instance's attribute allowedCommands like 'set,set-user'.
  832. The string 'set-user' will ensure only non-admin set-commands can be executed when accessing FHEM using this FHEMWEB instance.
  833. </ul>
  834. </ul><br>
  835. <br>
  836. <ul>
  837. <u>Possible states and their meaning</u><br>
  838. <br>
  839. <ul>
  840. This module differs between 7 states:<br>
  841. <br>
  842. <ul>
  843. <li>
  844. <b>home</b> - residents are present at home and at least one of them is not asleep
  845. </li>
  846. <li>
  847. <b>gotosleep</b> - present residents are on their way to bed (if they are not asleep already)
  848. </li>
  849. <li>
  850. <b>asleep</b> - all present residents are currently sleeping
  851. </li>
  852. <li>
  853. <b>awoken</b> - at least one resident just woke up from sleep
  854. </li>
  855. <li>
  856. <b>absent</b> - no resident is currently at home but at least one will be back shortly
  857. </li>
  858. <li>
  859. <b>gone</b> - all residents left home for longer period
  860. </li>
  861. <li>
  862. <b>none</b> - no active member
  863. </li>
  864. </ul><br>
  865. <br>
  866. Note: State 'none' cannot explicitly be set. Setting state to 'gone' will be handled as 'none' for GUEST member devices.
  867. </ul>
  868. </ul><br>
  869. <br>
  870. <a name="RESIDENTSattr" id="RESIDENTSattr"></a> <b>Attributes</b><br>
  871. <ul>
  872. <ul>
  873. <li>
  874. <b>rgr_lang</b> - overwrite global language setting; helps to set device attributes to translate FHEMWEB display text
  875. </li>
  876. <li>
  877. <b>rgr_noDuration</b> - may be used to disable continuous, non-event driven duration timer calculation (see readings durTimer*)
  878. </li>
  879. <li>
  880. <b>rgr_showAllStates</b> - states 'asleep' and 'awoken' are hidden by default to allow simple gotosleep process via devStateIcon; defaults to 0
  881. </li>
  882. <li>
  883. <b>rgr_states</b> - list of states to be shown in FHEMWEB; separate entries by comma only and do NOT use spaces; unsupported states will lead to errors though
  884. </li>
  885. <li>
  886. <b>rgr_wakeupDevice</b> - reference to enslaved DUMMY devices used as a wake-up timer (part of RESIDENTS Toolkit's wakeuptimer)
  887. </li>
  888. </ul>
  889. </ul><br>
  890. <br>
  891. <br>
  892. <b>Generated Readings/Events:</b><br>
  893. <ul>
  894. <ul>
  895. <li>
  896. <b>lastActivity</b> - the last state change of one of the group members
  897. </li>
  898. <li>
  899. <b>lastActivityBy</b> - the realname of the last group member with changed state
  900. </li>
  901. <li>
  902. <b>lastArrival</b> - timestamp of last arrival at home
  903. </li>
  904. <li>
  905. <b>lastAwake</b> - timestamp of last sleep cycle end
  906. </li>
  907. <li>
  908. <b>lastDeparture</b> - timestamp of last departure from home
  909. </li>
  910. <li>
  911. <b>lastDurAbsence</b> - duration of last absence from home in human readable format (hours:minutes:seconds)
  912. </li>
  913. <li>
  914. <b>lastDurAbsence_cr</b> - duration of last absence from home in computer readable format (minutes)
  915. </li>
  916. <li>
  917. <b>lastDurPresence</b> - duration of last presence at home in human readable format (hours:minutes:seconds)
  918. </li>
  919. <li>
  920. <b>lastDurPresence_cr</b> - duration of last presence at home in computer readable format (minutes)
  921. </li>
  922. <li>
  923. <b>lastDurSleep</b> - duration of last sleep in human readable format (hours:minutes:seconds)
  924. </li>
  925. <li>
  926. <b>lastDurSleep_cr</b> - duration of last sleep in computer readable format (minutes)
  927. </li>
  928. <li>
  929. <b>lastSleep</b> - timestamp of last sleep cycle begin
  930. </li>
  931. <li>
  932. <b>lastState</b> - the prior state
  933. </li>
  934. <li>
  935. <b>lastWakeup</b> - time of last wake-up timer run
  936. </li>
  937. <li>
  938. <b>lastWakeupDev</b> - device name of last wake-up timer
  939. </li>
  940. <li>
  941. <b>nextWakeup</b> - time of next wake-up program run
  942. </li>
  943. <li>
  944. <b>nextWakeupDev</b> - device name for next wake-up program run
  945. </li>
  946. <li>
  947. <b>presence</b> - reflects the home presence state, depending on value of reading 'state' (can be 'present' or 'absent')
  948. </li>
  949. <li>
  950. <b>residentsAbsent</b> - number of residents with state 'absent'
  951. </li>
  952. <li>
  953. <b>residentsAbsentDevs</b> - device name of residents with state 'absent'
  954. </li>
  955. <li>
  956. <b>residentsAbsentNames</b> - device alias of residents with state 'absent'
  957. </li>
  958. <li>
  959. <b>residentsAsleep</b> - number of residents with state 'asleep'
  960. </li>
  961. <li>
  962. <b>residentsAsleepDevs</b> - device name of residents with state 'asleep'
  963. </li>
  964. <li>
  965. <b>residentsAsleepNames</b> - device alias of residents with state 'asleep'
  966. </li>
  967. <li>
  968. <b>residentsAwoken</b> - number of residents with state 'awoken'
  969. </li>
  970. <li>
  971. <b>residentsAwokenDevs</b> - device name of residents with state 'awoken'
  972. </li>
  973. <li>
  974. <b>residentsAwokenNames</b> - device alias of residents with state 'awoken'
  975. </li>
  976. <li>
  977. <b>residentsGone</b> - number of residents with state 'gone'
  978. </li>
  979. <li>
  980. <b>residentsGoneDevs</b> - device name of residents with state 'gone'
  981. </li>
  982. <li>
  983. <b>residentsGoneNames</b> - device alias of residents with state 'gone'
  984. </li>
  985. <li>
  986. <b>residentsGotosleep</b> - number of residents with state 'gotosleep'
  987. </li>
  988. <li>
  989. <b>residentsGotosleepDevs</b> - device name of residents with state 'gotosleep'
  990. </li>
  991. <li>
  992. <b>residentsGotosleepNames</b> - device alias of residents with state 'gotosleep'
  993. </li>
  994. <li>
  995. <b>residentsHome</b> - number of residents with state 'home'
  996. </li>
  997. <li>
  998. <b>residentsHomeDevs</b> - device name of residents with state 'home'
  999. </li>
  1000. <li>
  1001. <b>residentsHomeNames</b> - device alias of residents with state 'home'
  1002. </li>
  1003. <li>
  1004. <b>residentsTotal</b> - total number of all active residents despite their current state
  1005. </li>
  1006. <li>
  1007. <b>residentsTotalAbsent</b> - number of all residents who are currently underway
  1008. </li>
  1009. <li>
  1010. <b>residentsTotalAbsentDevs</b> - device name of all residents who are currently underway
  1011. </li>
  1012. <li>
  1013. <b>residentsTotalAbsentNames</b> - device alias of all residents who are currently underway
  1014. </li>
  1015. <li>
  1016. <b>residentsTotalGuests</b> - number of active guests who are currently treated as part of the residents scope
  1017. </li>
  1018. <li>
  1019. <b>residentsTotalGuestsAbsent</b> - number of all active guests who are currently underway
  1020. </li>
  1021. <li>
  1022. <b>residentsTotalGuestsAbsentDevs</b> - device name of all active guests who are currently underway
  1023. </li>
  1024. <li>
  1025. <b>residentsTotalGuestsAbsentNames</b> - device alias of all active guests who are currently underway
  1026. </li>
  1027. <li>
  1028. <b>residentsTotalGuestsPresent</b> - number of all active guests who are currently at home
  1029. </li>
  1030. <li>
  1031. <b>residentsTotalGuestsPresentDevs</b> - device name of all active guests who are currently at home
  1032. </li>
  1033. <li>
  1034. <b>residentsTotalGuestsPresentNames</b> - device alias of all active guests who are currently at home
  1035. </li>
  1036. <li>
  1037. <b>residentsTotalRoommates</b> - number of residents treated as being a permanent resident
  1038. </li>
  1039. <li>
  1040. <b>residentsTotalRoommatesAbsent</b> - number of all roommates who are currently underway
  1041. </li>
  1042. <li>
  1043. <b>residentsTotalRoommatesAbsentDevs</b> - device name of all roommates who are currently underway
  1044. </li>
  1045. <li>
  1046. <b>residentsTotalRoommatesAbsentNames</b> - device alias of all roommates who are currently underway
  1047. </li>
  1048. <li>
  1049. <b>residentsTotalRoommatesPresent</b> - number of all roommates who are currently at home
  1050. </li>
  1051. <li>
  1052. <b>residentsTotalRoommatesPresentDevs</b> - device name of all roommates who are currently at home
  1053. </li>
  1054. <li>
  1055. <b>residentsTotalRoommatesPresentNames</b> - device alias of all roommates who are currently at home
  1056. </li>
  1057. <li>
  1058. <b>residentsTotalPresent</b> - number of all residents who are currently at home
  1059. </li>
  1060. <li>
  1061. <b>residentsTotalPresentDevs</b> - device name of all residents who are currently at home
  1062. </li>
  1063. <li>
  1064. <b>residentsTotalPresentNames</b> - device alias of all residents who are currently at home
  1065. </li>
  1066. <li>
  1067. <b>residentsTotalWakeup</b> - number of all residents which currently have a wake-up program being executed
  1068. </li>
  1069. <li>
  1070. <b>residentsTotalWakeupDevs</b> - device name of all residents which currently have a wake-up program being executed
  1071. </li>
  1072. <li>
  1073. <b>residentsTotalWakeupNames</b> - device alias of all residents which currently have a wake-up program being executed
  1074. </li>
  1075. <li>
  1076. <b>residentsTotalWayhome</b> - number of all active residents who are currently on their way back home
  1077. </li>
  1078. <li>
  1079. <b>residentsTotalWayhomeDevs</b> - device name of all active residents who are currently on their way back home
  1080. </li>
  1081. <li>
  1082. <b>residentsTotalWayhomeNames</b> - device alias of all active residents who are currently on their way back home
  1083. </li>
  1084. <li>
  1085. <b>residentsTotalWayhomeDelayed</b> - number of all residents who are delayed on their way back home
  1086. </li>
  1087. <li>
  1088. <b>residentsTotalWayhomeDelayedDevs</b> - device name of all delayed residents who are currently on their way back home
  1089. </li>
  1090. <li>
  1091. <b>residentsTotalWayhomeDelayedNames</b> - device alias of all delayed residents who are currently on their way back home
  1092. </li>
  1093. <li>
  1094. <b>state</b> - reflects the current state
  1095. </li>
  1096. <li>
  1097. <b>wakeup</b> - becomes '1' while a wake-up program of this resident group is being executed
  1098. </li>
  1099. </ul>
  1100. </ul>
  1101. <br>
  1102. <br>
  1103. <b>RESIDENTS Toolkit</b><br>
  1104. <ul>
  1105. <ul>
  1106. Using set-command <code>create</code> you may add pre-configured configurations to your RESIDENTS, <a href="#ROOMMATE">ROOMMATE</a> or <a href="#GUEST">GUEST</a> devices for your convenience.<br>
  1107. The following commands are currently available:<br>
  1108. <br>
  1109. <li>
  1110. <b>wakeuptimer</b> &nbsp;&nbsp;-&nbsp;&nbsp; adds a wake-up timer dummy device with enhanced functions to start with wake-up automations
  1111. <ul>
  1112. A notify device is created to be used as a Macro to carry out your actual automations. The macro is triggered by a normal at device you may customize as well. However, a special RESIDENTS Toolkit function is handling the wake-up trigger event for you.<br>
  1113. The time of activated wake-up timers may be relatively increased or decreased by using +<MINUTES> or -<MINUTES> respectively. +HH:MM can be used as well.<br>
  1114. <br>
  1115. The wake-up behaviour may be influenced by the following device attributes:<br>
  1116. <li>
  1117. <i>wakeupAtdevice</i> - backlink the at device (mandatory)
  1118. </li>
  1119. <li>
  1120. <i>wakeupDays</i> - only trigger macro at these days. Mon=1,Tue=2,Wed=3,Thu=4,Fri=5,Sat=6,Sun=0 (optional)
  1121. </li>
  1122. <li>
  1123. <i>wakeupDefaultTime</i> - after triggering macro reset the wake-up time to this default value (optional)
  1124. </li>
  1125. <li>
  1126. <i>wakeupEnforced</i> - Enforce wake-up (optional; 0=no, 1=yes, 2=if wake-up time is not wakeupDefaultTime, 3=if wake-up time is earlier than wakeupDefaultTime)
  1127. </li>
  1128. <li>
  1129. <i>wakeupHolidays</i> - May trigger macro on holidays or non-holidays (optional; andHoliday=on holidays also considering wakeupDays, orHoliday=on holidays independently of wakeupDays, andNoHoliday=on non-holidays also considering wakeupDays, orNoHoliday=on non-holidays independently of wakeupDays)
  1130. </li>
  1131. <li>
  1132. <i>wakeupMacro</i> - name of the notify macro device (mandatory)
  1133. </li>
  1134. <li>
  1135. <i>wakeupOffset</i> - value in minutes to trigger your macro earlier than the user requested to be woken up, e.g. if you have a complex wake-up program over 30 minutes (defaults to 0)
  1136. </li>
  1137. <li>
  1138. <i>wakeupResetSwitcher</i> - DUMMY device to quickly turn on/off reset function (optional, device will be auto-created)
  1139. </li>
  1140. <li>
  1141. <i>wakeupResetdays</i> - if wakeupDefaultTime is set you may restrict timer reset to specific days only. Mon=1,Tue=2,Wed=3,Thu=4,Fri=5,Sat=6,Sun=0 (optional)
  1142. </li>
  1143. <li>
  1144. <i>wakeupUserdevice</i> - backlink to RESIDENTS, ROOMMATE or GUEST device to check it's status (mandatory)
  1145. </li>
  1146. <li>
  1147. <i>wakeupWaitPeriod</i> - waiting period threshold in minutes until wake-up program may be triggered again, e.g. if you manually set an earlier wake-up time than normal while using wakeupDefaultTime. Does not apply in case wake-up time was changed during this period; defaults to 360 minutes / 6h (optional)
  1148. </li>
  1149. </ul>
  1150. </li>
  1151. </ul>
  1152. </ul>
  1153. </ul>
  1154. =end html
  1155. =begin html_DE
  1156. <p>
  1157. <a name="RESIDENTS" id="RESIDENTS"></a>
  1158. </p>
  1159. <h3>
  1160. RESIDENTS
  1161. </h3>
  1162. <ul>
  1163. <a name="RESIDENTSdefine" id="RESIDENTSdefine"></a> <b>Define</b>
  1164. <ul>
  1165. <code>define &lt;rgr_ResidentsName&gt; RESIDENTS</code><br>
  1166. <br>
  1167. Stellt ein spezielles virtuelles Device bereit, um eine Gruppe von Personen zu repr&auml;sentieren, die zusammen wohnen.<br>
  1168. Es kombiniert dabei logisch die individuellen Status von <a href="#ROOMMATE">ROOMMATE</a> und <a href="#GUEST">GUEST</a> Devices und erlaubt den Status f&uuml;r alle Mitglieder zeitgleich zu &auml;ndern. Basierend auf dem aktuellen Status und anderen Readings k&ouml;nnen andere Aktionen innerhalb von FHEM angestoßen werden.<br>
  1169. <br>
  1170. Beispiele:<br>
  1171. <ul>
  1172. <code># Einzeln<br>
  1173. define rgr_Residents RESIDENTS</code>
  1174. </ul>
  1175. </ul><br>
  1176. <br>
  1177. <a name="RESIDENTSset" id="RESIDENTSset"></a> <b>Set</b>
  1178. <ul>
  1179. <code>set &lt;rgr_ResidentsName&gt; &lt;command&gt; [&lt;parameter&gt;]</code><br>
  1180. <br>
  1181. Momentan sind die folgenden Kommandos definiert.<br>
  1182. <ul>
  1183. <li>
  1184. <b>addGuest</b> &nbsp;&nbsp;-&nbsp;&nbsp; erstellt ein neues GUEST Device und f&uuml;gt es der aktuellen RESIDENTS Gruppe hinzu. Einfach den Platzhalternamen eingeben und das wars.
  1185. </li>
  1186. <li>
  1187. <b>addRoommate</b> &nbsp;&nbsp;-&nbsp;&nbsp; erstellt ein neues ROOMMATE Device und f&uuml;gt es der aktuellen RESIDENTS Gruppe hinzu. Einfach den Vornamen eingeben und das wars.
  1188. </li>
  1189. <li>
  1190. <b>removeGuest</b> &nbsp;&nbsp;-&nbsp;&nbsp; zeigt alle Mitglieder vom Typ GUEST an und erm&ouml;glicht ein einfaches l&ouml;schen des dazugeh&ouml;rigen Dummy Devices.
  1191. </li>
  1192. <li>
  1193. <b>removeRoommate</b> &nbsp;&nbsp;-&nbsp;&nbsp; zeigt alle Mitglieder vom Typ ROOMMATE an und erm&ouml;glicht ein einfaches l&ouml;schen des dazugeh&ouml;rigen Dummy Devices.
  1194. </li>
  1195. <li>
  1196. <b>state</b> &nbsp;&nbsp;home,gotosleep,asleep,awoken,absent,gone&nbsp;&nbsp; wechselt den Status f&uuml;r alle Gruppenmitglieder gleichzeitig; siehe Attribut rgr_states, um die angezeigte Liste in FHEMWEB abzu&auml;ndern
  1197. </li>
  1198. <li>
  1199. <b>create</b> &nbsp;&nbsp;wakeuptimer&nbsp;&nbsp; f&uuml;gt diverse Vorkonfigurationen auf Basis von RESIDENTS Toolkit hinzu. Siehe separate Sektion.
  1200. </li>
  1201. </ul>
  1202. <ul>
  1203. <u>Hinweis:</u> Sofern der Zugriff auf administrative set-Kommandos (-> addGuest, addRoommate, removeGuest, create) eingeschr&auml;nkt werden soll, kann in einer FHEMWEB Instanz das Attribut allowedCommands &auml;hnlich wie 'set,set-user' erweitert werden.
  1204. Die Zeichenfolge 'set-user' stellt dabei sicher, dass beim Zugriff auf FHEM &uuml;ber diese FHEMWEB Instanz nur nicht-administrative set-Kommandos ausgef&uuml;hrt werden k&ouml;nnen.
  1205. </ul>
  1206. </ul><br>
  1207. <br>
  1208. <ul>
  1209. <u>M&ouml;gliche Status und ihre Bedeutung</u><br>
  1210. <br>
  1211. <ul>
  1212. Dieses Modul unterscheidet 7 verschiedene Status:<br>
  1213. <br>
  1214. <ul>
  1215. <li>
  1216. <b>home</b> - Bewohner sind zu Hause und mindestens einer schl&auml;ft nicht
  1217. </li>
  1218. <li>
  1219. <b>gotosleep</b> - alle anwesenden Bewohner sind auf dem Weg ins Bett (wenn sie nicht schon schlafen)
  1220. </li>
  1221. <li>
  1222. <b>asleep</b> - alle anwesenden Bewohner schlafen
  1223. </li>
  1224. <li>
  1225. <b>awoken</b> - mindestens einer der anwesenden Bewohner ist gerade aufgewacht
  1226. </li>
  1227. <li>
  1228. <b>absent</b> - keiner der Bewohner ist momentan zu Hause; mindestens einer ist aber in K&uuml;rze zur&uuml;ck
  1229. </li>
  1230. <li>
  1231. <b>gone</b> - alle Bewohner sind f&uuml;r l&auml;ngere Zeit verreist
  1232. </li>
  1233. <li>
  1234. <b>none</b> - kein Mitglied aktiv
  1235. </li>
  1236. </ul><br>
  1237. <br>
  1238. Hinweis: Der Status 'none' kann nicht explizit gesetzt werden. Das setzen von 'gone' wird bei Mitgliedern vom Typ GUEST als 'none' behandelt.
  1239. </ul>
  1240. </ul><br>
  1241. <br>
  1242. <a name="RESIDENTSattr" id="RESIDENTSattr"></a> <b>Attribute</b><br>
  1243. <ul>
  1244. <ul>
  1245. <li>
  1246. <b>rgr_lang</b> - &uuml;berschreibt globale Spracheinstellung; hilft beim setzen von Device Attributen, um FHEMWEB Anzeigetext zu &uuml;bersetzen
  1247. </li>
  1248. <li>
  1249. <b>rgr_noDuration</b> - deaktiviert die kontinuierliche, nicht Event-basierte Berechnung der Zeitspannen (siehe Readings durTimer*)
  1250. </li>
  1251. <li>
  1252. <b>rgr_showAllStates</b> - die Status 'asleep' und 'awoken' sind normalerweise nicht immer sichtbar, um einen einfachen Zubettgeh-Prozess &uuml;ber das devStateIcon Attribut zu erm&ouml;glichen; Standard ist 0
  1253. </li>
  1254. <li>
  1255. <b>rgr_states</b> - Liste aller in FHEMWEB angezeigter Status; Eintrage nur mit Komma trennen und KEINE Leerzeichen benutzen; nicht unterst&uuml;tzte Status f&uuml;hren zu Fehlern
  1256. </li>
  1257. <li>
  1258. <b>rgr_wakeupDevice</b> - Referenz zu versklavten DUMMY Ger&auml;ten, welche als Wecker benutzt werden (Teil von RESIDENTS Toolkit's wakeuptimer)
  1259. </li>
  1260. </ul>
  1261. </ul><br>
  1262. <br>
  1263. <br>
  1264. <b>Generierte Readings/Events:</b><br>
  1265. <ul>
  1266. <ul>
  1267. <li>
  1268. <b>lastActivity</b> - der letzte Status Wechsel eines Gruppenmitglieds
  1269. </li>
  1270. <li>
  1271. <b>lastActivityBy</b> - der Name des Gruppenmitglieds, dessen Status zuletzt ge&auml;ndert wurde
  1272. </li>
  1273. <li>
  1274. <b>lastArrival</b> - Zeitstempel der letzten Ankunft zu Hause
  1275. </li>
  1276. <li>
  1277. <b>lastAwake</b> - Zeitstempel des Endes des letzten Schlafzyklus
  1278. </li>
  1279. <li>
  1280. <b>lastDeparture</b> - Zeitstempel des letzten Verlassens des Zuhauses
  1281. </li>
  1282. <li>
  1283. <b>lastDurAbsence</b> - Dauer der letzten Abwesenheit in normal lesbarem Format (Stunden:Minuten:Sekunden)
  1284. </li>
  1285. <li>
  1286. <b>lastDurAbsence_cr</b> - Dauer der letzten Abwesenheit in Computer lesbarem Format (Minuten)
  1287. </li>
  1288. <li>
  1289. <b>lastDurPresence</b> - Dauer der letzten Anwesenheit in normal lesbarem Format (Stunden:Minuten:Sekunden)
  1290. </li>
  1291. <li>
  1292. <b>lastDurPresence_cr</b> - Dauer der letzten Anwesenheit in Computer lesbarem Format (Minuten)
  1293. </li>
  1294. <li>
  1295. <b>lastDurSleep</b> - Dauer des letzten Schlafzyklus in normal lesbarem Format (Stunden:Minuten:Sekunden)
  1296. </li>
  1297. <li>
  1298. <b>lastDurSleep_cr</b> - Dauer des letzten Schlafzyklus in Computer lesbarem Format (Minuten)
  1299. </li>
  1300. <li>
  1301. <b>lastSleep</b> - Zeitstempel des Beginns des letzten Schlafzyklus
  1302. </li>
  1303. <li>
  1304. <b>lastState</b> - der vorherige Status
  1305. </li>
  1306. <li>
  1307. <b>lastWakeup</b> - Zeit der letzten Wake-up Timer Ausf&uuml;hring
  1308. </li>
  1309. <li>
  1310. <b>lastWakeupDev</b> - Device Name des zuletzt verwendeten Wake-up Timers
  1311. </li>
  1312. <li>
  1313. <b>nextWakeup</b> - Zeit der n&auml;chsten Wake-up Timer Ausf&uuml;hrung
  1314. </li>
  1315. <li>
  1316. <b>nextWakeupDev</b> - Device Name des als n&auml;chstes ausgef&auml;hrten Wake-up Timer
  1317. </li>
  1318. <li>
  1319. <b>presence</b> - gibt den zu Hause Status in Abh&auml;ngigkeit des Readings 'state' wieder (kann 'present' oder 'absent' sein)
  1320. </li>
  1321. <li>
  1322. <b>residentsAbsent</b> - Anzahl der Bewohner mit Status 'absent'
  1323. </li>
  1324. <li>
  1325. <b>residentsAbsentDevs</b> - Ger&auml;tename der Bewohner mit Status 'absent'
  1326. </li>
  1327. <li>
  1328. <b>residentsAbsentNames</b> - Ger&auml;tealias der Bewohner mit Status 'absent'
  1329. </li>
  1330. <li>
  1331. <b>residentsAsleep</b> - Anzahl der Bewohner mit Status 'asleep'
  1332. </li>
  1333. <li>
  1334. <b>residentsAsleepDevs</b> - Ger&auml;tename der Bewohner mit Status 'asleep'
  1335. </li>
  1336. <li>
  1337. <b>residentsAsleepNames</b> - Ger&auml;tealias der Bewohner mit Status 'asleep'
  1338. </li>
  1339. <li>
  1340. <b>residentsAwoken</b> - Anzahl der Bewohner mit Status 'awoken'
  1341. </li>
  1342. <li>
  1343. <b>residentsAwokenDevs</b> - Ger&auml;tename der Bewohner mit Status 'awoken'
  1344. </li>
  1345. <li>
  1346. <b>residentsAwokenNames</b> - Ger&auml;tealias der Bewohner mit Status 'awoken'
  1347. </li>
  1348. <li>
  1349. <b>residentsGone</b> - Anzahl der Bewohner mit Status 'gone'
  1350. </li>
  1351. <li>
  1352. <b>residentsGoneDevs</b> - Ger&auml;tename der Bewohner mit Status 'gone'
  1353. </li>
  1354. <li>
  1355. <b>residentsGoneNames</b> - Ger&auml;tealias der Bewohner mit Status 'gone'
  1356. </li>
  1357. <li>
  1358. <b>residentsGotosleep</b> - Anzahl der Bewohner mit Status 'gotosleep'
  1359. </li>
  1360. <li>
  1361. <b>residentsGotosleepDevs</b> - Ger&auml;tename der Bewohner mit Status 'gotosleep'
  1362. </li>
  1363. <li>
  1364. <b>residentsGotosleepNames</b> - Ger&auml;tealias der Bewohner mit Status 'gotosleep'
  1365. </li>
  1366. <li>
  1367. <b>residentsHome</b> - Anzahl der Bewohner mit Status 'home'
  1368. </li>
  1369. <li>
  1370. <b>residentsHomeDevs</b> - Ger&auml;tename der Bewohner mit Status 'home'
  1371. </li>
  1372. <li>
  1373. <b>residentsHomeNames</b> - Ger&auml;tealias der Bewohner mit Status 'home'
  1374. </li>
  1375. <li>
  1376. <b>residentsTotal</b> - Summe aller aktiven Bewohner unabh&auml;ngig von ihrem aktuellen Status
  1377. </li>
  1378. <li>
  1379. <b>residentsTotalAbsent</b> - Summe aller aktiven Bewohner, die unterwegs sind
  1380. </li>
  1381. <li>
  1382. <b>residentsTotalAbsentDevs</b> - Ger&auml;tename aller aktiven Bewohner, die unterwegs sind
  1383. </li>
  1384. <li>
  1385. <b>residentsTotalAbsentNames</b> - Ger&auml;tealias aller aktiven Bewohner, die unterwegs sind
  1386. </li>
  1387. <li>
  1388. <b>residentsTotalGuests</b> - Anzahl der aktiven G&auml;ste, welche momentan du den Bewohnern dazugez&auml;hlt werden
  1389. </li>
  1390. <li>
  1391. <b>residentsTotalGuestsAbsent</b> - Anzahl der aktiven G&auml;ste, die momentan unterwegs sind
  1392. </li>
  1393. <li>
  1394. <b>residentsTotalGuestsAbsentDevs</b> - Ger&auml;tename der aktiven G&auml;ste, die momentan unterwegs sind
  1395. </li>
  1396. <li>
  1397. <b>residentsTotalGuestsAbsentNames</b> - Ger&auml;tealias der aktiven G&auml;ste, die momentan unterwegs sind
  1398. </li>
  1399. <li>
  1400. <b>residentsTotalGuestsPresent</b> - Anzahl der aktiven G&auml;ste, die momentan zu Hause sind
  1401. </li>
  1402. <li>
  1403. <b>residentsTotalGuestsPresentDevs</b> - Ger&auml;tename der aktiven G&auml;ste, die momentan zu Hause sind
  1404. </li>
  1405. <li>
  1406. <b>residentsTotalGuestsPresentNames</b> - Ger&auml;tealias der aktiven G&auml;ste, die momentan zu Hause sind
  1407. </li>
  1408. <li>
  1409. <b>residentsTotalRoommates</b> - Anzahl der Bewohner, die als permanente Bewohner behandelt werden
  1410. </li>
  1411. <li>
  1412. <b>residentsTotalRoommatesAbsent</b> - Anzahl der Besitzer, die momentan unterwegs sind
  1413. </li>
  1414. <li>
  1415. <b>residentsTotalRoommatesAbsentDevs</b> - Ger&auml;tename der Besitzer, die momentan unterwegs sind
  1416. </li>
  1417. <li>
  1418. <b>residentsTotalRoommatesAbsentNames</b> - Ger&auml;tealias der Besitzer, die momentan unterwegs sind
  1419. </li>
  1420. <li>
  1421. <b>residentsTotalRoommatesPresent</b> - Anzahl der Besitzer, die momentan zu Hause sind
  1422. </li>
  1423. <li>
  1424. <b>residentsTotalRoommatesPresentDevs</b> - Ger&auml;tename der Besitzer, die momentan zu Hause sind
  1425. </li>
  1426. <li>
  1427. <b>residentsTotalRoommatesPresentNames</b> - Ger&auml;tealias der Besitzer, die momentan zu Hause sind
  1428. </li>
  1429. <li>
  1430. <b>residentsTotalPresent</b> - Summe aller aktiven Bewohner, die momentan zu Hause sind
  1431. </li>
  1432. <li>
  1433. <b>residentsTotalPresentDevs</b> - Ger&auml;tename aller aktiven Bewohner, die momentan zu Hause sind
  1434. </li>
  1435. <li>
  1436. <b>residentsTotalPresentNames</b> - Ger&auml;tealias aller aktiven Bewohner, die momentan zu Hause sind
  1437. </li>
  1438. <li>
  1439. <b>residentsTotalWakeup</b> - Summe aller Bewohner, bei denen aktuell ein Weckprogramm ausgef&uuml;hrt wird
  1440. </li>
  1441. <li>
  1442. <b>residentsTotalWakeupDevs</b> - Ger&auml;tename aller Bewohner, bei denen aktuell ein Weckprogramm ausgef&uuml;hrt wird
  1443. </li>
  1444. <li>
  1445. <b>residentsTotalWakeupNames</b> - Ger&auml;tealias aller Bewohner, bei denen aktuell ein Weckprogramm ausgef&uuml;hrt wird
  1446. </li>
  1447. <li>
  1448. <b>residentsTotalWayhome</b> - Summe aller aktiven Bewohner, die momentan auf dem Weg zur&uuml;ck nach Hause sind
  1449. </li>
  1450. <li>
  1451. <b>residentsTotalWayhomeDevs</b> - Ger&auml;tename aller aktiven Bewohner, die momentan auf dem Weg zur&uuml;ck nach Hause sind
  1452. </li>
  1453. <li>
  1454. <b>residentsTotalWayhomeNames</b> - Ger&auml;tealias aller aktiven Bewohner, die momentan auf dem Weg zur&uuml;ck nach Hause sind
  1455. </li>
  1456. <li>
  1457. <b>residentsTotalWayhomeDelayed</b> - Summe aller Bewohner, die momentan mit Versp&auml;tung auf dem Weg zur&uuml;ck nach Hause sind
  1458. </li>
  1459. <li>
  1460. <b>residentsTotalWayhomeDelayedDevs</b> - Ger&auml;tename aller Bewohner, die momentan versp&auml;tet auf dem Weg zur&uuml;ck nach Hause sind
  1461. </li>
  1462. <li>
  1463. <b>residentsTotalWayhomeDelayedNames</b> - Ger&auml;tealias aller Bewohner, die momentan versp&auml;tet auf dem Weg zur&uuml;ck nach Hause sind
  1464. </li>
  1465. <li>
  1466. <b>state</b> - gibt den aktuellen Status wieder
  1467. </li>
  1468. <li>
  1469. <b>wakeup</b> - hat den Wert '1' w&auml;hrend ein Weckprogramm dieser Bewohner-Gruppe ausgef&uuml;hrt wird
  1470. </li>
  1471. </ul>
  1472. </ul>
  1473. <br>
  1474. <br>
  1475. <b>RESIDENTS Toolkit</b><br>
  1476. <ul>
  1477. <ul>
  1478. Mit dem set-Kommando <code>create</code> k&ouml;nnen zur Vereinfachung vorkonfigurierte Konfigurationen zu RESIDENTS, <a href="#ROOMMATE">ROOMMATE</a> oder <a href="#GUEST">GUEST</a> Ger&auml;ten hinzugef&uuml;gt werden.<br>
  1479. Die folgenden Kommandos sind momentan verf&uuml;gbar:<br>
  1480. <br>
  1481. <li>
  1482. <b>wakeuptimer</b> &nbsp;&nbsp;-&nbsp;&nbsp; f&uuml;gt ein Dummy Ger&auml;t mit erweiterten Funktionen als Wecker hinzu, um darauf Weck-Automationen aufzubauen.
  1483. <ul>
  1484. Ein notify Ger&auml;t wird als Makro erstellt, um die eigentliche Automation auszuf&uuml;hren. Das Makro wird durch ein normales at-Ger&auml;t ausgel&ouml;st und kann ebenfalls angepasst werden. Die Hauptfunktion wird dabei trotzdem von einer speziellen RESIDENTS Toolkit funktion gehandhabt.<br>
  1485. Die Zeit aktiver Wecker kann mittels +<MINUTEN> oder -<MINUTEN> relativ erh&ouml;ht bzw. verringert werden. Die Angabe als +HH:MM ist auch m&ouml;glich.<br>
  1486. <br>
  1487. Die Weckfunktion kann wie folgt &uuml;ber Attribute beinflusst werden:<br>
  1488. <li>
  1489. <i>wakeupAtdevice</i> - Backlink zum at Ger&auml;t (notwendig)
  1490. </li>
  1491. <li>
  1492. <i>wakeupDays</i> - Makro nur an bestimmten Tagen ausl&ouml;sen. Mon=1,Di=2,Mi=3,Do=4,Fr=5,Sa=6,So=0 (optional)
  1493. </li>
  1494. <li>
  1495. <i>wakeupDefaultTime</i> - Stellt die Weckzeit nach dem ausl&ouml;sen zur&uuml;ck auf diesen Standardwert (optional)
  1496. </li>
  1497. <li>
  1498. <i>wakeupEnforced</i> - Forciertes wecken (optional; 0=nein, 1=ja, 2=wenn Weckzeit ungleich wakeupDefaultTime, 3=wenn Weckzeit fr&uuml;her ist als wakeupDefaultTime)
  1499. </li>
  1500. <li>
  1501. <i>wakeupHolidays</i> - Makro u.U. an Feiertagen oder Nicht-Feiertagen ausf&uuml;hren (optional; andHoliday=an Feiertagen ggf. zusammen mit wakeupDays, orHoliday=an Feiertagen unabh&auml;ngig von wakeupDays, andNoHoliday=an Nicht-Feiertagen ggf. zusammen mit wakeupDays, orNoHoliday=an Nicht-Feiertagen unabh&auml;ngig von wakeupDays)
  1502. </li>
  1503. <li>
  1504. <i>wakeupMacro</i> - Name des notify Makro Ger&auml;tes (notwendig)
  1505. </li>
  1506. <li>
  1507. <i>wakeupOffset</i> - Wert in Minuten, die das Makro fr&uuml;her ausgel&ouml;st werden soll, z.B. bei komplexen Weckprogrammen &uuml;ber einen Zeitraum von 30 Minuten (Standard ist 0)
  1508. </li>
  1509. <li>
  1510. <i>wakeupResetSwitcher</i> - das DUMMY Device, welches zum schnellen ein/aus schalten der Resetfunktion verwendet wird (optional, Device wird automatisch angelegt)
  1511. </li>
  1512. <li>
  1513. <i>wakeupResetdays</i> - sofern wakeupDefaultTime gesetzt ist, kann der Reset hier auf betimmte Tage begrenzt werden. Mon=1,Di=2,Mi=3,Do=4,Fr=5,Sa=6,So=0 (optional)
  1514. </li>
  1515. <li>
  1516. <i>wakeupUserdevice</i> - Backlink zum RESIDENTS, ROOMMATE oder GUEST Ger&auml;t, um dessen Status zu pr&uuml;fen (notwendig)
  1517. </li>
  1518. <li>
  1519. <i>wakeupWaitPeriod</i> - Schwelle der Wartezeit in Minuten bis das Weckprogramm erneut ausgef&uuml;hrt werden kann, z.B. wenn manuell eine fr&uuml;here Weckzeit gesetzt wurde als normal w&auml;hrend wakeupDefaultTime verwendet wird. Greift nicht, wenn die Weckzeit w&auml;hrend dieser Zeit ge&auml;ndert wurde; Standard ist 360 Minuten / 6h (optional)
  1520. </li>
  1521. </ul>
  1522. </li>
  1523. </ul>
  1524. </ul>
  1525. </ul>
  1526. =end html_DE
  1527. =cut