diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2022-07-11 14:35:38 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2022-07-11 14:35:38 +0300 |
commit | c8ff1188f396a597a7286f5ab148f5da8b1c082b (patch) | |
tree | 0c9a4e0ea17e31ac3a4212a8e2339a193e26d3ac | |
parent | a2c7515e481514aee47663a852548902d77f7328 (diff) | |
parent | 94bf8184d8729dbe237db02f4e74ce594b063b05 (diff) |
Merge branch 'main' of github.com:ClusterM/tuyanetv1.0.3
-rw-r--r-- | README.md | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -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"); ``` |