public void TriggerDeviceEvent(NestDataModel data) { if (_isStreamingEvents) { this.OnNestEventStream_DeviceEventOccured?.Invoke(this, data); } }
static void Main(string[] args) { var accessToken = String.Empty; // Get location of executable var file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "accesstoken.txt"); if (File.Exists(file)) { accessToken = File.ReadAllText(file); } var client = new NestClient(PRODUCT_ID, PRODUCT_SECRET); if (!String.IsNullOrEmpty(accessToken)) { client.SetAccessToken(accessToken, DateTime.UtcNow.AddYears(1)); } // TODO load access token if (!client.IsAuthValid()) { GetAndStoreAccessToken(file, client).Wait(); } NestDataModel result = client.GetNestDataAsync().Result; Devices deviecs = client.GetDevicesAsync().Result; var cameras = client.GetCamerasAsync().Result; var thermostats = client.GetThermostatsAsync().Result; var smokeCoAlarms = client.GetSmokeCoAlarms().Result; }