EP94.ThinqSharp 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package EP94.ThinqSharp --version 1.0.3                
NuGet\Install-Package EP94.ThinqSharp -Version 1.0.3                
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="EP94.ThinqSharp" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EP94.ThinqSharp --version 1.0.3                
#r "nuget: EP94.ThinqSharp, 1.0.3"                
#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 EP94.ThinqSharp as a Cake Addin
#addin nuget:?package=EP94.ThinqSharp&version=1.0.3

// Install EP94.ThinqSharp as a Cake Tool
#tool nuget:?package=EP94.ThinqSharp&version=1.0.3                

EP94.ThinqSharp

Library to connect and interact with LG V2 devices through the thinq api. For now the only supported device is the airconditioner, as I don't own any other LG devices.

NuGet version (EP94.ThinqSharp)

Code example:

// In this example Serilog is used, but it can be any logging library
Log.Logger = new LoggerConfiguration()
                .MinimumLevel.Verbose()
                .WriteTo.Console().CreateLogger();

ThinqClient thinqClient;
string passportFilePath = Path.Combine(Directory.GetCurrentDirectory(), "Passport.json");

// A passport can be used to speed up the login process
// In this example the passport is saved in a json file
if (!File.Exists(passportFilePath))
{
    thinqClient = new ThinqClient(LoggerFactory.Create(builder => builder.AddSerilog()));
    // Request the passport and save it for later use
    Passport passport = await thinqClient.GetPassportAsync("your_username", "your_password");
    File.WriteAllText(passportFilePath, JsonConvert.SerializeObject(passport));
}
else
{
    Passport passport = JsonConvert.DeserializeObject<Passport>(File.ReadAllText(passportFilePath));
    // If the passport is provided through the constructor, the GetPassportAsync method doesn't have to be called
    thinqClient = new ThinqClient(passport, LoggerFactory.Create(builder => builder.AddSerilog()));
}
IEnumerable<DeviceClient> deviceClients = await thinqClient.ConnectAsync();

// Turn all airconditioners on
foreach (DeviceClient deviceClient in deviceClients)
{
    if (deviceClient is AcClient acClient)
    {
        await acClient.SetSnapshotValue(snapshot => snapshot.IsOn, true);
        // or
        await acClient.SetOnState(true);
    }
    deviceClient.OnDeviceSnapshotChanged += (sender, args) =>
    {
        Console.WriteLine($"Snapshot of device {deviceClient.DeviceInfo.Alias} has changed: {deviceClient.DeviceSnapshot}");
    };
}      
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
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.0.7 187 8/16/2023
1.0.6 384 9/28/2022
1.0.5 405 8/13/2022
1.0.4 398 8/12/2022
1.0.3 385 8/12/2022
1.0.2 402 8/10/2022
1.0.1 376 8/9/2022
1.0.0 381 8/8/2022