EP94.ThinqSharp
1.0.5
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package EP94.ThinqSharp --version 1.0.5
NuGet\Install-Package EP94.ThinqSharp -Version 1.0.5
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.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EP94.ThinqSharp --version 1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EP94.ThinqSharp, 1.0.5"
#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.5 // Install EP94.ThinqSharp as a Cake Tool #tool nuget:?package=EP94.ThinqSharp&version=1.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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.
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);
// or send multiple values
await acClient.SendMultipleValues(TimeSpan.FromMilliseconds(100))
.Value(s => s.IsOn, true)
.Value(s => s.OperationMode, (double)AcMode.Cool)
.Value(s => s.FanSpeed, (double)AcFanSpeed.High)
.SendCommandsAsync();
}
deviceClient.OnDeviceSnapshotChanged += (sender, args) =>
{
Console.WriteLine($"Snapshot of device {deviceClient.DeviceInfo.Alias} has changed: {deviceClient.DeviceSnapshot}");
};
}
Product | Versions 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.
-
net6.0
- Microsoft.AspNetCore.WebUtilities (>= 2.2.0)
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 6.0.1)
- MQTTnet (>= 4.0.2.221)
- Newtonsoft.Json (>= 13.0.1)
- Portable.BouncyCastle (>= 1.9.0)
- Serilog (>= 2.11.0)
- Serilog.Extensions.Logging (>= 3.1.0)
- Serilog.Sinks.Console (>= 4.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.