Example #1
0
 def __init__(self,
              path,
              event_kinds=[ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY],
              watch_subdirectories=False):
     triggerId = type(self).__name__ + "-" + uuid.uuid1().hex
     config = Configuration({
         'path': path,
         'event_kinds': str(event_kinds),
         'watch_subdirectories': watch_subdirectories,
     })
     self.trigger = TriggerBuilder.create().withId(triggerId).withTypeUID(
         "openhab.DIRECTORY_TRIGGER_MODULE_ID").withConfiguration(
             Configuration(config)).build()
Example #2
0
 def __init__(self, itemName, command=None, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     config = {"itemName": itemName}
     if command is not None:
         config["command"] = command
     Trigger.__init__(self, triggerName, "core.ItemCommandTrigger",
                      Configuration(config))
Example #3
0
 def __init__(self, itemName, state=None, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     config = {"itemName": itemName}
     if state is not None:
         config["state"] = state
     Trigger.__init__(self, triggerName, "core.ItemStateChangeTrigger",
                      Configuration(config))
Example #4
0
 def __init__(self, filter=None):
     self.filter = filter or (lambda event: True)
     triggerId = type(self).__name__ + "-" + uuid.uuid1().hex
     config = Configuration()
     scope.Trigger.__init__(self, triggerId, lucid.OSGI_TRIGGER_ID, config)
     global osgi_triggers
     osgi_triggers[self.id] = self
Example #5
0
 def __init__(self, channelUID, event, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     #self.log.debug("Trigger: " + triggerName + "; channel: " + channelUID)
     config = {"channelUID": channelUID}
     config["event"] = event
     Trigger.__init__(self, triggerName, "core.ChannelEventTrigger",
                      Configuration(config))
     self.setLabel(triggerName)
Example #6
0
 def __init__(self, itemName, command=None, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     config = {"itemName": itemName}
     if command is not None:
         config["command"] = command
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "core.ItemCommandTrigger").withConfiguration(
             Configuration(config)).build()
Example #7
0
 def __init__(self, itemName, state=None, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     config = {"itemName": itemName}
     if state is not None:
         config["state"] = state
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "core.ItemStateUpdateTrigger").withConfiguration(
             Configuration(config)).build()
Example #8
0
 def __init__(self, channelUID, event, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     #self.log.debug("Trigger: " + triggerName + "; channel: " + channelUID)
     config = {"channelUID": channelUID}
     config["event"] = event
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "core.ChannelEventTrigger").withConfiguration(
             Configuration(config)).build()
     self.setLabel(triggerName)
Example #9
0
 def __init__(self,
              path,
              event_kinds=[ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY],
              watch_subdirectories=False):
     triggerId = type(self).__name__ + "-" + uuid.uuid1().hex
     config = Configuration({
         'path': path,
         'event_kinds': str(event_kinds),
         'watch_subdirectories': watch_subdirectories,
     })
     Trigger.__init__(self, triggerId, openhab.DIRECTORY_TRIGGER_MODULE_ID,
                      config)
Example #10
0
 def __init__(self,
              eventSource,
              eventTypes,
              eventTopic="smarthome/items/*",
              triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "core.GenericEventTrigger").withConfiguration(
             Configuration({
                 "eventTopic":
                 eventTopic,
                 "eventSource":
                 "smarthome/items/{}/".format(eventSource),
                 "eventTypes":
                 eventTypes
             })).build()
Example #11
0
 def __init__(self,
              eventSource,
              eventTypes,
              eventTopic="smarthome/items/*",
              triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     Trigger.__init__(
         self, triggerName, "core.GenericEventTrigger",
         Configuration({
             "eventTopic":
             eventTopic,
             "eventSource":
             "smarthome/items/{}/".format(eventSource),
             "eventTypes":
             eventTypes
         }))
Example #12
0
 def __init__(self, cronExpression, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     Trigger.__init__(self, triggerName, "timer.GenericCronTrigger",
                      Configuration({"cronExpression": cronExpression}))
Example #13
0
 def __init__(self, channelUID, event=None, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     config = { "channelUID": channelUID }
     if event is not None:
         config["event"] = event
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID("core.ChannelEventTrigger").withConfiguration(Configuration(config)).build()
Example #14
0
 def __init__(self, cronExpression, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID("timer.GenericCronTrigger").withConfiguration(Configuration({"cronExpression": cronExpression})).build()
Example #15
0
 def __init__(self, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID("openhab.STARTUP_MODULE_ID").withConfiguration(Configuration()).build()
Example #16
0
 def __init__(self, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     Trigger.__init__(self, triggerName, openhab.STARTUP_MODULE_ID,
                      Configuration())
Example #17
0
 def __init__(self, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(core.SHUTDOWN_MODULE_ID).withConfiguration(Configuration()).build()