Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
helto4real committed Feb 6, 2021
1 parent 6f4c19f commit 920a0b7
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 368 deletions.
86 changes: 0 additions & 86 deletions src/App/NetDaemon.App/Common/DelayResult.cs

This file was deleted.

21 changes: 0 additions & 21 deletions src/App/NetDaemon.App/Common/IDelayResult.cs

This file was deleted.

186 changes: 0 additions & 186 deletions src/App/NetDaemon.App/Common/INetDaemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ public interface INetDaemon : INetDaemonCommon
/// </summary>
IHttpHandler Http { get; }

/// <summary>
/// Returns a list of all running instances of NetDaemon apps
/// </summary>
IEnumerable<INetDaemonAppBase> RunningAppInstances { get; }

/// <summary>
/// Calls a service
/// </summary>
Expand Down Expand Up @@ -68,187 +63,6 @@ public interface INetDaemon : INetDaemonCommon
public IServiceProvider? ServiceProvider { get; }
}

// /// <summary>
// /// Base interface that all NetDaemon apps needs to implement
// /// </summary>
// [SuppressMessage("", "CA1716"), Obsolete("You are using V1 of API and it is deprecated, next release it will be moved. Please replace it wiht V2 NetDaemonRxApp", false)
// ]
// public interface INetDaemonApp : INetDaemonAppBase
// {
// /// <summary>
// /// The apps actions to run on state changes
// /// </summary>
// public ConcurrentDictionary<string, (string pattern, Func<string, EntityState?, EntityState?, Task> action)> StateCallbacks { get; }

// /// <summary>
// /// Calls a service
// /// </summary>
// /// <param name="domain">The domain of the service</param>
// /// <param name="service">The service being called</param>
// /// <param name="data">Any data that the service requires</param>
// /// <param name="waitForResponse">If we should wait for the service to get response from Home Assistant or send/forget scenario</param>
// Task CallService(string domain, string service, dynamic? data = null, bool waitForResponse = false);

// /// <summary>
// /// Selects one or more camera entities to do action on
// /// </summary>
// /// <param name="entityIds">Entity unique id:s</param>
// ICamera Camera(params string[] entityIds);

// /// <summary>
// /// Selects one or more cameras entities to do action on
// /// </summary>
// /// <param name="entityIds">Entity unique id:s</param>
// ICamera Cameras(IEnumerable<string> entityIds);

// /// <summary>
// /// Selects one or more cameras entities to do action on using lambda
// /// </summary>
// /// <param name="func">The lambda expression selecting mediaplayers</param>
// ICamera Cameras(Func<IEntityProperties, bool> func);

// /// <summary>
// /// Cancels the current listen state operation
// /// </summary>
// /// <param name="id">The unique id provided in ListenState</param>
// ///
// void CancelListenState(string id);
// /// <summary>
// /// Delays until state changes
// /// </summary>
// /// <param name="entityIds">The entities to wait for state changes</param>
// /// <param name="to">The state change to, or null if any state</param>
// /// <param name="from">The state changed from or null if any state</param>
// /// <param name="allChanges">Get all changed, even only attribute changes</param>
// IDelayResult DelayUntilStateChange(IEnumerable<string> entityIds, object? to = null, object? from = null, bool allChanges = false);

// /// <summary>
// /// Delays until state changes
// /// </summary>
// /// <param name="entityId">The unique id of the enitty to wait for state changes</param>
// /// <param name="to">The state change to, or null if any state</param>
// /// <param name="from">The state changed from or null if any state</param>
// /// <param name="allChanges">Get all changed, even only attribute changes</param>
// IDelayResult DelayUntilStateChange(string entityId, object? to = null, object? from = null, bool allChanges = false);

// /// <summary>
// /// Delays until state changes using lambda expression to check states
// /// </summary>
// /// <param name="entityIds">The entities to wait for state changes</param>
// /// <param name="stateFunc">Lambda expression to select state changes</param>
// IDelayResult DelayUntilStateChange(IEnumerable<string> entityIds, Func<EntityState?, EntityState?, bool> stateFunc);

// /// <summary>
// /// Selects one or more entities to do action on
// /// </summary>
// /// <param name="entityId">The unique id of the entity</param>
// IEntity Entities(IEnumerable<string> entityId);

// /// <summary>
// /// Selects one or more entities to do action on using lambda
// /// </summary>
// /// <param name="func">The lambda expression for selecting entities</param>
// IEntity Entities(Func<IEntityProperties, bool> func);

// /// <summary>
// /// Selects one or more entities to do action on
// /// </summary>
// /// <param name="entityId">The unique id of the entity</param>
// IEntity Entity(params string[] entityId);

// // FLUENT API
// /// <summary>
// /// Selects one or more events to do action on
// /// </summary>
// /// <param name="eventParams">Events</param>
// IFluentEvent Event(params string[] eventParams);

// /// <summary>
// /// Selects one or more events to do action on
// /// </summary>
// /// <param name="eventParams">Events</param>
// IFluentEvent Events(IEnumerable<string> eventParams);

// /// <summary>
// /// Selects the events to do actions on using lambda
// /// </summary>
// /// <param name="func">The lambda expression selecting event</param>
// IFluentEvent Events(Func<FluentEventProperty, bool> func);

// /// <summary>
// /// Selects one or more input select to do action on
// /// </summary>
// /// <param name="inputSelectParams">Events</param>
// IFluentInputSelect InputSelect(params string[] inputSelectParams);

// /// <summary>
// /// Selects one or more input selects to do action on
// /// </summary>
// /// <param name="inputSelectParams">Events</param>
// IFluentInputSelect InputSelects(IEnumerable<string> inputSelectParams);

// /// <summary>
// /// Selects the input selects to do actions on using lambda
// /// </summary>
// /// <param name="func">The lambda expression selecting input select</param>
// IFluentInputSelect InputSelects(Func<IEntityProperties, bool> func);

// /// <summary>
// /// Listen to state change
// /// </summary>
// /// <param name="ev">The event to listen to</param>
// /// <param name="action">The action to call when event fires</param>
// void ListenEvent(string ev,
// Func<string, dynamic?, Task> action);

// /// <summary>
// /// Listen to event state
// /// </summary>
// /// <param name="funcSelector">Using lambda expression to select event</param>
// /// <param name="action">The action to call when event fires</param>
// void ListenEvent(Func<FluentEventProperty, bool> funcSelector,
// Func<string, dynamic, Task> action);

// /// <summary>
// /// Listen to statechange
// /// </summary>
// /// <param name="pattern">Match pattern, entity_id or domain</param>
// /// <param name="action">The func to call when matching</param>
// /// <returns>Returns a guid that can be used to cancel the event listening with CancelListenState</returns>
// /// <remarks>
// /// The callback function is
// /// - EntityId
// /// - newEvent
// /// - oldEvent
// /// </remarks>
// string? ListenState(string pattern,
// Func<string, EntityState?, EntityState?, Task> action);

// /// <summary>
// /// Selects one or more media player entities to do action on
// /// </summary>
// /// <param name="entityIds">Entity unique id:s</param>
// IMediaPlayer MediaPlayer(params string[] entityIds);

// /// <summary>
// /// Selects one or more media player entities to do action on
// /// </summary>
// /// <param name="entityIds">Entity unique id:s</param>
// IMediaPlayer MediaPlayers(IEnumerable<string> entityIds);

// /// <summary>
// /// Selects one or more media player entities to do action on using lambda
// /// </summary>
// /// <param name="func">The lambda expression selecting mediaplayers</param>
// IMediaPlayer MediaPlayers(Func<IEntityProperties, bool> func);

// /// <summary>
// /// Runs one or more scripts
// /// </summary>
// /// <param name="entityIds">The unique id:s of the script</param>
// IScript RunScript(params string[] entityIds);
// }

/// <summary>
/// Shared features in both Reactive and async/await models
/// </summary>
Expand Down
7 changes: 2 additions & 5 deletions src/App/NetDaemon.App/Common/NetDaemonAppBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,9 @@ public void SetAttribute(string attribute, object? value)
{
RuntimeInfo.AppAttributes[attribute] = value;
}
else
else if (RuntimeInfo.AppAttributes.ContainsKey(attribute))
{
if (RuntimeInfo.AppAttributes.ContainsKey(attribute))
{
RuntimeInfo.AppAttributes.Remove(attribute);
}
RuntimeInfo.AppAttributes.Remove(attribute);
}
UpdateRuntimeInformation();
}
Expand Down
Loading

0 comments on commit 920a0b7

Please sign in to comment.