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

36 lines
912 B
C#
Raw Normal View History

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;
using System;
using System.Reactive.Linq;
using System.Reflection;
2024-10-05 12:38:13 -04:00
#pragma warning disable CA1812
try
{
await Host.CreateDefaultBuilder(args)
.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;
}