Create Power Apps Weather App [Current & Tomorrow’s Forecast]

I needed a simple way to check the weather for various locations (across different countries and states) without having to switch between websites or apps. I built a Power Apps Weather App that displays current weather and forecasts in one place.

In this Power Apps tutorial, I will show you how to create a Power Apps weather app, connect the MSN Weather connector to the app, and its uses in the canvas app.

Also, we will discuss what Power Apps Weather is, the definition of Current Weather, and the Weather Forecast.

Power Apps Weather

Power Apps Weather is also called Power Apps MSN Weather. When building a weather app in Power Apps, you need to connect the MSN Weather connector to your app.

The Power Apps MSN Weather connector enables you to access the latest weather information, including temperature, humidity, and precipitation, for a specific location.

Create a Power Apps Weather App

  • The screenshot below shows the Power Apps Weather app I created. To see the current weather, users enter a location in the text box and tap the Search icon.
  • The app then displays details such as Temperature, Pressure, Dew Point, Humidity, and Last Update for that location. Users can choose between Imperial (Fahrenheit) and Metric (Celsius) units to view the temperature.
PowerApps Weather

Connect Power Apps MSN Weather

  • 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
  • Click on the MSN Weather connector and then tap the Connect button. Once you click on it, the weather connector will connect to the app. Without the MSN Weather connector, it is not possible to display the latest weather details in the app.
Weather in PowerApps
  • As you can see, I have used these controls below:
TitleControlDescription
WEATHER FORECASTLabelUsed for the App Title purpose
AUSTRALIAText inputThe user can enter the location
Search iconIconHelp you search for the weather of a specified location.
Imperial, MetricRadio buttonThe user can select according to their needs.
ImageImageThe user can display the weather pictures
TemperatureLabelView the current weather temperature of the specific location.
MOSTLY CLOUDYLabelThe weather that you feel can be viewed in this label control.
Weather PressureLabelSpecifies the weather pressure of the specific location.
Dew PointLabelShows the dew point of a specific place
HumidityView the current humidity of the particular place
Last UpdateLabelCan view the last weather update

Refer to the image below:

PowerApps Weather 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 all the latest Weather forecasts, including temperature, Pressure, Dew point, and more. Follow the below codes to get the details:

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 particular 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 particular 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

You can get even more detailed weather information using the code explained below, including the UV Index, Visibility, Wind Direction, Latitude, Longitude, and more.

Show Current and Tomorrow’s Temperature in Power Apps Page

I want to display the current as well as tomorrow’s weather conditions on a page in my app, starting with something simple, such as the current location, forecast, temperature, and UV index, among others.

Here, in the image below, I have a Power Apps Button and an HTML text input control. Whenever a user taps on the button, the current and tomorrow’s weather forecast will display on the screen.

Showing current temperature on page
  1. To workaround this, select the button (Click Here & Get Weather) and set its OnSelect property:
OnSelect = UpdateContext(
    {
        varWeatherToday: MSNWeather.TodaysForecast(
            Location.Latitude & "," & Location.Longitude,
            "Metric"
        ).responses,
        varWeatherTomorrow: MSNWeather.TomorrowsForecast(
            Location.Latitude & "," & Location.Longitude,
            "Metric"
        ).responses,
        varWeather: true
    }
)

Where,

  • varWeatherToday, varWeatherTomorrow, varWeather = Variable names
Show tomorrow temperature on Power Apps page
  1. Add an HTML Text input control and apply the code below to its HtmlText property:
HtmlText = "<h3><u>Today</u></h3>
<p><b>Location: </b>" & varWeatherToday.source.location & "</p>
<p><b>Forecast:</b><br>" & varWeatherToday.daily.day.summary & "</p>
<p><b>Temperature (Day):</b> &nbsp;&nbsp; Low: " & varWeatherToday.daily.tempLo & "&nbsp;&nbsp; High: " & varWeatherToday.daily.tempHi & "</p>
<p><b>UV Index:</b>&nbsp;&nbsp;" & varWeatherToday.daily.uv & " (" & varWeatherToday.daily.uvDesc & ")</p>
<p><b>Wind:</b>&nbsp;&nbsp;" & varWeatherToday.daily.day.windSpd & " kph (max " & varWeatherToday.daily.windMax & ") from " & varWeatherToday.daily.day.windDir & " Degrees</p>
<p><b>Conditions:</b>&nbsp;&nbsp;" & varWeatherToday.daily.day.cap & "</p>
<h3><u>Tomorrow</u></h3>
<p><b>Forecast:</b><br>" & varWeatherTomorrow.daily.day.summary & "</p>
<p><b>Temperature (Day):</b>&nbsp;&nbsp;Low: " & varWeatherTomorrow.daily.tempLo & "&nbsp;&nbsp; High: " & varWeatherTomorrow.daily.tempHi & "</p>
<p><b>UV Index:</b>&nbsp;&nbsp;" & varWeatherTomorrow.daily.uv & " (" & varWeatherTomorrow.daily.uvDesc & ")</p>
<p><b>Wind:</b>&nbsp;&nbsp;" & varWeatherTomorrow.daily.day.windSpd & " kph (max " & varWeatherTomorrow.daily.windMax & ") from " & varWeatherTomorrow.daily.day.windDir & " Degrees</p>
<p><b>Conditions:</b>&nbsp;&nbsp;" & varWeatherTomorrow.daily.day.cap & "</p>"

The above code returns the current and tomorrow’s weather forecasts, including location, temperature, wind, and other relevant details.

Show Current Temperature in Power Apps Page

CurrentWeather Vs 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 particular location, we will use the path as responses.daily.day

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

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)

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.

Also, you may like the following Power Apps articles:

In this Power Apps tutorial, we explored what Power Apps Weather is, including definitions of current weather and forecasts. We also learned how to create a Power Apps Weather app, connect it to the MSN Weather service, and use it to display weather information for today and tomorrow.

1 thought on “Create Power Apps Weather App [Current & Tomorrow’s Forecast]”

Leave a Comment

Power Apps functions free pdf

30 Power Apps Functions

This free guide walks you through the 30 most-used Power Apps functions with real business examples, exact syntax, and results you can see.

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App