2024-10-31 23:13:02 -04:00
|
|
|
using System;
|
|
|
|
using System.Reactive.Linq;
|
|
|
|
using System.Reflection;
|
|
|
|
|
2024-10-05 21:00:33 -04:00
|
|
|
using HomeAssistantGenerated;
|
2024-10-31 23:13:02 -04:00
|
|
|
|
2024-10-05 12:38:13 -04:00
|
|
|
using Microsoft.Extensions.Hosting;
|
2024-10-31 23:13:02 -04:00
|
|
|
|
2024-10-05 21:00:33 -04:00
|
|
|
using NetDaemon.AppModel;
|
2024-10-05 12:38:13 -04:00
|
|
|
using NetDaemon.Extensions.Logging;
|
|
|
|
using NetDaemon.Extensions.Scheduler;
|
|
|
|
using NetDaemon.Extensions.Tts;
|
|
|
|
using NetDaemon.Runtime;
|
|
|
|
|
2024-10-31 23:25:52 -04:00
|
|
|
|
2024-10-05 12:38:13 -04:00
|
|
|
try
|
|
|
|
{
|
|
|
|
await Host.CreateDefaultBuilder(args)
|
|
|
|
.UseNetDaemonDefaultLogging()
|
|
|
|
.UseNetDaemonRuntime()
|
|
|
|
.UseNetDaemonTextToSpeech()
|
2024-10-31 23:13:02 -04:00
|
|
|
.ConfigureServices(static (_, services) =>
|
2024-10-05 12:38:13 -04:00
|
|
|
services
|
|
|
|
.AddAppsFromAssembly(Assembly.GetExecutingAssembly())
|
|
|
|
.AddNetDaemonStateManager()
|
|
|
|
.AddNetDaemonScheduler()
|
2024-10-05 16:17:14 -04:00
|
|
|
.AddHomeAssistantGenerated()
|
2024-10-05 12:38:13 -04:00
|
|
|
)
|
|
|
|
.Build()
|
|
|
|
.RunAsync()
|
|
|
|
.ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
Console.WriteLine($"Failed to start host... {e}");
|
|
|
|
throw;
|
|
|
|
}
|