Skip to content

Commit

Permalink
Camera support (net-daemon#57)
Browse files Browse the repository at this point in the history
Add Camera support to Fluent API.

In the effort to get more specific support for enitity domains in the fluent api, the camera is now added. Also it is first of many refactorings of the fluent API to make it simpler and easier to maintain.

The autogenerated camera entities will now use this interface instead.

Sample below:

```csharp
await DefaultDaemonHost
         .Camera("camera.camera1")
         .Snapshot("/config/www/snapshots/cam1.jpg")
         .ExecuteAsync();
```
  • Loading branch information
helto4real committed Apr 5, 2020
1 parent 4a96645 commit ce46724
Show file tree
Hide file tree
Showing 18 changed files with 715 additions and 199 deletions.
14 changes: 14 additions & 0 deletions .vscode/daemon.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,18 @@
],
"description": "XUNIT fact"
},
"fluentinterface": {
"scope": "csharp",
"prefix": "fluenti",
"body": [
" /// <summary>",
" /// Generic interface for $1",
" /// </summary>",
" public interface I$1<T>",
" {",
" T $1($2);",
" }",
],
"description": "Fluent interface"
},
}
7 changes: 5 additions & 2 deletions exampleapps/apps/theapp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ public static string PrettyPrintDictData(IDictionary<string, object>? dict)
}
public override async Task InitializeAsync()
{
Log("SET TESTSENSOR");
await SetState("sensor.testsensor", "10");
// await Camera("camera.my_camera")
// .Snapshot("/config/www/motion/snap.jpg")
// .ExecuteAsync();
// Log("SET TESTSENSOR");
// await SetState("sensor.testsensor", "10");

// await CallService("light", "toggle", new { entity_id = "light.tomas_rum" }, false);

Expand Down
Loading

0 comments on commit ce46724

Please sign in to comment.