public SmartAppRepository(SmartThingsConnection smartThingsConnection, string appName, string fileName) { myConnection = smartThingsConnection; var t = CreateOrReplace(appName, fileName); t.Wait(); }
public async Task<IActionResult> CreateSmartApp(OauthViewModel 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 Channel Switch", $"{myEnv.WebRootPath}/../SmartThingApps/j64ChannelSwitchDevice.groovy"); var ss = new DeviceTypeRepository(conn, "j64 Surfing Switch", $"{myEnv.WebRootPath}/../SmartThingApps/j64SurfingSwitchDevice.groovy"); var vs = new DeviceTypeRepository(conn, "j64 VCR Switch", $"{myEnv.WebRootPath}/../SmartThingApps/j64VcrSwitchDevice.groovy"); var os = new DeviceTypeRepository(conn, "j64 Volume Switch", $"{myEnv.WebRootPath}/../SmartThingApps/j64VolumeSwitchDevice.groovy"); var cc = new DeviceTypeRepository(conn, "j64 Custom Command Switch", $"{myEnv.WebRootPath}/../SmartThingApps/j64CustomCommandSwitchDevice.groovy"); var har = new SmartAppRepository(conn, "j64 Harmony", $"{myEnv.WebRootPath}/../SmartThingApps/j64HarmonySmartApp.groovy"); // Save the client/secret keys var oauth = OauthRepository.Get(); oauth.clientKey = har.clientKey; oauth.secretKey = har.secretKey; OauthRepository.Save(oauth); var ovm = new OauthViewModel() { ClientKey = oauth.clientKey, SecretKey = oauth.secretKey }; return View("Index", ovm); }
public SmartAppRepository(SmartThingsConnection smartThingsConnection) { myConnection = smartThingsConnection; }
public DeviceTypeRepository(SmartThingsConnection smartThingsConnection) { myConnection = smartThingsConnection; }