예제 #1
0
        public async Task ConnectTest()
        {
            var smart = new SmartLife(email, password);
            await smart.Connect();

            Assert.IsNotNull(smart.Credentials);
            Console.WriteLine(smart.Credentials);
        }
예제 #2
0
        public void RestoreCredenditalsFromFileTest()
        {
            var smart = new SmartLife(email, password);

            smart.RestoreCredenditalsFromFile();
            Assert.IsNotNull(smart.Credentials);
            Console.WriteLine(smart.Credentials);
        }
예제 #3
0
        public async Task StoreCredenditalsToFileTest()
        {
            var smart = new SmartLife(email, password);
            var cred  = await smart.GetCredentials();

            smart.StoreCredenditalsToFile();
            Console.WriteLine(cred);
        }
예제 #4
0
        public async Task GetCredentialsTest()
        {
            var smart = new SmartLife(email, password);
            var cred  = await smart.GetCredentials();

            Assert.IsNotNull(cred);
            Console.WriteLine(cred);
        }
예제 #5
0
        internal static Device CreateDevice(SmartLife context, Device device)
        {
            var newDevice = CreateDeviceByDevType(device.dev_type);

            device.Adapt(newDevice);
            newDevice.context = context;

            return(newDevice);
        }
예제 #6
0
        public async Task RestoreDevicesFromFileTest()
        {
            var smart = new SmartLife(email, password);
            await smart.Connect();

            await smart.GetDevices();

            smart.RestoreDevicesFromFile();
        }
예제 #7
0
        public async Task InitDevicesTest()
        {
            var smart = new SmartLife(email, password);
            await smart.Connect();

            await smart.InitDevices();

            Assert.IsNotNull(smart.Devices);
        }
예제 #8
0
        public async Task SwitchTest()
        {
            var smart = new SmartLife(email, password);
            await smart.Connect();

            await smart.InitDevices();

            var device = smart.Devices.FirstOrDefault(x => x is SmartLifeNet.Classes.SwitchDevice) as SmartLifeNet.Classes.SwitchDevice;
            await device?.SetState(1);
        }
예제 #9
0
        public async Task MultiSwitchTest()
        {
            var smart = new SmartLife(email, password);
            await smart.Connect();

            await smart.InitDevices();

            var device = smart.Devices.FirstOrDefault(x => x is SmartLifeNet.Classes.MultiSwitchDevice) as SmartLifeNet.Classes.MultiSwitchDevice;
            await device?.SetAllChannels(1);

            await Task.Delay(500);

            await device?.SetAllChannels(0);
        }