HomematicIp 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package HomematicIp --version 1.0.1                
NuGet\Install-Package HomematicIp -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HomematicIp" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HomematicIp --version 1.0.1                
#r "nuget: HomematicIp, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HomematicIp as a Cake Addin
#addin nuget:?package=HomematicIp&version=1.0.1

// Install HomematicIp as a Cake Tool
#tool nuget:?package=HomematicIp&version=1.0.1                

HomematicIp

This package allows to query the HomematicIp REST and WebSocket endpoint.

The following code be self-explanatory. If it is not, there are explanatory comments in the HomematicIp.Console project. You can also use that project to get started

#region 1. Authorization
HttpClient HttpClientFactory() => new HttpClient();
var accessPointId = "YOUR_ACCESS_POINT_ID";
var homematicAuthService = new HomematicAuthService(HttpClientFactory, accessPointId, "YOUR_PIN", "MyHomematicApp");
await homematicAuthService.ConnectionRequest();
System.Console.WriteLine("Please press the blue button on the access point.");
while (!await homematicAuthService.IsRequestAcknowledged())
{
    await Task.Delay(TimeSpan.FromSeconds(1));
}
var authToken = await homematicAuthService.RequestAuthToken();
await File.WriteAllTextAsync("config.txt", authToken);
#endregion

#region 2a. QueryRestEndpoint
var homematicService = new HomematicService(HttpClientFactory, accessPointId, authToken, new ClientWebSocket());
var cts = new CancellationTokenSource();
await homematicService.ConnectAsync(cts.Token);
var homematicIpEnvironment = await homematicService.GetCurrentState(cts.Token);
System.Console.WriteLine($"This Homematic Installation has {homematicIpEnvironment.Clients.Count} connected Clients.");
#endregion

#region 2b.QueryWebSocketEndpoint
var events = homematicService.ReceiveEvents(cts.Token);
events.Where(notification => notification.HomematicIpObjectBase is ShutterContactDevice)
    .Subscribe(notification =>
    {
        var shutterContactDevice = notification.HomematicIpObjectBase as ShutterContactDevice;
        System.Console.WriteLine($"{shutterContactDevice?.Label}: WindowState={shutterContactDevice?.WindowState}");
    });
events.Subscribe(System.Console.WriteLine);
await events.LastOrDefaultAsync();
#endregion

Yet unsupported devices

Since there are a lot of Homematic devices, you might be presented with a message like this. In that case please open an issue, we will add the device asap:

The HomematicIp Endpoint sent a message about an unknown HomematicIp Object (most likely a yet unsupported device). Please open an issue at https://github.com/larsbeck/HomematicIp to have this device added to the library. We will need the following: {...}

A big thank you for laying the groundwork goes to the creators of this Python library https://github.com/coreGreenberet/homematicip-rest-api

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 684 6/12/2019
1.0.7 546 5/8/2019
1.0.6 559 5/8/2019
1.0.5 553 5/8/2019
1.0.4 571 5/8/2019
1.0.3 566 5/7/2019
1.0.2 636 4/23/2019
1.0.1 611 4/21/2019