/// <summary> /// Constructor /// </summary> /// <param name="entityIds">The unique ids of the entities managed</param> /// <param name="daemon">The Daemon that will handle API calls to Home Assistant</param> public EntityManager(IEnumerable <string> entityIds, INetDaemon daemon) { _entityIds = entityIds; _daemon = daemon; }
public static async Task HandleAttributeInitialization(this INetDaemonAppBase netDaemonApp, INetDaemon _daemon) { var netDaemonAppType = netDaemonApp.GetType(); foreach (var method in netDaemonAppType.GetMethods()) { foreach (var attr in method.GetCustomAttributes(false)) { if (netDaemonApp is NetDaemonApp daemonApp) { switch (attr) { case HomeAssistantServiceCallAttribute hasstServiceCallAttribute: await HandleServiceCallAttribute(_daemon, daemonApp, method, true).ConfigureAwait(false); break; case HomeAssistantStateChangedAttribute hassStateChangedAttribute: HandleStateChangedAttribute(_daemon, hassStateChangedAttribute, daemonApp, method); break; } } else if (netDaemonApp is NetDaemonRxApp daemonRxApp) { switch (attr) { case HomeAssistantServiceCallAttribute hasstServiceCallAttribute: await HandleServiceCallAttribute(_daemon, daemonRxApp, method, false).ConfigureAwait(false); break; } } } } }
/// <summary> /// Constructor /// </summary> /// <param name="entityIds">The unique ids of the entities managed</param> /// <param name="daemon">The Daemon that will handle API calls to Home Assistant</param> public MediaPlayerManager(IEnumerable <string> entityIds, INetDaemon daemon) : base(entityIds, daemon) { }
public static void HandleAttributeInitialization(this INetDaemonApp netDaemonApp, INetDaemon _daemon) { var netDaemonAppType = netDaemonApp.GetType(); foreach (var method in netDaemonAppType.GetMethods()) { foreach (var attr in method.GetCustomAttributes(false)) { switch (attr) { case HomeAssistantServiceCallAttribute hasstServiceCallAttribute: HandleServiceCallAttribute(_daemon, netDaemonApp, method); break; case HomeAssistantStateChangedAttribute hassStateChangedAttribute: HandleStateChangedAttribute(_daemon, hassStateChangedAttribute, netDaemonApp, method); break; } } } }
public DelayResult(TaskCompletionSource <bool> delayTaskCompletionSource, INetDaemon daemon) { _delayTaskCompletionSource = delayTaskCompletionSource; _daemon = daemon; }
/// <summary> /// Constructor /// </summary> /// <param name="daemon">The NetDaemon that handles API calls to Home Assistant</param> public TimeManager(INetDaemon daemon) { _daemon = daemon; }