PhilipDaubmeier.DigitalstromTwin
1.9.0
dotnet add package PhilipDaubmeier.DigitalstromTwin --version 1.9.0
NuGet\Install-Package PhilipDaubmeier.DigitalstromTwin -Version 1.9.0
<PackageReference Include="PhilipDaubmeier.DigitalstromTwin" Version="1.9.0" />
paket add PhilipDaubmeier.DigitalstromTwin --version 1.9.0
#r "nuget: PhilipDaubmeier.DigitalstromTwin, 1.9.0"
// Install PhilipDaubmeier.DigitalstromTwin as a Cake Addin #addin nuget:?package=PhilipDaubmeier.DigitalstromTwin&version=1.9.0 // Install PhilipDaubmeier.DigitalstromTwin as a Cake Tool #tool nuget:?package=PhilipDaubmeier.DigitalstromTwin&version=1.9.0
DigitalstromTwin
DigitalstromTwin is a class library providing a DigitalstromDssTwin object as the main class, that automatically synchronizes scene states of all rooms both ways, i.e. if a state is changed programatically it sends a command to the DSS, if a scene is changed within the apartement the event is synched into the twin model.
NuGet
PM> Install-Package PhilipDaubmeier.DigitalstromTwin
Usage
You have to implement the interface IDigitalstromConnectionProvider
to provide the DigitalstromDssTwin
with all information necessary to authenticate at the API and establish a connection, or use the default implementation DigitalstromConnectionProvider
. See DigitalstromClient usage documentation for an example of this.
Having a connection provider, you can create a DigitalstromDssTwin
and use it like:
// Create the twin
var dssTwin = new DigitalstromDssTwin(connProvider);
// Get notified by events if something changed on the DSS
dssTwin.CollectionChanged += (s, e) => Console.WriteLine("New room detected");
dssTwin.SceneChanged += (s, e) => Console.WriteLine($"Scene in zone {e.Zone}, " +
$"group {e.Group} was changed to {e.Scene}");
Zone zoneKitchen = 5;
// Read the last called scene by simply using the indexer operator
var kitchenLightScene = dssTwin[zoneKitchen, Color.Yellow];
// Call a scene on the DSS by just setting the desired value on the twin
dssTwin[zoneKitchen, Color.Yellow].Value = SceneCommand.Preset2;
For more usage examples you can also have a look at the unit tests.
Platform Support
DigitalstromTwin is targeted for .NET 9.0 or higher.
License
The MIT License (MIT)
Copyright (c) 2019-2024 Philip Daubmeier
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. |
-
net9.0
- PhilipDaubmeier.DigitalstromClient (>= 1.8.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
1.9.0 - upgraded to target framework net9.0
1.8.0 - upgraded to target framework net8.0
1.7.0 - upgraded to target framework net5.0
1.6.1 - fixed multi TFM issues
1.6.0 - widened range of supported platforms by targeting netstandard2.1
1.5.0 - moved to System.Text.Json and removed dependency to Json.NET
1.4.0 - upgraded to target framework netcoreapp3.1
1.3.0 - new package without pre-release dependencies.
1.2.0-beta1 - added support for HttpClientFactory and Polly. Enabled non-nullable reference types.
1.1.0 - migrated to netcoreapp3.0
1.0.0 - Initial version with publishing version 1.0 of GraphIoT