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

38 lines
891 B
C#
Raw Permalink Normal View History

using System;
using System.Reactive.Linq;
using System.Reflection;
using HomeAssistantGenerated;
2024-10-05 12:38:13 -04:00
using Microsoft.Extensions.Hosting;
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-05 12:38:13 -04:00
try
{
await Host.CreateDefaultBuilder(args)
.UseNetDaemonDefaultLogging()
.UseNetDaemonRuntime()
.UseNetDaemonTextToSpeech()
.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;
}