mirror of
https://github.com/iminet/dev.git
synced 2026-08-22 23:28:25 +02:00
Added test action
This commit is contained in:
@@ -1,32 +1,32 @@
|
||||
using SmartThingsNet.Api;
|
||||
using SmartThingsNet.Client;
|
||||
using SmartThingsNet.Model;
|
||||
|
||||
namespace SmartThings
|
||||
{
|
||||
class SmartThings
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
string accesstoken = ""; // Fill your SmartThings access token here
|
||||
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("Locations:");
|
||||
Console.WriteLine("- " + String.Join(Environment.NewLine+"- ", locations.ListLocations(accesstoken).Items.Select(x => x.Name)));
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("Rooms:");
|
||||
Console.WriteLine("- " + String.Join(Environment.NewLine+"- ", rooms.ListRooms(accesstoken, locations.ListLocations(accesstoken).Items.First().LocationId.ToString()).Items.Select(x => x.Name)));
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("Devices:");
|
||||
Console.WriteLine("- " + String.Join(Environment.NewLine+"- ", devicelist.Select(x => $"{x.Label} :: {x.DeviceId}").ToList()));
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
using SmartThingsNet.Api;
|
||||
using SmartThingsNet.Client;
|
||||
using SmartThingsNet.Model;
|
||||
|
||||
namespace SmartThings
|
||||
{
|
||||
class SmartThings
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
string accesstoken = ""; // Fill your SmartThings access token here
|
||||
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("Locations:");
|
||||
Console.WriteLine("- " + String.Join(Environment.NewLine+"- ", locations.ListLocations(accesstoken).Items.Select(x => x.Name)));
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("Rooms:");
|
||||
Console.WriteLine("- " + String.Join(Environment.NewLine+"- ", rooms.ListRooms(accesstoken, locations.ListLocations(accesstoken).Items.First().LocationId.ToString()).Items.Select(x => x.Name)));
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine("Devices:");
|
||||
Console.WriteLine("- " + String.Join(Environment.NewLine+"- ", devicelist.Select(x => $"{x.Label} :: {x.DeviceId}").ToList()));
|
||||
Console.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user