Power Automate Examples




Weather Forecast

This power flow automatically posts todays weather forcast to a Micrsoft Teams group chat each morning, and only post it on weekdays (Monday to Friday). Weekends are excluded by composing an expression and using the output for a condition that checks the day of the week.

Power Automate Weather Power Automate Weather
Recurrence

The weather automation uses a "Recurrence" trigger which schedules the power flow to begin every day at 7:40am local time. The interval is set to "1", and the frequency is set to "Day".

In advanced options of the "Recurrence" trigger, I have set the "Time zone" to the local time, have left "Start time" blank, set "At these hours" to 7, and "At these minutes" to 40.

Converted time zone

I get the current date by adding the "Current time" step, then add the "Current time" dynamic content to the "Base time" field. I format the string to a "Short date patterm", select UTC time for tthe "Source time zone" and the desired local time zone in the "Destination time zone".

Get day of the week

Use the Data Operation action called "Compose" to get the day of the week by combining an Expression with Dynamic Content. Add Compose then click in the Inputs field. You will then see options to select Dynamic Contact or use an Expression. Switch to the expression option, type in dayOfWeek(body('Convert_time_zone')) and click Ok. This will get the day of the week as a number from the Converted Time Zone step above. Power Automate Weather

Condition to only continue if it's a weekday

Set an AND condition by comparing the output of the Compose we setup on the previous step. The output of the Compose will give us a number from 0 to 6. If day of the week is a Sunday then the output will be 0, Monday is 1, and so on till Saturday which is 6. Our condition will check if the Composed day of the week is above 0 and below 6 (so checking if it equals 1 to 5), and if true then to follow the Yes path. If No, then flow will end. The result will be the weather will only be posted on a weekday.

Get forecast and post to Teams

Finally we add our Get Forecast For Today step, enter the location and units. That forecast step will then unlock a large amount of Dynamic Content for you to add to your Teams group chat message. In this example, I have added Day Summary, Low and High temperatures, and Day Chance of Rain and to make it a little more fancy HTML code has been added to control the formating of the outgoing chat message.

End result:

Power Automate Weather

 



 
Copy link     Email



Ads help keep the site up. Thank you