public Task InvokeAsync(DeviceFeatureInvocationContext ctx, ActionCommand.OnOff commandParams) { var message = commandParams.On ? _options.On : _options.Off; _logger.LogInformation(message); return(Task.CompletedTask); }
public async Task InvokeAsync(DeviceFeatureInvocationContext ctx, ActionCommand.OnOff commandParams) { var endpoint = commandParams.On ? _options.On : _options.Off; _logger.LogInformation("WebHookSimpleOnOff: " + endpoint.Url); var contentType = String.IsNullOrWhiteSpace(endpoint.ContentType) ? endpoint.ContentType : DefaultContentType; await new HttpClient().PostAsync(endpoint.Url, new StringContent(endpoint.Body ?? "", new UTF8Encoding(false), contentType)); }
public Task InvokeAsync(DeviceFeatureInvocationContext ctx, ActionCommand.OnOff commandParams) { var processConfig = commandParams.On ? _options.On : _options.Off; _logger.LogInformation($"ExternalProcessOnOff: Executable={processConfig.Executable}; Arguments={processConfig.Arguments}"); var process = Process.Start(processConfig.Executable, processConfig.Arguments); if (processConfig.WaitForExit) { process.WaitForExit(); } return(Task.CompletedTask); }
public async Task InvokeAsync(DeviceFeatureInvocationContext ctx, ActionCommand.OnOff commandParams) { _logger.LogInformation("IrKitSimpleOnOff: " + commandParams.On); await new IrKitClient(_options.EndPoint).SendMessagesAsync(commandParams.On ? _options.On : _options.Off); }