コード例 #1
0
        private static async Task MonitorAsync(HttpClient httpClient)
        {
            for (int i = 0; i < 60; i++)
            {
                var spaces = await Spaces.GetAllSpacesAsync(httpClient, true);

                var spacesData = spaces.Where(s => s.Values != null &&
                                              s.Values.Any(v => v.Type == "condicion"));
                if (spacesData.Any())
                {
                    foreach (var item in spacesData)
                    {
                        foreach (var value in item.Values)
                        {
                            Console.WriteLine($"Timestamp: {value.Timestamp}\nValue: {value.Value}\n");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("No es posible encontrar habitaciones");
                }

                await Task.Delay(2000);
            }
        }