-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
As we move towards a more stable API:s I want to clean up some redundant API:s. I rather add more if the community wants it. After this PR the APIs will be more stable but not guaranteed not to be changed until first release. **BREAKING CHANGE!!** Following API calls are removed. - TurnOnAsync - TurnOffAsync - ToggleAsync - Light / Lights There are alternatives. Use `await Entity("light.some_light").TurnOn().ExecuteAsync();` or `CallService`instead. If you still want to use these please copy the extensions methods I provided in my repo: https://github.com/helto4real/hassio/blob/master/netdaemon/apps/Extensions/ServiceExtensions.cs
- Loading branch information
1 parent
921b2c7
commit b5bbee8
Showing
10 changed files
with
95 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
using System.Collections.Generic; | ||
|
||
namespace JoySoftware.HomeAssistant.NetDaemon.Common | ||
{ | ||
/// <summary> | ||
/// Useful extension methods used | ||
/// </summary> | ||
public static class Extensions | ||
{ | ||
/// <summary> | ||
/// Converts a valuepair to dynamic object | ||
/// </summary> | ||
/// <param name="attributeNameValuePair"></param> | ||
public static dynamic ToDynamic(this (string name, object val)[] attributeNameValuePair) | ||
{ | ||
// Convert the tuple name/value pair to tuple that can be serialized dynamically | ||
var attributes = new FluentExpandoObject(true, true); | ||
foreach (var (attribute, value) in attributeNameValuePair) | ||
{ | ||
((IDictionary<string, object>)attributes).Add(attribute, value); | ||
} | ||
|
||
dynamic result = attributes; | ||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.