def end_event(self, event): Event_Base.end_event(self, event) self.area.unlock() self.area.set_area_vacant('Presence sensor CLOSED') log.info( 'Area {} unlocked and set to vacant, presence event ended'.format( self.area.name))
def process_changed_event(self, event): Event_Base.process_changed_event(self, event) item_state = str(event.itemState) if item_state == "OPEN": #begin event self.begin_event(event) elif item_state == "CLOSED": # off, an end event, only change occupancy settings if specified self.end_event(event) else: log.info('Unknown contact event {}'.format( item_state)) # should not happen
def process_changed_event(self,event): Event_Base.process_changed_event(self,event) event_settings = self.get_event_settings() item_state = str(event.itemState) try: percent = float(item_state) except: percent = 0 #log.warn('Area Item ON OFF event State {} Percent {}'.format(item_state,percent)) if item_state == "ON" or percent > 0: #begin event self.begin_event(event) elif item_state == "OFF" or percent == 0: # off, an end event, only change occupancy settings if specified self.end_event(event) else: log.info ('Unknown on/off event {}'.format(item_state))
def end_event(self, event): Event_Base.end_event(self, event) self.area.unlock() log.info('Area {} unlocked, event ended'.format(self.area.name))
def begin_event(self, event): Event_Base.begin_event(self, event) log.info('Area {} locked, until event ends'.format(self.area.name)) self.area.lock()