Пример #1
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))
Пример #2
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))
Пример #3
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)
Пример #4
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)
Пример #5
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
         }))
Пример #6
0
 def __init__(self, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     Trigger.__init__(self, triggerName, openhab.STARTUP_MODULE_ID,
                      Configuration())
Пример #7
0
 def __init__(self, cronExpression, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     Trigger.__init__(self, triggerName, "timer.GenericCronTrigger",
                      Configuration({"cronExpression": cronExpression}))
Пример #8
0
 def __init__(self, _type, _config, name=None):
     _Trigger.__init__(self,
                       uuid.uuid1().hex if name is None else name, _type,
                       _config)