コード例 #1
0
    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))
コード例 #2
0
    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
コード例 #3
0
    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))
コード例 #4
0
    def end_event(self, event):
        Event_Base.end_event(self, event)

        self.area.unlock()
        log.info('Area {} unlocked, event ended'.format(self.area.name))
コード例 #5
0
    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()