Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/tuyanet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md20
1 files changed, 17 insertions, 3 deletions
diff --git a/README.md b/README.md
index 5ef2060..d972e87 100644
--- a/README.md
+++ b/README.md
@@ -231,7 +231,22 @@ Or just:
```C#
newDps = await device.UpdateDpsAsync(9, 10);
```
-## Automatic local key refresh
+### IR Remote Control
+
+Since version 1.0.3 you can control infrared remote controls. There is TuyaIRControl class for it. You can learn button from real remote control using `GetButtonCodeAsync` method (it returns Base64-encoded pulses sequences) and simulate button press using `SendButtonCodeAsync` method.
+Example:
+```C#
+string codeBase64 = await ir.GetButtonCodeAsync(10000, retries: 1);
+Console.WriteLine($"Button code learned: {codeBase64}");
+while (true)
+{
+ await ir.SendButtonCodeAsync(codeBase64);
+ Console.WriteLine("Button press simulated");
+ await Task.Delay(1000);
+}
+```
+
+### Automatic local key refresh
You can create `TuyaDevice` object without local key but with API key/secret like this:
```C#
@@ -245,9 +260,8 @@ await dev.RefreshLocalKeyAsync()
## Using the Cloud API
You can use official [Tuya Cloud API](https://developer.tuya.com/en/docs/cloud/).
-```C#
Example of [device specifications](https://developer.tuya.com/en/docs/cloud/device-control?id=K95zu01ksols7#title-27-Get%20the%20specifications%20and%20properties%20of%20the%20device%2C%20including%20the%20instruction%20set%20and%20status%20set) request:
-
+```C#
var api = new TuyaApi(region: TuyaApi.Region.CentralEurope, accessId: ACCESS_ID, apiSecret: API_SECRET);
var devspec = await api.RequestAsync(TuyaApi.Method.GET, $"/v1.1/devices/{DEVICE_ID}/specifications");
```