PowerApps Weather

Have you ever thought that you can view the current weather status of various locations (various countries and states)? Yes, Power Apps provided this feature where a user can see the weather temperature details.

In this Power Apps Tutorial, We will discuss what is PowerApps Weather, What is the definition of Current Weather, and the Weather Forecast.

Also, We will see how we can create a Power Apps weather app, how to connect the MSN Weather, and its uses in the app.

Introduction to PowerApps Weather

  • PowerApps Weather is also known as PowerApps MSN weather. Whenever you are working with the PowerApps weather, then you must need to connect the MSN Weather connector to the app.
  • PowerApps MSN Weather is a type of connector that will help you to get the current or latest weather forecast including the temperature, humidity, precipitation for the specific location.

Definition of CurrentWeather and WeatherForecast

  • To get the current weather of a specific location, We will use the path as responses.weather.current
  • To get the forecast for the current day of a specific location, We will use the path as responses.daily.day

You can find all the details of the current weather and weather forecast by using these below tables.

Table – 1: (CurrentWeather)

NamePathTypeDescription
Pressureresponses.weather.current.barofloatIt defines the atmospheric pressure.
Conditionsresponses.weather.current.capstringIt specifies a caption of weather conditions such as rainy, sunny, etc.
Dewpointresponses.weather.current.dewPtfloatIt defines the temperature at which dew forms.
Apparent Temperatureresponses.weather.current.feelsfloatIt represents the apparent temperature or feels-like temperature.
Humidityresponses.weather.current.rhfloatIt defines the relative humidity percentage.
METAR weather conditionsresponses.weather.current.wxstringIt specifies the METAR code of weather conditions.
METAR Sky Conditionsresponses.weather.current.skystringIt specifies the METAR code of sky conditions.
Temperatureresponses.weather.current.tempfloatIt defines the current temperature.
UV Indexresponses.weather.current.uvfloatIt defines the numerical UV index.
UV Index Descriptionresponses.weather.current.uvDescstringA description of the meaning of the UV index.
Visibility Distanceresponses.weather.current.visfloatIt specifies the visibility distance.
Wind Directionresponses.weather.current.windDirintegerIt defines the wind direction in degrees clockwise from north.
Wind Speedresponses.weather.current.windSpdfloatIt defines the wind speed.
Wind Gust Speedresponses.weather.current.windGustfloatIt defines the wind gust speed.
Last Updatedresponses.weather.current.createddate-timeIt specifies the datetime at which the provider created the current condition.
Latituderesponses.source.coordinates.latfloatIt specifies the latitude of the location.
Longituderesponses.source.coordinates.lonfloatIt specifies the longitude of the location.
Locationresponses.source.locationstringIt defines the location for which the provider created the current condition.
Pressure Unitsunits.pressurestringIt represents the units used for pressure measurements.
Temperature Unitsunits.temperaturestringIt represents the units used for temperature measurements.
Speed Unitsunits.speedstringIt represents the units used for speed measurements.
Distance Unitsunits.distancestringIt represents the units used for distance measurements.

Table – 2: (WeatherForecast)

See also  Power Apps Filter Gallery By Date [With Examples]
NamePathTypeDescription
Conditionsresponses.daily.day.capStringIt specifies the weather conditions like rainy, sunny, etc.
Rain Chanceresponses.daily.day.precipfloatIt defines the chance of precipitation (%).
METAR Weather Conditionsresponses.daily.day.wxstringIt defines the METAR code of weather conditions.
METAR Sky Conditionsresponses.daily.day.skystringIt specifies the METAR code of sky conditions.
Wind Directionresponses.daily.day.windDirintegerIt represents the wind direction in degrees clockwise from north.
Wind Speedresponses.daily.day.windSpdfloatIt describes the wind speed.
Summaryresponses.daily.day.summarystringIt specifies the text summary of the forecast.
Conditionsresponses.daily.night.capstringIt specifies the weather conditions such as rainy, sunny, etc.
Rain Chanceresponses.daily.night.precipfloatIt specifies the chance of precipitation (%).
METAR Weather Conditionsresponses.daily.night.wxstringIt defines the METAR code of weather conditions.
METAR Sky Conditionsresponses.daily.night.skystringIt defines the METAR code of sky conditions.
Wind Directionresponses.daily.night.windDirintegerIt specifies the wind direction in degrees clockwise from north.
Wind Speedresponses.daily.night.windSpdfloatIt defines the wind speed.
Summaryresponses.daily.night.summarystringIt specifies a text summary of the forecast.
Conditionsresponses.daily.pvdrCapstringIt specifies the weather conditions such as rainy, sunny, etc.
Dateresponses.daily.validdate-timeIt defines the datetime at which the forecast is valid.
Rain Chanceresponses.daily.precipfloatIt specifies the chance of precipitation (%).
Max Wind Speedresponses.daily.windMaxfloatIt defines the peak wind speed for the day.
Max Wind Directionresponses.daily.windMaxDirintegerIt defines the direction of the peak wind for the day.
Humidity Highresponses.daily.rhHifloatIt represents the high relative humidity point for the day.
Humidity Lowresponses.daily.rhLofloatIt specifies the low relative humidity point for the day.
Temperature Highresponses.daily.tempHifloatIt defines the high temperature.
Temperature Lowresponses.daily.tempLofloatIt defines the low temperature.
UV Indexresponses.daily.uvfloatIt defines the numerical UV index.
UV Index Descriptionresponses.daily.uvDescstringIt defines the description of the meaning of the UV index.
Forecast Dateresponses.daily.createddate-timeIt defines the DateTime at which the daily forecast was derived.
Sunrise Timeresponses.almanac.sunrisedate-timeIt represents the time of sunrise on the day of this forecast.
Sunset Timeresponses.almanac.sunsetdate-timeIt represents the time of sunset on the day of this forecast.
Moonrise Timeresponses.almanac.moonrisedate-timeIt defines the time of moonrise on the day of this forecast.
Moonset Timeresponses.almanac.moonsetdate-timeIt defines the time of moonset on the day of this forecast.
Moon Phaseresponses.almanac.moonPhasestringIt specifies the phase of the moon on the day of this forecast.
Moon Phase Coderesponses.almanac.moonPhaseCodestringIt defines the code representing the phase of the moon.
Latituderesponses.source.coordinates.latfloatIt describes the latitude of the location.
Longituderesponses.source.coordinates.lonfloatIt describes the longitude of the location.
Locationresponses.source.locationstringIt defines the location for which the provider created the forecast.
Pressure Unitsunits.pressurestringit defines the units used for pressure measurements.
Temperature Unitsunits.temperaturestringIt defines the units used for temperature measurements.
Speed Unitsunits.speedstringIt defines the units used for speed measurements.
Distance Unitsunits.distancestringIt defines the units used for distance measurements.

Check out, Power BI integration with PowerApps Portals

See also  Power Apps Search SharePoint List Examples

Create PowerApps Weather App

Next, We will see how we can create weather in PowerApps and use it within the app. Refer to the below instructions to do so.

  • The below screenshot represents the PowerApps Weather app that I have created. To view the current weather of a specific location, a user will enter the location name in the text box and tap on the Search icon.
  • Once the user will search the weather of the particular location, then it will display all the current weather details like Temperature, Pressure, Dew Point, Humidity, Last Update, etc of that place as shown in the below figure.
  • Also, there will be two units i.e. Imperial and Metric. If you will select Imperial, then the temperature will appear with the Farhenheit unit and if you will select Metric, then the temperature will appear with the Celcius unit.
PowerApps Weather
PowerApps Weather

Read Power Apps Azure AD Group

Connect MSN Weather in PowerApps

  • Before creating the Weather app, you must need to connect the MSN Weather connector to the PowerApps.
  • To connect the MSN Weather in the app, go to the Data tab (from the left navigation pane) -> +Add data -> Search MSN Weather in the search box as shown below.
Power Apps Weather App
Power Apps Weather App
  • Click on the MSN Weather connector and then tap to Connect button. Once you will click on it, then the weather connector will connect to the app. Without MSN Weather connector, it is not possible to display the latest weather details in the app.
Weather in PowerApps
  • Next, the things that come to your mind is, what are the PowerApps controls that I have used to make this app. As you can see, I have used these below controls as:
  1. WEATHER FORECAST = This is a Label control that I used for the App Title purpose.
  2. AUSTRALIA = This is a Text input control where a user can enter the location.
  3. Search icon = It is an icon that will help you to search the weather of that specified location.
  4. Imperial, Metric = These are the Radio button controls where a user will select for his need.
  5. Image = This is simply an image control where you can display the weather pictures.
  6. Temperature = This is a Label control where a user can view the current weather temperature of the specific location.
  7. MOSTLY CLOUDY = The weather that how you feels can view in this label control.
  8. Weather Pressure = This is a label control that specifies the weather pressure of the specific location.
  9. Dew Point = This label control shows the dew point of the specific place.
  10. Humidity = In this label control, you can view the current weather humidity of the particular place.
  11. Last Update = You can see the last weather updation in this label control.
PowerApps Weather App
PowerApps Weather App
  • Now we will see what are the formulas we will use and get all the latest weather details in the app.
  1. At first, Select the Search icon and apply the below code on its Onselect property as:
OnSelect = UpdateContext(
    {
        WeatherForecast: MSNWeather.CurrentWeather(
            txtSearchLocation.Text,
            rdUnits.Selected.Value
        )
    }
)

Where,

  • WeatherForecast = Context variable name
  • txtSearchLocation = Text input control name where a user can enter the location
  • rdUnits = Radio control name
Power Apps Weather
Power Apps Weather

2. The second thing is about the Radio button control. Select the control and set its Items property as:

Items = ["Imperial", "Metric"]
Create Weather in PowerApps
Create Weather in PowerApps

3. Now we will discuss about all the latest Weather Forecast like Temperature, Pressure, Dew point etc. Follow the below codes to get the details as:

See also  Power Apps Filter SharePoint List [25+ Examples]

Temperature:

To get the latest temperature of the specific location, you can set the below code to the Label’s Text property as:

Text = "Temperature:  " & WeatherForecast.responses.weather.current.temp & " " & WeatherForecast.units.temperature

Where,

WeatherForecast = Specified context Variable name

Create PowerApps Weather

Conditions:

To get the current weather condition of the specific location, you can set the below code to the Label’s Text property as:

Text = Upper(WeatherForecast.responses.weather.current.cap)
Weather in Power Apps

Pressure:

To get the current weather pressure of the specific location, you can set the below code to the Label’s Text property as:

Text = "Weather Pressure: " & WeatherForecast.responses.weather.current.baro & " " & WeatherForecast.units.pressure
Weather forecast in PowerApps

Dew Point:

To get the weather dew point of the specific location, you can set the below code to the Label’s Text property as:

Text = "Dew Point: " & WeatherForecast.responses.weather.current.dewPt & " o"
PowerApps Weather forecast
PowerApps Weather forecast

Humidity:

To get the weather humidity of the specific location, you can set the below code to the Label’s Text property as:

Text = "Humidity: " & WeatherForecast.responses.weather.current.rh & " %"
Weather forecast in Power Apps

Last Update:

To get the Last weather update of the specific location, you can set the below code to the Label’s Text property as:

Text = "Last Update: " & WeatherForecast.responses.weather.current.created
Power Apps Weather forecast
Power Apps Weather forecast
  • Not only these weather parameters, but also you can get more weather information by using the provided code that I have explained you in the above tables.
  • For example, you can use the code to get the latest weather information like UV Index, Visibility Distance, Wind Direction, Latitude, Longitude etc.

Also, you may like the below PowerApps Tutorials:

In this Power Apps Tutorial, We discussed what is PowerApps Weather, What is the definition of Current Weather, and the Weather Forecast. Also, We saw how to create a Power Apps weather app, how to connect the MSN Weather and its uses in the app.

  • >