Exemple #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()
Exemple #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))
Exemple #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))
Exemple #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
Exemple #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)
Exemple #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()
Exemple #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()
Exemple #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)
Exemple #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)
Exemple #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()
Exemple #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
         }))
Exemple #12
0
 def __init__(self, cronExpression, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     Trigger.__init__(self, triggerName, "timer.GenericCronTrigger",
                      Configuration({"cronExpression": cronExpression}))
Exemple #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()
Exemple #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()
Exemple #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()
Exemple #16
0
 def __init__(self, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     Trigger.__init__(self, triggerName, openhab.STARTUP_MODULE_ID,
                      Configuration())
Exemple #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()