mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 09:41:19 +00:00
28 lines
597 B
C#
28 lines
597 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using YeelightAPI;
|
|
|
|
namespace MyCore.Services
|
|
{
|
|
public class YeelightService
|
|
{
|
|
public List<Device> devices = new List<Device>();
|
|
|
|
public async Task<List<Device>> GetDevices()
|
|
{
|
|
devices = await DeviceLocator.Discover();
|
|
|
|
//Toggle(devices[1]);
|
|
return devices;
|
|
}
|
|
|
|
public async Task<bool> Toggle(Device device)
|
|
{
|
|
await device.Connect();
|
|
return await device.Toggle();
|
|
}
|
|
}
|
|
}
|