mirror of
https://github.com/iminet/dev.git
synced 2026-02-12 04:34:13 +01:00
Adding SmartThings samples
This commit is contained in:
24
csharp/SmartThings/Program.cs
Normal file
24
csharp/SmartThings/Program.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using SmartThingsNet.Api;
|
||||
using SmartThingsNet.Client;
|
||||
using SmartThingsNet.Model;
|
||||
|
||||
namespace SmartThings
|
||||
{
|
||||
class SmartThings
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
string accesstoken = "";
|
||||
var configuration = new Configuration();
|
||||
configuration.AccessToken = accesstoken;
|
||||
var devices = new DevicesApi(configuration);
|
||||
var locations = new LocationsApi(configuration);
|
||||
var rooms = new RoomsApi(configuration);
|
||||
var devicelist = devices.GetDevices(accesstoken).Items;
|
||||
|
||||
Console.WriteLine(String.Join(Environment.NewLine, locations.ListLocations(accesstoken).Items.Select(x => x.Name)));
|
||||
Console.WriteLine(String.Join(Environment.NewLine, rooms.ListRooms(accesstoken, locations.ListLocations(accesstoken).Items.First().LocationId.ToString()).Items.Select(x => x.Name)));
|
||||
Console.WriteLine(String.Join(Environment.NewLine, devicelist.Select(x => $"{x.Label} :: {x.DeviceId}").ToList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user