Get weather forecast report using Power Automate Daily automatically

Get Weather Forecast Using Power Automate For Today

No comments

Loading

In this “Get Weather Forecast Using Power Automate” article, we will learn how to get a daily weather summary forecast report using Power Automate flow in your email and Microsoft Teams Channel as an adaptive card.

Every morning when we start our day and work, we usually go to the news website to overview the weather forecast for the day, especially if you have a scheduled trip or are planning to travel outside on that day. In this scenario, imagine that once you start your daily work, you see that an automatic weather forecast report email in your inbox or an automatic weather forecast report adaptive card has been posted in your Microsoft Teams channel, so you don’t need to spend your time going over the weather forecast news.

If this happens automatically, how good is it? In this article, I will show how to develop a Power Automate flow to get the daily weather forecast report automatically.

Get Weather Forecast Using Power Automate: Understanding of Weather Forecast Report

In this section we will understand the concept of weather forecast report – what is it and how it works.

What is weather forecast report?

A weather forecast report is a summary of meteorological information that provides predictions and information about expected weather conditions for a specific location and time period. These reports are typically produced by meteorologists and weather forecasting agencies and are used to inform the public, businesses, government agencies, and various other organizations about what weather conditions to expect in the near future.

A typical weather forecast report includes the following elements:

  • Date and Time: The date and time for which the forecast is applicable, along with the time the report was issued.
  • Location: The specific area or region to which the forecast pertains. This can be as broad as a country or as localized as a city or even a specific geographical point.
  • Weather Conditions: Information about expected weather conditions, such as temperature, precipitation (rain, snow, sleet, etc.), cloud cover, wind speed and direction, and atmospheric pressure. This information may be presented as text descriptions and/or graphical symbols.
  • Temperature: The forecasted high and low temperatures for the period covered by the report.
  • Precipitation: Information on the likelihood and amount of precipitation, along with the type of precipitation (rain, snow, etc.) if applicable.
  • Wind: Details about wind speed and direction, which can be important for activities such as sailing, aviation, and outdoor events.
  • Humidity: Information on relative humidity levels, which can influence comfort and weather-related concerns.
  • Sunrise and Sunset Times: The times at which the sun is expected to rise and set during the forecast period.
  • Additional Information: Depending on the source and the intended audience, the report may include additional information such as weather warnings, advisories, UV index, pollen count, and air quality data.
  • Forecast Period: The duration of the forecast, which can range from short-term (a few hours) to long-term (several days or even weeks).

Weather forecast reports are typically updated regularly, with short-term forecasts (e.g., 24-48 hours) receiving more frequent updates than longer-term forecasts. They are made available through various means, including television, radio, websites, mobile apps, and social media. Government agencies, such as the National Weather Service in the United States, issue official weather advisories and warnings for severe weather events as part of their forecast reports to help ensure public safety.

These reports are invaluable for planning daily activities, making travel decisions, preparing for severe weather events, and managing a wide range of industries and sectors that are influenced by weather conditions.

How does weather forecast report work?

Weather forecast reports are generated through a combination of meteorological data collection, computer modeling, and meteorologist expertise. Here’s an overview of how the process works:

  • Data Collection: Meteorological data is collected from various sources, including weather stations, satellites, radar systems, weather balloons, buoys, and more. These instruments measure parameters such as temperature, humidity, wind speed and direction, atmospheric pressure, and precipitation.
  • Data Analysis: Meteorologists collect and analyze the data from various sources to understand the current state of the atmosphere. This includes creating weather maps and charts that show the distribution of weather variables.
  • Computer Modeling: Meteorologists use sophisticated computer models to simulate the behavior of the atmosphere. These models take into account the initial conditions of the atmosphere (the data collected in step 2) and then project how the weather is likely to change over time. Numerical weather prediction models, such as the Global Forecast System (GFS) and the European Centre for Medium-Range Weather Forecasts (ECMWF) model, are widely used for this purpose.
  • Model Output Interpretation: Meteorologists interpret the output of these computer models, taking into account their knowledge of local geography and weather patterns. They make adjustments and corrections to the model’s predictions based on their expertise and understanding of the specific region they are forecasting for.
  • Forecast Creation: Meteorologists create a weather forecast report that includes information about expected conditions, such as temperature, precipitation, wind, and atmospheric pressure, over a specified time period. This report is typically generated for different time intervals (e.g., hourly, daily, or weekly forecasts) and may cover various geographical scales, from local to global.
  • Dissemination: Weather forecasts are disseminated to the public through various means, including television, radio, websites, mobile apps, and social media. Additionally, government agencies, such as the National Weather Service in the United States, issue official weather advisories and warnings to ensure public safety in the event of severe weather events.
  • Continuous Monitoring and Updates: Weather conditions can change rapidly, so meteorologists continuously monitor the atmosphere and update forecasts as needed. Short-term forecasts may be updated frequently, while longer-term forecasts may be adjusted less frequently.
  • Verification: After the forecasted period has passed, meteorologists assess the accuracy of their predictions. This helps improve forecast models and the forecasting process over time.

It’s important to note that weather forecasts become less accurate the further into the future they extend. Short-term forecasts (1-3 days) are generally more reliable than long-term forecasts (beyond 5-7 days) due to the chaotic nature of the atmosphere and the limitations of modeling and data availability. However, advances in technology and modeling techniques have led to significant improvements in forecast accuracy over the years.

Get Forecast For Today: Get Daily Weather Forecast Report Using Power Automate Flow

Let’s start with the Power Automate flow development, step by step.

Step : Create a Test scheduled cloud Power Automate Flow

Create a scheduled cloud flow to get a forecast for today.

Enter interval as “1” and frequency as “day”—these  two are mandatory parameters.

Then, select your time zone and start time. This configuration ensures that your daily weather report flow will run once every day at the predefined time.

Note:

  • You can configure your start time at any time for the day, but it is recommended to schedule your flow in the morning before your working hours start so that you can see the weather report once you login to work.
scheduled cloud flow recurrence configuration
scheduled cloud flow recurrence configuration

Step: Create a string-type variable in Power Automate to store your country’s time zone.

Create a string-type variable (initialize variable) in Power Automate to store your country’s time zone.

Pass your time zone value.

Create a string type variable in Power Automate to store your country's time zone
Create a string type variable in Power Automate to store your country’s time zone

Get your country’s time zone from here – Default Time Zones.

Step: Create a string type variable in Power Automate to store your location

Enter you location. The valid inputs are City, Region, State, Country, Landmark, Postal Code, latitude and longitude.

Create a string type variable in Power Automate to store your location
Create a string type variable in Power Automate to store your location

Step: Add MSN Weather – Get forecast for today action

Add an “Get forecast for today” action from the “MSN Weather” section.

Add MSN Weather - Get forecast for today action
Add MSN Weather – Get forecast for today action

Then configure the below parameters for the “Get forecast for today” action:

  • Location: Select Location from the dynamic content tab ‘Your Location Variable’.
  • Units: Select imperial for Fahrenheit (°F) or metric for degrees Celsius (°C).

Add MSN Weather - Get forecast for today action configuration

Add MSN Weather – Get forecast for today action configuration

Step: Add the Send an email (V2) action to send the weather report email.

Add a “Send an email (V2) or Send an email (V3)” action based on which action works for you to send the weather report, then configure the below parameters in your “Send and email” action:

  • To: Your email ID or group email ID for the larger audiences
  • Subject: Your subject; just copy and paste the below:

Subject:

Today's (@{formatDateTime(utcNow(), 'yyyy/MM/dd')}) weather forecast summary report for your location: @{outputs('Get_forecast_for_today')?['body/responses/source/location']}

Add Send an email (V2) action to send the weather report email

Add Send an email (V2) action to send the weather report email

And for the email body configuration, switch to code view mode, then copy and paste the below text:

Power Automate Send an Email Code View
Power Automate Send an Email Code View

Email Body Configuration:

<p><span style="font-size: 15px; font-family:Helvetica;color: rgb(44,130,201)"><strong>Hi Team, Here is your daily weather forecast summary report for today: @{formatDateTime(utcNow(), 'yyyy/MM/dd')}:</strong></span></p>
<span style="font-size: 12px; font-family:Helvetica">
<ul>
<li>Location: @{outputs('Get_forecast_for_today')?['body/responses/source/location']}</li>
<li>Temp (Low - High): @{outputs('Get_forecast_for_today')?['body/responses/daily/tempLo']}-@{outputs('Get_forecast_for_today')?['body/responses/daily/tempHi']} @{outputs('Get_forecast_for_today')?['body/units/temperature']}</li>
<li>Sunrise/set: @{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')['body/responses/almanac/sunrise'], 'UTC', variables('varStrYourTimeZone')), 'HH:mm')}/@{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')['body/responses/almanac/sunset'], 'UTC', variables('varStrYourTimeZone')), 'HH:mm')}</li>
<li>UV Index: @{outputs('Get_forecast_for_today')?['body/responses/daily/uv']} (@{outputs('Get_forecast_for_today')?['body/responses/daily/uvDesc']})
<h4>☀️ Day</h4>
<ul>
<li>@{outputs('Get_forecast_for_today')?['body/responses/daily/day/summary']}</li>
<li>@{outputs('Get_forecast_for_today')?['body/responses/daily/day/precip']}% chance rain</li>
<li>Wind: @{outputs('Get_forecast_for_today')?['body/responses/daily/day/windSpd']} @{outputs('Get_forecast_for_today')?['body/units/speed']} in @{createArray('Northerly', 'North Easterly', 'Easterly', 'South Easterly', 'Southerly', 'South Westerly', 'Westerly', 'North Westerly', 'Northerly')[sub(int(formatNumber(div(add(22.5, outputs('Get_forecast_for_today')?['body/responses/daily/night/windSpd']), 45), '#0')), 1)]} direction</li>
<li>Humidity: @{outputs('Get_forecast_for_today')?['body/responses/daily/rhLo']}-@{outputs('Get_forecast_for_today')?['body/responses/daily/rhHi']}% </li>
</ul>
</li>
<h4>⭐ Night</h4>
<ul>
<li>@{outputs('Get_forecast_for_today')?['body/responses/daily/night/summary']}</li>
<li>@{outputs('Get_forecast_for_today')?['body/responses/daily/night/precip']}% chance rain</li>
<li>Wind: @{outputs('Get_forecast_for_today')?['body/responses/daily/night/windSpd']} @{outputs('Get_forecast_for_today')?['body/units/speed']} in @{createArray('Northerly', 'North Easterly', 'Easterly', 'South Easterly', 'Southerly', 'South Westerly', 'Westerly', 'North Westerly', 'Northerly')[sub(int(formatNumber(div(add(22.5, outputs('Get_forecast_for_today')?['body/responses/daily/night/windSpd']), 45), '#0')), 1)]} direction</li>
</ul>
</li>
<h4>🌙 Moon </h4>
<ul>
<li>@{outputs('Get_forecast_for_today')?['body/responses/almanac/moonPhase']}</li>
<li>Moonrise/set: @{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')?['body/responses/almanac/moonrise'], 'UTC', variables('varStrYourTimeZone')), 'HH:mm')}/@{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')?['body/responses/almanac/moonset'], 'UTC', 'GMT Standard Time'), 'HH:mm')}</li>
</ul>

</li>
</ul>
</span>
<span style="font-size: 12px; font-family:Helvetica; font-style: italic">
</i>Your daily forecast data was derived at @{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')['body/responses/daily/created'], 'UTC', variables('varStrYourTimeZone')), 'dd/MM/yyyy HH:mm')}</i>
</span>

Step: Add Post card in a chat or channel to get daily weather report

Add a “Post card in a chat or channel” Microsoft Teams action and configure the below parameters to post the weather report adaptive card using Power Automate:

Post as: Flow bot, options are available in the Post as, as below:

  • User
  • Flow bot
  • Power Virtual Agents (preview)
  • Power Apps (Preview)
  • Enter custom value

Post in: Channel, options are available in the Post in, as below:

  • Channel
  • Chat with Flow bot
  • Group chat
  • Enter custom value
Add Post card in a chat or channel to get daily weather report
Add Post card in a chat or channel to get daily weather report
  • Team: Select your team from the available teams you have access to where you want to post this adaptive card.
  • Channel: Select your channel from the available channels you have access to where you want to post this adaptive card.
  • Adaptive Card: Use the below Adaptive Card JSON for your today’s weather forecast report (just copy and paste):
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "Hi Team: Today's (@{formatDateTime(utcNow(), 'yyyy/MM/dd')}) weather forecast summary report for your location: @{outputs('Get_forecast_for_today')?['body/responses/source/location']}",
"size": "large",
"isSubtle": true,
"wrap": true,
"style": "heading"
},
{
"type": "TextBlock",
"text": " - Temp (Low - High): @{outputs('Get_forecast_for_today')?['body/responses/daily/tempLo']}-@{outputs('Get_forecast_for_today')?['body/responses/daily/tempHi']} @{outputs('Get_forecast_for_today')?['body/units/temperature']} \n- Sunrise/set: @{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')['body/responses/almanac/sunrise'], 'UTC', variables('varStrYourTimeZone')), 'HH:mm')}/@{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')['body/responses/almanac/sunset'], 'UTC', variables('varStrYourTimeZone')), 'HH:mm')} \n- UV Index: @{outputs('Get_forecast_for_today')?['body/responses/daily/uv']} (@{outputs('Get_forecast_for_today')?['body/responses/daily/uvDesc']})",
"size": "default",
"wrap": true
},

{
"type": "TextBlock",
"text": " ☀️ Day",
"size": "large",
"isSubtle": true,
"wrap": true,
"weight": "Bolder",
"style": "bold",
"id": "TitleDay"
},
{
"type": "TextBlock",
"text": "- Day Summary: @{outputs('Get_forecast_for_today')?['body/responses/daily/day/summary']} \n- @{outputs('Get_forecast_for_today')?['body/responses/daily/day/precip']}% chance rain \n- Wind: @{outputs('Get_forecast_for_today')?['body/responses/daily/day/windSpd']} @{outputs('Get_forecast_for_today')?['body/units/speed']} in @{createArray('Northerly', 'North Easterly', 'Easterly', 'South Easterly', 'Southerly', 'South Westerly', 'Westerly', 'North Westerly', 'Northerly')[sub(int(formatNumber(div(add(22.5, outputs('Get_forecast_for_today')?['body/responses/daily/night/windSpd']), 45), '#0')), 1)]} direction \n- @{outputs('Get_forecast_for_today')?['body/responses/daily/rhLo']}-@{outputs('Get_forecast_for_today')?['body/responses/daily/rhHi']}% ",
"size": "default",
"wrap": true,
"id": "BodyDay"
},
{
"type": "TextBlock",
"text": "⭐ Night",
"size": "large",
"isSubtle": true,
"wrap": true,
"weight": "Bolder",
"style": "bold",
"id": "TitleNight"
},
{
"type": "TextBlock",
"text": "- Night Summary: @{outputs('Get_forecast_for_today')?['body/responses/daily/night/summary']}\n- @{outputs('Get_forecast_for_today')?['body/responses/daily/night/precip']}% chance rain \n- Wind: @{outputs('Get_forecast_for_today')?['body/responses/daily/night/windSpd']} @{outputs('Get_forecast_for_today')?['body/units/speed']} in @{createArray('Northerly', 'North Easterly', 'Easterly', 'South Easterly', 'Southerly', 'South Westerly', 'Westerly', 'North Westerly', 'Northerly')[sub(int(formatNumber(div(add(22.5, outputs('Get_forecast_for_today')?['body/responses/daily/night/windSpd']), 45), '#0')), 1)]} direction",
"size": "default",
"wrap": true,
"id": "BodyNight"
},
{
"type": "TextBlock",
"text": "🌙 Moon",
"size": "large",
"isSubtle": true,
"wrap": true,
"weight": "Bolder",
"style": "bold",
"id": "TitleMoon"
},
{
"type": "TextBlock",
"text": "- Moon Phase: @{outputs('Get_forecast_for_today')?['body/responses/almanac/moonPhase']} \n- Moonrise/set: : @{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')?['body/responses/almanac/moonrise'], 'UTC', variables('varStrYourTimeZone')), 'HH:mm')}/@{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')?['body/responses/almanac/moonset'], 'UTC', 'GMT Standard Time'), 'HH:mm')}",
"size": "default",
"wrap": true,
"id": "BodyMoon"
},
{
"type": "TextBlock",
"text": "Your daily forecast data was derived at @{formatDateTime(convertTimeZone(outputs('Get_forecast_for_today')['body/responses/daily/created'], 'UTC', variables('varStrYourTimeZone')), 'dd/MM/yyyy HH:mm')}",
"size": "default",
"wrap": true,
"id": "ForecastDataDerivedDateTime",
"style": "font-size: 12px; font-family:Helvetica; font-style: italic"
}

]
}

 

Note:

  • If you want to copy and paste all the action configurations used in this weather forecast report, you must have the same name for each action; otherwise, it will not work. You then need to configure these manually by yourself.
  • In the above send an email (V2) and “Post card in a chat or channel” action, we have used the Power Automate createArray function.

Demo: Weather Forecast Report using Power Automate

Though it is a scheduler-type flow, let’s run this flow manually to get the daily forecast report, and let’s see what happens.

Get Daily Weather Forecast Report Flow - Your flow ran successfully
Get Daily Weather Forecast Report Flow – Your flow ran successfully

Once the flow runs successfully, we can see that the weather forecast report email has arrived in my Outlook inbox.

Get Weather Forecast Using Power Automate For Today - Demo Automated Email
Get Weather Forecast Using Power Automate For Today – Demo Automated Email

Then, we can see an adaptive card has been posted in my General Teams channel.

Get Weather Forecast Using Power Automate For Today - Demo Automated Adaptive Card Posted Teams Channel
Get Weather Forecast Using Power Automate For Today – Demo Automated Adaptive Card Posted Teams Channel

Note:

Summary: Get Weather Forecast Using Power Automate Flow

Thus, in this article, we have learned about how to get a weather summary forecast report using Power Automate flow automatically in email and the Microsoft Teams channel as an adaptive card post on a daily basis. Here I have used the scheduler cloud-type flow to run it automatically based on the scheduled time.

See Also: Power Platform Articles

You may also visit the Power Platform article hub, where you will see a bunch of articles focusing on Power Platform, like Power Automate, Power Apps, etc. All the articles are written with real-time project scenarios and troubleshooting techniques.

 

If you found this article helpful and enjoyed it, please consider sharing it with your friends and colleagues. Please don’t forget to subscribe to our site to receive our latest articles directly in your inbox. 🙂

 

About Post Author

Do you have a better solution or question on this topic? Please leave a comment