// UWP App (Device Client) -> IoT Device public static async Task SendMessageAsync(DeviceClient deviceClient, SentMessages sentMessages) { // Anropa och vänta in resultat från OpenWeatherMap via WeatherService var data = await WeatherService.FetchWeatherData(); // Konvertera till JSON & vidare till bytes string json = JsonConvert.SerializeObject(data); await deviceClient.SendEventAsync(new Message(Encoding.UTF8.GetBytes(json))); sentMessages.Insert(0, new SentMessageModel(data.Temperature, data.Humidity)); }