Inheritance: System.Net.Http.HttpClient
        public async Task<IActionResult> CreateSmartApp(OauthInfo authInfo)
        {
            if (ModelState.IsValid == false)
                return View(authInfo);

            var conn = new SmartThingsConnection();
            if (await conn.Login(authInfo.STUserId, authInfo.STPassword) == false)
            {
                ModelState.AddModelError("STPassword", "Could not connect to smart things using the supplied credentials");
                return View("Index", authInfo);
            }

            var cs = new DeviceTypeRepository(conn, "j64 Alarm", $"{myEnv.WebRootPath}/../SmartThingApps/j64AlarmDevice.groovy");
            var ss = new DeviceTypeRepository(conn, "j64 Contact Zone", $"{myEnv.WebRootPath}/../SmartThingApps/j64ContactZoneDevice.groovy");
            var mz = new DeviceTypeRepository(conn, "j64 Motion Zone", $"{myEnv.WebRootPath}/../SmartThingApps/j64MotionZoneDevice.groovy");
            var pd = new DeviceTypeRepository(conn, "j64 Partition", $"{myEnv.WebRootPath}/../SmartThingApps/j64PartitionDevice.groovy");

            var jal = new SmartAppRepository(conn, "j64 Alarm", $"{myEnv.WebRootPath}/../SmartThingApps/j64AlarmSmartApp.groovy");

            // Save the client/secret keys
            var oauth = OauthRepository.Get();
            oauth.clientKey = jal.clientKey;
            oauth.secretKey = jal.secretKey;
            OauthRepository.Save(oauth);

            return View("Index", oauth);
        }
Esempio n. 2
0
        public DeviceTypeRepository(SmartThingsConnection smartThingsConnection, string appName, string fileName)
        {
            myConnection = smartThingsConnection;
            var t = CreateOrReplace(appName, fileName);

            t.Wait();
        }
Esempio n. 3
0
 public DeviceTypeRepository(SmartThingsConnection smartThingsConnection)
 {
     myConnection = smartThingsConnection;
 }
Esempio n. 4
0
 public SmartAppRepository(SmartThingsConnection smartThingsConnection)
 {
     myConnection = smartThingsConnection;
 }
 public DeviceTypeRepository(SmartThingsConnection smartThingsConnection, string appName, string fileName)
 {
     myConnection = smartThingsConnection;
     var t = CreateOrReplace(appName, fileName);
     t.Wait();
 }
 public DeviceTypeRepository(SmartThingsConnection smartThingsConnection)
 {
     myConnection = smartThingsConnection;
 }
 public SmartAppRepository(SmartThingsConnection smartThingsConnection)
 {
     myConnection = smartThingsConnection;
 }