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)

Name Path Type Description
Pressure responses.weather.current.baro float It defines the atmospheric pressure.
Conditions responses.weather.current.cap string It specifies a caption of weather conditions such as rainy, sunny, etc.
Dewpoint responses.weather.current.dewPt float It defines the temperature at which dew forms.
Apparent Temperature responses.weather.current.feels float It represents the apparent temperature or feels-like temperature.
Humidity responses.weather.current.rh float It defines the relative humidity percentage.
METAR weather conditions responses.weather.current.wx string It specifies the METAR code of weather conditions.
METAR Sky Conditions responses.weather.current.sky string It specifies the METAR code of sky conditions.
Temperature responses.weather.current.temp float It defines the current temperature.
UV Index responses.weather.current.uv float It defines the numerical UV index.
UV Index Description responses.weather.current.uvDesc string A description of the meaning of the UV index.
Visibility Distance responses.weather.current.vis float It specifies the visibility distance.
Wind Direction responses.weather.current.windDir integer It defines the wind direction in degrees clockwise from north.
Wind Speed responses.weather.current.windSpd float It defines the wind speed.
Wind Gust Speed responses.weather.current.windGust float It defines the wind gust speed.
Last Updated responses.weather.current.created date-time It specifies the datetime at which the provider created the current condition.
Latitude responses.source.coordinates.lat float It specifies the latitude of the location.
Longitude responses.source.coordinates.lon float It specifies the longitude of the location.
Location responses.source.location string It defines the location for which the provider created the current condition.
Pressure Units units.pressure string It represents the units used for pressure measurements.
Temperature Units units.temperature string It represents the units used for temperature measurements.
Speed Units units.speed string It represents the units used for speed measurements.
Distance Units units.distance string It represents the units used for distance measurements.

Table – 2: (WeatherForecast)

Name Path Type Description
Conditions responses.daily.day.cap String It specifies the weather conditions like rainy, sunny, etc.
Rain Chance responses.daily.day.precip float It defines the chance of precipitation (%).
METAR Weather Conditions responses.daily.day.wx string It defines the METAR code of weather conditions.
METAR Sky Conditions responses.daily.day.sky string It specifies the METAR code of sky conditions.
Wind Direction responses.daily.day.windDir integer It represents the wind direction in degrees clockwise from north.
Wind Speed responses.daily.day.windSpd float It describes the wind speed.
Summary responses.daily.day.summary string It specifies the text summary of the forecast.
Conditions responses.daily.night.cap string It specifies the weather conditions such as rainy, sunny, etc.
Rain Chance responses.daily.night.precip float It specifies the chance of precipitation (%).
METAR Weather Conditions responses.daily.night.wx string It defines the METAR code of weather conditions.
METAR Sky Conditions responses.daily.night.sky string It defines the METAR code of sky conditions.
Wind Direction responses.daily.night.windDir integer It specifies the wind direction in degrees clockwise from north.
Wind Speed responses.daily.night.windSpd float It defines the wind speed.
Summary responses.daily.night.summary string It specifies a text summary of the forecast.
Conditions responses.daily.pvdrCap string It specifies the weather conditions such as rainy, sunny, etc.
Date responses.daily.valid date-time It defines the datetime at which the forecast is valid.
Rain Chance responses.daily.precip float It specifies the chance of precipitation (%).
Max Wind Speed responses.daily.windMax float It defines the peak wind speed for the day.
Max Wind Direction responses.daily.windMaxDir integer It defines the direction of the peak wind for the day.
Humidity High responses.daily.rhHi float It represents the high relative humidity point for the day.
Humidity Low responses.daily.rhLo float It specifies the low relative humidity point for the day.
Temperature High responses.daily.tempHi float It defines the high temperature.
Temperature Low responses.daily.tempLo float It defines the low temperature.
UV Index responses.daily.uv float It defines the numerical UV index.
UV Index Description responses.daily.uvDesc string It defines the description of the meaning of the UV index.
Forecast Date responses.daily.created date-time It defines the DateTime at which the daily forecast was derived.
Sunrise Time responses.almanac.sunrise date-time It represents the time of sunrise on the day of this forecast.
Sunset Time responses.almanac.sunset date-time It represents the time of sunset on the day of this forecast.
Moonrise Time responses.almanac.moonrise date-time It defines the time of moonrise on the day of this forecast.
Moonset Time responses.almanac.moonset date-time It defines the time of moonset on the day of this forecast.
Moon Phase responses.almanac.moonPhase string It specifies the phase of the moon on the day of this forecast.
Moon Phase Code responses.almanac.moonPhaseCode string It defines the code representing the phase of the moon.
Latitude responses.source.coordinates.lat float It describes the latitude of the location.
Longitude responses.source.coordinates.lon float It describes the longitude of the location.
Location responses.source.location string It defines the location for which the provider created the forecast.
Pressure Units units.pressure string it defines the units used for pressure measurements.
Temperature Units units.temperature string It defines the units used for temperature measurements.
Speed Units units.speed string It defines the units used for speed measurements.
Distance Units units.distance string It defines the units used for distance measurements.

Check out, Power BI integration with PowerApps Portals

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:

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.

>