Class AutomationEventFactory

java.lang.Object
org.openhab.core.events.AbstractEventFactory
org.openhab.core.automation.events.AutomationEventFactory
All Implemented Interfaces:
EventFactory

@NonNullByDefault public class AutomationEventFactory extends AbstractEventFactory
This class is a factory that creates Timer and Execution Events.
Author:
Jan N. Klug - Initial contribution
  • Constructor Details

    • AutomationEventFactory

      public AutomationEventFactory()
  • Method Details

    • createEventByType

      protected Event createEventByType(String eventType, String topic, String payload, @Nullable String source) throws Exception
      Description copied from class: AbstractEventFactory
      Create a new event instance based on the event type.
      Specified by:
      createEventByType in class AbstractEventFactory
      Parameters:
      eventType - the event type
      topic - the topic
      payload - the payload
      source - the source, can be null
      Returns:
      the created event instance
      Throws:
      Exception - if the creation of the event fails
    • createTimerEvent

      public static TimerEvent createTimerEvent(String moduleId, @Nullable String label, Map<String,Object> configuration)
      Creates a TimerEvent
      Parameters:
      moduleId - the module type id of this event
      label - The label (or id) of this object
      configuration - the configuration of the trigger
      Returns:
      the created event
    • createExecutionEvent

      public static ExecutionEvent createExecutionEvent(String moduleId, @Nullable Map<String,Object> payload, String source)
      Creates an ExecutionEvent
      Parameters:
      moduleId - the module type id of this event
      payload - A map with additional information like preceding events when rules are called from other rules (optional)
      source - The source of this event (e.g. "script" or "manual")
      Returns:
      the created event