Skip to content

Commit f65f87e

Browse files
committed
improved presence detection
1 parent 507bfbe commit f65f87e

File tree

157 files changed

+6
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+6
-16
lines changed

conf/html/shared/habpanel/js/helper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ var mvInitializer = function(){
427427
if( item == null )
428428
{
429429
// Should never happen
430-
console.error("Item state requested before items initialized");
430+
console.error("Item state of '" + name + "' requested, but does not exists or is not initialized");
431431
return null;
432432
}
433433

conf/icons/classic/msg.png

0 Bytes

conf/icons/classic/selfalarm.png

0 Bytes
0 Bytes

conf/icons/classic/selfbattery-0.png

0 Bytes

conf/icons/classic/selfbattery-10.png

0 Bytes
0 Bytes

conf/icons/classic/selfbattery-20.png

0 Bytes

conf/icons/classic/selfbattery-30.png

0 Bytes

conf/icons/classic/selfbattery-40.png

0 Bytes

conf/icons/classic/selfbattery-50.png

0 Bytes

conf/icons/classic/selfbattery-60.png

0 Bytes

conf/icons/classic/selfbattery-70.png

0 Bytes

conf/icons/classic/selfbattery-80.png

0 Bytes

conf/icons/classic/selfbattery-90.png

0 Bytes

conf/icons/classic/selfbattery.png

0 Bytes

conf/icons/classic/selfbed.png

0 Bytes

conf/icons/classic/selfbell.png

0 Bytes

conf/icons/classic/selfbypass-0.png

0 Bytes

conf/icons/classic/selfbypass-1.png

0 Bytes

conf/icons/classic/selfbypass.png

0 Bytes

conf/icons/classic/selfcalendar.png

0 Bytes

conf/icons/classic/selfcouch.png

0 Bytes
0 Bytes

conf/icons/classic/selfdoor-open.png

0 Bytes

conf/icons/classic/selfdoor.png

0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes

conf/icons/classic/selfheating.png

0 Bytes

conf/icons/classic/selfhouse1.png

0 Bytes

conf/icons/classic/selflight-0.png

0 Bytes

conf/icons/classic/selflight-10.png

0 Bytes

conf/icons/classic/selflight-100.png

0 Bytes

conf/icons/classic/selflight-20.png

0 Bytes

conf/icons/classic/selflight-30.png

0 Bytes

conf/icons/classic/selflight-40.png

0 Bytes

conf/icons/classic/selflight-50.png

0 Bytes

conf/icons/classic/selflight-60.png

0 Bytes

conf/icons/classic/selflight-70.png

0 Bytes

conf/icons/classic/selflight-80.png

0 Bytes

conf/icons/classic/selflight-90.png

0 Bytes

conf/icons/classic/selflight-off.png

0 Bytes

conf/icons/classic/selflight-on.png

0 Bytes

conf/icons/classic/selflight.png

0 Bytes
6.18 KB
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes

conf/icons/classic/selfshield-off.png

0 Bytes

conf/icons/classic/selfshield.png

0 Bytes

conf/icons/classic/selfsun.png

0 Bytes

conf/icons/classic/selfwater-off.png

0 Bytes
0 Bytes
0 Bytes

conf/icons/classic/selfwindow.png

0 Bytes

conf/icons/classic/trashpresent.png

0 Bytes
0 Bytes
0 Bytes

python/shared/helper.py

+4-15
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ def getItem(name):
306306
raise NotInitialisedException(u"Item {} not found".format(name))
307307
return item
308308

309-
310309
def getFilteredChildItems(itemOrName, state):
311310
items = getGroupMember(itemOrName)
312311
if isinstance(state, list):
@@ -500,29 +499,19 @@ def getUserByStateItem(stateItem):
500499
return userName
501500

502501
@staticmethod
503-
def getPresentUser(timeout = None):
504-
return list(UserHelper.getPresentUserData(timeout).keys())
502+
def getPresentUser():
503+
return list(UserHelper.getPresentUserData().keys())
505504

506505
@staticmethod
507-
def getPresentUserData(timeout = None):
508-
ref = ZonedDateTime.now().minusSeconds(timeout) if timeout is not None else None
506+
def getPresentUserData():
509507
usernames = {}
510508
for userName in userConfigs:
511509
if not userConfigs[userName]["state_item"]:
512510
continue
513-
514511
stateItem = getItem(userConfigs[userName]["state_item"])
515512
if getItemState(stateItem) != OnOffType.ON:
516513
continue
517-
518-
if ref is not None:
519-
_update = getItemLastUpdate(stateItem)
520-
if _update.isBefore(ref):
521-
continue
522-
else:
523-
_update = None
524-
525-
usernames[userName] = {"stateItem": stateItem, "lastUpdate": _update}
514+
usernames[userName] = stateItem
526515
return usernames
527516

528517
@staticmethod

svg/build/png/msg.png

0 Bytes

svg/build/png/selfalarm.png

0 Bytes

svg/build/png/selfautomode-off.png

0 Bytes

svg/build/png/selfbattery-0.png

0 Bytes

svg/build/png/selfbattery-10.png

0 Bytes

svg/build/png/selfbattery-100.png

0 Bytes

svg/build/png/selfbattery-20.png

0 Bytes

svg/build/png/selfbattery-30.png

0 Bytes

svg/build/png/selfbattery-40.png

0 Bytes

svg/build/png/selfbattery-50.png

0 Bytes

svg/build/png/selfbattery-60.png

0 Bytes

svg/build/png/selfbattery-70.png

0 Bytes

svg/build/png/selfbattery-80.png

0 Bytes

svg/build/png/selfbattery-90.png

0 Bytes

svg/build/png/selfbattery.png

0 Bytes

svg/build/png/selfbed.png

0 Bytes

svg/build/png/selfbell.png

0 Bytes

svg/build/png/selfbypass-0.png

0 Bytes

svg/build/png/selfbypass-1.png

0 Bytes

svg/build/png/selfbypass.png

0 Bytes

svg/build/png/selfcalendar.png

0 Bytes

svg/build/png/selfcouch.png

0 Bytes

svg/build/png/selfdoor-closed.png

0 Bytes

svg/build/png/selfdoor-open.png

0 Bytes

svg/build/png/selfdoor.png

0 Bytes

svg/build/png/selffilterextern-1.png

0 Bytes

svg/build/png/selffilterextern.png

0 Bytes

svg/build/png/selffilterintern-1.png

0 Bytes

svg/build/png/selffilterintern.png

0 Bytes

svg/build/png/selfheating.png

0 Bytes

svg/build/png/selfhouse1.png

0 Bytes

svg/build/png/selflight-0.png

0 Bytes

svg/build/png/selflight-10.png

0 Bytes

svg/build/png/selflight-100.png

0 Bytes

svg/build/png/selflight-20.png

0 Bytes

svg/build/png/selflight-30.png

0 Bytes

svg/build/png/selflight-40.png

0 Bytes

svg/build/png/selflight-50.png

0 Bytes

svg/build/png/selflight-60.png

0 Bytes

svg/build/png/selflight-70.png

0 Bytes

svg/build/png/selflight-80.png

0 Bytes

svg/build/png/selflight-90.png

0 Bytes

svg/build/png/selflight-off.png

0 Bytes

svg/build/png/selflight-on.png

0 Bytes

svg/build/png/selflight.png

0 Bytes

svg/build/png/selfnotification-0.png

6.18 KB

svg/build/png/selfnotification-1.png

0 Bytes

svg/build/png/selfnotification-2.png

0 Bytes

svg/build/png/selfnotification2.png

0 Bytes
0 Bytes
0 Bytes

svg/build/png/selfrollershutter-0.png

0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes
0 Bytes

svg/build/png/selfrollershutter.png

0 Bytes

svg/build/png/selfshield-off.png

0 Bytes

svg/build/png/selfshield.png

0 Bytes

svg/build/png/selfsun.png

0 Bytes

svg/build/png/selfwater-off.png

0 Bytes

svg/build/png/selfwindow-closed.png

0 Bytes

svg/build/png/selfwindow-open.png

0 Bytes

svg/build/png/selfwindow.png

0 Bytes

svg/build/png/trashpresent.png

0 Bytes
0 Bytes

svg/build/png/whitegood_washer.png

0 Bytes

svg/final_svg/selfnotification-0.svg

+1

0 commit comments

Comments
 (0)