protected override void Execture_HomeAutomationSingleDeviceDefinition(HomeAutomationSingleDeviceContext context) { var button = context.ReadParameter("Button").Value; var originalCommand = context.OriginalCommand; var commands = originalCommand.InnerCommands; var device = context.Device; var network = device.Network; var triggers = network.Context.Triggers; var history = network.Context.History; var threadPool = network.Context.ThreadPool; var trigger = new WhenAKeypadButtonIsPressedTrigger(device, button, history.DeviceEvents); var action = new RunScriptTriggerAction(threadPool, commands); var triggerBundle = new TriggerBundle(trigger, action); triggers.Add(triggerBundle); }