cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Marty_Dub
Helper II
Helper II

Showing current temperature on page

Hi team,

I'm wanting to return current weather conditions to a page on my app, starting simple such as the current temperature.

 

I have found the free MSN Weather connector, however this appears to require manual entry of a location to return weather details. I'm wondering if anyone has any ideas how I would be able to use the inbuilt location functions of PowerApps to have the MSN weather connector return the temperature at the location of where the user device is?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Marty_Dub ,

I can give you what a use for the weather today and tomorrow at a location - first set a Variable (after connecting MSN Weather

UpdateContext(
   {
      varWeatherToday: MSNWeather.TodaysForecast(
         Location.Latitude & "," & Location.Longitude,
         "Metric"
      ).responses,
      varWeatherTomorrow: MSNWeather.TomorrowsForecast(
         Location.Latitude & "," & Location.Longitude,
         "Metric"
      ).responses,
      varWeather:true
   }
)

then a HTML box

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

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @Marty_Dub ,

I can give you what a use for the weather today and tomorrow at a location - first set a Variable (after connecting MSN Weather

UpdateContext(
   {
      varWeatherToday: MSNWeather.TodaysForecast(
         Location.Latitude & "," & Location.Longitude,
         "Metric"
      ).responses,
      varWeatherTomorrow: MSNWeather.TomorrowsForecast(
         Location.Latitude & "," & Location.Longitude,
         "Metric"
      ).responses,
      varWeather:true
   }
)

then a HTML box

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

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Thankyou @WarrenBelz - that worked perfectly.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,011)