def execute(self, module, input): sendCommand("gGF_Livingroom_Light_Hue_Color", 60) states = [OFF, PercentType.ZERO] for child in getItem("gGF_Lights").getAllMembers(): if child.getState() not in states and child.getName( ) != "gGF_Livingroom_Light_Hue_Color": sendCommand(child, OFF) for child in getItem("gFF_Lights").getAllMembers(): if child.getState() not in states: sendCommand(child, OFF) postUpdate("pOther_Scene1", OFF)
def execute(self, module, input): if getItemState("pOther_Manual_State_Notify") != ON: return state = getItemState("pOther_Presence_State").intValue() if state in [PresenceHelper.STATE_AWAY, PresenceHelper.STATE_SLEEPING]: itemName = input['event'].getItemName() item = getItem(itemName) location = self.getLocation(item) if "Door" in itemName: msg = u"Tür im {} {}".format( location.getLabel(), u"offen" if input['event'].getItemState() == OPEN else u"geschlossen") elif "Window" in itemName: msg = u"Fenster im {} {}".format( location.getLabel(), u"offen" if input['event'].getItemState() == OPEN else u"geschlossen") elif "Motiondetector" in itemName: if input['event'].getItemState() == CLOSED: return # during sleep, ignore moving detection if state == PresenceHelper.STATE_SLEEPING: return msg = u"Bewegung im {} erkannt".format(location.getLabel()) #self.log.info(u"{} {} {} {}".format(group,itemName,item.getLabel(),location.getLabel())) sendNotification(u"Alarm", u"{}".format(msg))
def confirmArriving(self): presenceState = getItemState("pOther_Presence_State").intValue() if presenceState != PresenceHelper.STATE_MAYBE_PRESENT: return newestUpdate = None for item in getItem("gSensor_Indoor").getAllMembers(): if getItemState(item) == OPEN: newestUpdate = ZonedDateTime.now() break _update = getItemLastUpdate(item) if newestUpdate == None or _update.isAfter(newestUpdate): newestUpdate = _update ref = ZonedDateTime.now().minusSeconds(7) self.isConfirmed = newestUpdate.isAfter(ref) or newestUpdate.isEqual( ref) if self.isConfirmed: self.delayedAwayCheck() else: self.setAway(False) self.confirmTimer = None
def getLocation(self, item): for parentName in item.getGroupNames(): parent = getItem(parentName) if parentName[0:1] == 'l': return parent else: location = self.getLocation(parent) if location != None: return location return None
def execute(self, module, input): sendCommand("pGF_Corridor_Light_Hue_Color", 60) sendCommand("pFF_Bathroom_Light_Ceiling_Powered", ON) sendCommand("pFF_Bathroom_Light_Mirror_Powered", ON) sendCommand("pFF_Bedroom_Light_Hue_Right_Switch", ON) states = [OFF, PercentType.ZERO] for child in getItem("gGF_Lights").getAllMembers(): if child.getState() not in states and child.getName( ) != "pGF_Corridor_Light_Hue_Color": sendCommand(child, OFF) #for child in getItem("gFF_Lights").getAllMembers(): # if child.getState() not in states and child.getName() not in ["pFF_Bathroom_Light_Mirror_Powered", "pFF_Bedroom_Light_Hue_Right_Switch"]: # sendCommand(child, OFF) sendCommand("pOther_Scene6", ON) postUpdate("pOther_Scene3", OFF)
def execute(self, module, input): itemName = input['event'].getItemName() entry = manualMappings[self.triggerMappings[itemName]] if getItemState("pOther_Automatic_State_Outdoorlights" ) == ON and getItemState(entry[1]) == ON: timerMappings[entry[0]] = startTimer(self.log, timerDuration, self.callback, [entry], oldTimer=timerMappings.get( entry[0])) global ruleTimeouts ruleTimeouts["Light_Outdoor"] = ZonedDateTime.now() self.log.info(u"MotionDetectorRule: execute for {} => {}".format( entry[0], ruleTimeouts["Light_Outdoor"])) sendCommand(entry[0], 100 if getItem(entry[0]).getType() == "Dimmer" else ON)
def callback(self, entry): global timerMappings if getItemState(entry[1]) == ON: for motionDetectorItem in entry[2]: if getItemState(motionDetectorItem) == OPEN: timerMappings[entry[0]] = startTimer( self.log, timerDuration, self.callback, [entry]) return global ruleTimeouts ruleTimeouts["Light_Outdoor"] = ZonedDateTime.now() self.log.info(u"MotionDetectorRule: callback for {} => {}".format( entry[0], ruleTimeouts["Light_Outdoor"])) sendCommand(entry[0], 0 if getItem(entry[0]).getType() == "Dimmer" else OFF) timerMappings[entry[0]] = None else: timerMappings[entry[0]] = None