Ejemplo n.º 1
0
 def __init__(self, thingUID, eventTypes, eventTopic="smarthome/things/*", triggerName=None):
     triggerName = triggerName or 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.º 2
0
 def __init__(self, path, event_kinds=[ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY], watch_subdirectories=False):
     triggerId = type(self).__name__ + "-" + uuid.uuid1().hex
     config = {
         'path': path,
         'event_kinds': str(event_kinds),
         'watch_subdirectories': watch_subdirectories,
     }
     self.trigger = TriggerBuilder.create().withId(triggerId).withTypeUID(core.DIRECTORY_TRIGGER_MODULE_ID).withConfiguration(Configuration(config)).build()
Ejemplo n.º 3
0
 def __init__(self, itemName, previousState=None, state=None, triggerName=None):
     triggerName = triggerName or 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.º 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, 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)
Ejemplo n.º 6
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.º 7
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()
Ejemplo n.º 8
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.º 9
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()