示例#1
0
  def event(self, event):
    from core.firefly_api import send_request, event_message
    from core.models.request import Request as FFRequest
    from core import ffLocation
    logging.debug('ROUTINE: Receving Event In: ' + str(self._name))

    for trigger in self._triggers:
      if event.deviceID in trigger.keys():
        print 'Device in triggers'
        should_trigger = True
        for device, state in trigger.iteritems():
          # TEMP FIX
          if device != 'location':
            status = send_request(FFRequest(device, state.keys()[0]))
            if str(status) == str(state.values()[0]):
              pass
            else:
              should_trigger = False
          if device == 'location':
            if event.event == state:
              pass
            else:
              should_trigger = False

        if should_trigger:
          event_message(self._name, "Routine Triggered")
          print str(self._mode)
          self.executeRoutine()
示例#2
0
 def setPresence(self, value):
   from core.firefly_api import event_message
   if value is not self.presence:
     self._presence = value
     event_message(self._name, "Setting Presence To " + str(value))
     logging.debug("Setting Presence To " + str(value))
示例#3
0
 def setPresence(self, value):
   from core.firefly_api import event_message
   if value is not self.presence:
     self.presence = value
     event_message(self._name, "Setting Presence To " + str(value))
     logging.debug("Setting Presence To " + str(value))