Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pilotkid/vesync-.net
https://github.com/pilotkid/vesync-.net
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/pilotkid/vesync-.net
- Owner: pilotkid
- Created: 2020-02-19T21:17:51.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T09:45:13.000Z (about 2 years ago)
- Last Synced: 2024-11-05T18:55:25.419Z (2 months ago)
- Language: C#
- Size: 47.9 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# VeSync Wrapper For .NET
This is an unoffical wrapper for VeSync smart switches. Created by Marcello Bachechi in about 45 minutes. Code could be cleaner but it works well.
## Example Usage
VeSync v = new VeSync("username","pass");
Device[] Devices = v.GetDevices();
foreach(var d in Devices)
{
Console.WriteLine("Device Name = {1}", d.Name);
//Option 1 to control state
d.TurnOff();
d.TurnOn();
//Option 2 to control state
v.turn_on(d);
v.turn_off(d);
}## Login Data
To see the full return of the login you can call the snippet below. This will allow you to see things such as the profile image URL.v.LoginData
Login Data contains
- Token
- Account ID
- Nickname
- Avatar Icon
- User Type
- TOS Accepted in Language
- Terms Status### Example
VeSync v = new VeSync("username","pass");
MessageBox.Show($"Welcome back, {v.LoginData.NickName}");
//Load image from URL to PictureBox
var request = WebRequest.Create(v.LoginData.AvatarIconURL);
using (var response = request.GetResponse())
{
using (var stream = response.GetResponseStream())
pictureBox1.Image = Bitmap.FromStream(stream);
}## Device
If you need more information from the device you can.
Device Contains the following properties
- Name
- ID
- Status
- Connection Type
- Connection Status
- Device Type
- Device Model
- Firmware Version
You can also turn on and off the device using the methods `TurnOn` and `TurnOff`
### ExampleVeSync v = new VeSync("username","pass");
Device[] Devices = v.GetDevices();
foreach(var d in Devices)
{
Console.WriteLine("Device {1} is currently", d.Name, d.Status);
if(d.Status == "off")
d.TurnOn();
}