Ejemplo n.º 1
0
 def __init__(self, thingUID, eventTypes, eventTopic="smarthome/things/*", triggerName=None):
     triggerName = validate_uid(triggerName)
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID("core.GenericEventTrigger").withConfiguration(Configuration({
         "eventTopic": eventTopic,
         "eventSource": "smarthome/things/{}/".format(thingUID),
         "eventTypes": eventTypes
     })).build()
Ejemplo n.º 2
0
 def __init__(self, cronExpression, triggerName=None):
     if triggerName is None:
         triggerName = uuid.uuid1().hex
     else:
         triggerName = "{}-{}".format(triggerName, uuid.uuid1().hex)
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "timer.GenericCronTrigger").withConfiguration(
             Configuration({"cronExpression": cronExpression})).build()
Ejemplo n.º 3
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()
Ejemplo n.º 4
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()
Ejemplo n.º 5
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()
 def __init__(self, thingUID, status=None, triggerName=None):
     triggerName = validate_uid(triggerName)
     config = {"thingUID": thingUID}
     if status is not None:
         config["status"] = status
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "core.ThingStatusUpdateTrigger").withConfiguration(
             Configuration(config)).build()
Ejemplo n.º 7
0
 def __init__(self, path, event_kinds=[ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY], watch_subdirectories=False):
     triggerName = validate_uid(type(self).__name__)
     config = {
         'path': path,
         'event_kinds': str(event_kinds),
         'watch_subdirectories': watch_subdirectories,
     }
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(core.DIRECTORY_TRIGGER_MODULE_ID).withConfiguration(Configuration(config)).build()
Ejemplo n.º 8
0
 def __init__(self, itemName, previousState=None, state=None, triggerName=None):
     triggerName = validate_uid(triggerName)
     config = { "itemName": itemName }
     if state is not None:
         config["state"] = state
     if previousState is not None:
         config["previousState"] = previousState
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID("core.ItemStateChangeTrigger").withConfiguration(Configuration(config)).build()
Ejemplo n.º 9
0
 def __init__(self, channelUID, event=None, triggerName=None):
     if triggerName is None:
         triggerName = uuid.uuid1().hex
     else:
         triggerName = "{}-{}".format(triggerName, 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()
Ejemplo n.º 10
0
 def __init__(self, itemName, command=None, triggerName=None):
     if triggerName is None:
         triggerName = uuid.uuid1().hex
     else:
         triggerName = "{}-{}".format(triggerName, 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()
Ejemplo n.º 11
0
 def __init__(self,
              eventSource,
              eventTypes,
              eventTopic="smarthome/*",
              triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "core.GenericEventTrigger").withConfiguration(
             Configuration({
                 "eventTopic":
                 eventTopic,
                 "eventSource":
                 "smarthome/{}/".format(eventSource),
                 "eventTypes":
                 eventTypes
             })).build()
Ejemplo n.º 12
0
 def __init__(self,
              itemName,
              previousState=None,
              state=None,
              triggerName=None):
     if triggerName is None:
         triggerName = uuid.uuid1().hex
     else:
         triggerName = "{}-{}".format(triggerName, uuid.uuid1().hex)
     config = {"itemName": itemName}
     if state is not None:
         config["state"] = state
     if previousState is not None:
         config["previousState"] = previousState
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "core.ItemStateChangeTrigger").withConfiguration(
             Configuration(config)).build()
Ejemplo n.º 13
0
 def __init__(self,
              thingUID,
              eventTypes,
              eventTopic="smarthome/things/*",
              triggerName=None):
     if triggerName is None:
         triggerName = uuid.uuid1().hex
     else:
         triggerName = "{}-{}".format(triggerName, uuid.uuid1().hex)
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "core.GenericEventTrigger").withConfiguration(
             Configuration({
                 "eventTopic":
                 eventTopic,
                 "eventSource":
                 "smarthome/things/{}/".format(thingUID),
                 "eventTypes":
                 eventTypes
             })).build()
Ejemplo n.º 14
0
 def __init__(self, triggerName=None):
     triggerName = triggerName or uuid.uuid1().hex
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "jsr223.StartupTrigger").withConfiguration(
             Configuration()).build()
Ejemplo n.º 15
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()
Ejemplo n.º 16
0
 def __init__(self, triggerName=None):
     triggerName = validate_uid(triggerName)
     self.trigger = TriggerBuilder.create().withId(triggerName).withTypeUID(
         "jsr223.StartupTrigger").withConfiguration(
             Configuration()).build()