forked from ludeeus/netdaemon-app-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogram.cs
33 lines (30 loc) · 981 Bytes
/
program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Reflection;
using HomeAssistantGenerated.Logging;
using Microsoft.Extensions.Hosting;
using NetDaemon.Extensions.MqttEntityManager;
using NetDaemon.Runtime;
#pragma warning disable CA1812
try
{
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
await Host.CreateDefaultBuilder(args)
.UseNetDaemonAppSettings()
.UseCustomLogging()
.UseNetDaemonRuntime()
.UseNetDaemonMqttEntityManagement()
.ConfigureServices((context, services) =>
services
.AddAppsFromAssembly(Assembly.GetExecutingAssembly())
.AddNetDaemonStateManager()
.AddNetDaemonScheduler()
.SetupDependencies()
)
.Build()
.RunAsync()
.ConfigureAwait(false);
}
catch (Exception e)
{
Console.WriteLine($"Failed to start host... {e}");
throw;
}