It is currently September 29th, 2024, 7:30 am

Reading and Displaying Temperature From A Web-site

General topics related to Rainmeter.
Licoricemint
Posts: 10
Joined: June 6th, 2016, 1:16 am

Reading and Displaying Temperature From A Web-site

Post by Licoricemint »

Hi,

I'm hoping this is a simple problem for someone to solve. I am trying to read a temperature off a website and then display the temperature on my screen. Here is the code I am using:

START CODE

[Rainmeter]
Update=1000

[MeasureSite]
Measure=Plugin
Plugin=WebParser
URL=https://www.wunderground.com/personal-weather-station/dashboard?ID=KWIMILWA39
RegExp=(?siU)<span class="wx-value">(.*)</span>
UpdateRate=600

[MeasureTemperature]
Measure=Plugin
Plugin=WebParser
URL=[MeasureSite]
StringIndex=1

[MeterTemperature]
Meter=String
MeasureName=MeasureTemperature
FontSize=48
FontColor=255,255,255
AntiAlias=1

END CODE

A webparserdump of the web-site gives me this line within the "txt" file

<span class="wx-value">59.9</span>

The number 59.9 is the temperature which I am trying to display. However, I cannot get it to display. If anyone can help, that would be great.

Best Regards,
Licoricemint
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Reading and Displaying Temperature From A Web-site

Post by FreeRaider »

Hello Licoricemint,

Your code looks correct, but to display the [MeterTemperature] I have added DynamicWindowSize=1 under [Rainmeter] section

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureSite]
Measure=Plugin
Plugin=WebParser
URL=https://www.wunderground.com/personal-weather-station/dashboard?ID=KWIMILWA39
RegExp=(?siU)<span class="wx-value">(.*)</span>
UpdateRate=600

[MeasureTemperature]
Measure=Plugin
Plugin=WebParser
URL=[MeasureSite]
StringIndex=1

[MeterTemperature]
Meter=String
MeasureName=MeasureTemperature
FontSize=48
FontColor=255,255,255
AntiAlias=1
I hope this helps you

:welcome:
Licoricemint
Posts: 10
Joined: June 6th, 2016, 1:16 am

Re: Reading and Displaying Temperature From A Web-site

Post by Licoricemint »

Hi FreeRaider,

That did it! Thank you!

Best Regards,
Licoricemint
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Reading and Displaying Temperature From A Web-site

Post by FreeRaider »

Glad to help