nixos-configs/devices/homie/modules/home-assistant/netdaemon/program.cs

34 lines
879 B
C#
Raw Normal View History

2024-10-05 12:38:13 -04:00
using System.Reflection;
using Microsoft.Extensions.Hosting;
using NetDaemon.Extensions.Logging;
using NetDaemon.Extensions.Scheduler;
using NetDaemon.Extensions.Tts;
using NetDaemon.Runtime;
2024-10-05 16:17:14 -04:00
using HomeAssistantGenerated;
2024-10-05 12:38:13 -04:00
#pragma warning disable CA1812
try
{
await Host.CreateDefaultBuilder(args)
.UseNetDaemonAppSettings()
.UseNetDaemonDefaultLogging()
.UseNetDaemonRuntime()
.UseNetDaemonTextToSpeech()
.ConfigureServices((_, services) =>
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;
}