Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Get Weather Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
MrGibbage
Super User
Super User
Avatar

Joined: October 23 2006
Location: United States
Online Status: Offline
Posts: 513
Posted: November 03 2012 at 09:02 | IP Logged Quote MrGibbage

Dave, have you ever considered making weather an "internal" part of PH? I
envision setup options to set the location and weather service, and a
collection of ph formulas that return different aspects of the current weather
and forecast. Maybe once an hour ph polls the weather service to get the
latest current conditions/forecast. Might be something that would be really
cool for an upcoming release. Just a thought.

__________________
Skip
Back to Top View MrGibbage's Profile Search for other posts by MrGibbage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: November 24 2012 at 06:27 | IP Logged Quote krommetje

dhoward wrote:
Peter,

Just wanted to see if you wanted to try something new.
...
Dave.


I am getting this:


***PLUGIN INVALID***
PowerHome Plugin ID: URLSCRAPER
Plugin failed during initialization.


What now Dave?
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: November 24 2012 at 12:00 | IP Logged Quote krommetje

Wait a minute, got the plugin working but waether2 does not fire... weather1 fires ok....

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 26 2012 at 14:15 | IP Logged Quote dhoward

Peter,

Glad to hear you got the plugin working and weather1 trigger is firing. I suspect the weather2 trigger is having a problem because the regexsearch may not be matching. If the regex search does not match (and hence doesnt return data), then the trigger won't fire. It may be best to split the regex searches into their own separate searches (and therefore separate triggers) so a problem with one aspect of the search doesnt affect the other searches.

The original regex I gave you for trigger 2 was:

[URL_1_2]
regexsearch=<label>Pressure:</label>[\s\S]*?<b>(.+)</b>[\s\S]*?<label>Windchill:</label>[\s\S]*?<span>(.+)</span>[\s\S]*?<label>Humidity:</label>[\s\S]*?<div class="b">(.+)</div>[\s\S]*?<label>Visibility:</label>[\s\S]*?<span>(.+)</span>

You could change this to:

[URL_1_2]
regexsearch=<label>Pressure:</label>[\s\S]*?<b>(.+)</b>

[URL_1_3]
regexsearch=<label>Windchill:</label>[\s\S]*?<span>(.+)</span>

[URL_1_4]
regexsearch=<label>Humidity:</label>[\s\S]*?<div class="b">(.+)</div>

[URL_1_5]
regexsearch=<label>Visibility:</label>[\s\S]*?<span>(.+)</span>

Of course, you would have to adjust a couple of other parms in the INI file to allow for 5 triggers (instead of 2). This way, if weatherunderground makes a change and is not reporting the windchill at that particular time or they change the structure so that it doesnt exactly match the original regex, you'll at least get the components that match.

Hope this helps,

Dave.

Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: November 28 2012 at 01:08 | IP Logged Quote krommetje

So the scrapecount has to be adjusted to 5 and for each Regexmatch the value will be in LOCAL1? Command1 through 5 and option1 through 5 is that correct? Thus there will be 5 seperate macros ...

Perhaps we can publish this in the repository when it is finished....

Keepya posted...

Edited by krommetje - November 28 2012 at 01:11
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: November 28 2012 at 02:14 | IP Logged Quote krommetje

Nope, no dice

Only temperature, conditiion, windspeed and wind direction are matched...

Still weather1 is the only one that fires
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 28 2012 at 10:57 | IP Logged Quote dhoward

Peter,

You're close. All the triggers should Command 1, options 1 thru 5. It should match the INI settings. [URL_1_4] equates to Command1, Option 4. If you had multiple URLs (we've only got one but you can add more by duplicating the appropriate sections and adjusting the URL count), you would have Commands above 1.

Give that a try and let me know.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: December 02 2012 at 09:24 | IP Logged Quote krommetje

so far it works now, it has been working now for a few days and no problems detected up until now....

I'll keep you posted....

Peter
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: December 05 2012 at 03:26 | IP Logged Quote krommetje

Hey Dave

the time declared in the ini FREQ=0.5? what is the value? minutes/seconds/hours?
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: December 05 2012 at 10:05 | IP Logged Quote dhoward

Freq is in minutes so 0.5 should be every 30 seconds.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: January 13 2013 at 00:25 | IP Logged Quote krommetje

Stopped sworking again...
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
krommetje
Super User
Super User
Avatar

Joined: December 29 2004
Location: Netherlands
Online Status: Offline
Posts: 695
Posted: January 20 2013 at 06:18 | IP Logged Quote krommetje

Dave?

all of A sudden the weather plugin is invalid....
the eventlog says:

An error occurred while calling function PHPI_InitData for Plugin: WEATHER. The return code is: 1.

I have given the INI another name and reentered the pluging data in the explorer, I reregistered ph_URLScraper.ocx with regsvr32.... all attempts fail....

Edited by krommetje - January 20 2013 at 07:05
Back to Top View krommetje's Profile Search for other posts by krommetje Visit krommetje's Homepage
 
syonker
Senior Member
Senior Member
Avatar

Joined: March 06 2009
Location: United States
Online Status: Offline
Posts: 212
Posted: August 04 2014 at 12:43 | IP Logged Quote syonker

Hi Gang!

As you may have noticed, Weather Underground's mobile
site (notably used for this particular macro every
time
) is lacking in one key piece of information if
you happen to be designing an irrigation algorithm.

Namely: Precipitation

Does anyone have any recommendations on the best way to
approach that? I need to take a daily precipitation
figure into consideration when raising my "saturation
point by zone" and know "today's precipitation
accumulation" is critical to that number.

I am considering using a local weather station on Weather
Underground and parsing that (it's an enormous block
of HTML though
) since the content is so rich. The
station is a block away and part of a large school system
so I am thinking it will be a relatively permanent
(a.k.a., "reliable") installation.

...but if anyone had any other suggestions, my ears are
certainly open.

-S

Edited by syonker - August 04 2014 at 12:45


__________________
"I will consider myself having succeeded when my house becomes sentient and attempts to kill me."

><(((º>`·.¸¸.·´¯`·.¸><(((º>¸.

·´¯`·.¸. , . ><(((º>`·.¸¸.·´¯`·.¸><(((º>
Back to Top View syonker's Profile Search for other posts by syonker Visit syonker's Homepage
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: August 04 2014 at 20:31 | IP Logged Quote dhoward

S,

Only thing I can think of is that you must use a URL that returns the information that you want. If a local wunderground station has that info (and they remain consistent with their format...you don't want to constantly be editing your regex statements), then I would just use that.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
lizaoreo
Groupie
Groupie


Joined: February 11 2013
Location: United States
Online Status: Offline
Posts: 75
Posted: September 23 2014 at 13:30 | IP Logged Quote lizaoreo

I actually signed up for the Weather Underground API and used the API to get what I want. You are limited in the number of calls and stuff, but I have my script that gathers weather data poll the API every 5 minutes and storing the data in a MySQL database, so I don't have minute by minute data, but it's good enough for me until I eventually make my own weather station :) With the 5 minute polling, I still have plenty of calls leftover for randomly testing stuff out.
Back to Top View lizaoreo's Profile Search for other posts by lizaoreo
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 10 2014 at 16:26 | IP Logged Quote GadgetGuy

Dave- trying mightly to get the URL Scraper Plugin working.

Trying to determine if my home alarm status is armed, or disarmed.

The HTML looks like this...
Code:
..... </TD><TD BGCOLOR=#000000><SPAN TITLE="CLOSED: ">28</SPAN></TD><TD BGCOLOR=#000000><SPAN TITLE="CLOSED: ">29</SPAN></TD><TD BGCOLOR=#000000><SPAN TITLE="CLOSED: ">30</SPAN></TD><TD BGCOLOR=#000000><SPAN TITLE="CLOSED: ">31</SPAN></TD><TD BGCOLOR=#000000><SPAN TITLE="CLOSED: ">32</SPAN></TD></TR></TABLE>< /TD><TD VALIGN=TOP><H2>System Status</H2><TABLE BORDER=1> <TR><TD>System</TD><TD BGCOLOR="LIME">Ready </TD><TD > </TD><TD WIDTH=200px><P><FORM ACTION=2 METHOD=GET><INPUT TYPE=HIDDEN NAME=A VALUE=3>        & nbsp;         & nbsp;      <INPUT TYPE=SUBMIT VALUE=ARM><input type=hidden name=p value=1><SPAN CLASS=LITTLE>USER CODE</SPAN><INPUT TYPE=PASSWORD MAXLENGTH=6 SIZE=6 NAME=X></FORM></P></TD></TR>  ;  </TABLE></TD></TR><TR>& lt;TD CLASS=SP COLSPAN=2></TD></TR><TR><TH COLSPAN=2>Security Settings</TH></TR><T

where I am looking for a "Ready" (Alternatively the color may be RED followed by "Armed".

I just want to tell the difference.

My URL Scrape code is...
Code:
[config]
urlcount=1

[URL_1]
url=http://user:user@192.168.1.81/
freq=0.5
scrapecount=2

[URL_1_1]
regexsearch=<TD BGCOLOR="LIME"(.+) </TD>
regexoccur=1
regexflags=0

[URL_1_2]
regexsearch=<TD BGCOLOR="RED"(.+) </TD
regexoccur=1
regexflags=0 >

but I am getting no Triggers.

Any pointers on how to get a Trigger.

Actually if I can just get a success on the color "Red" that is all I need. I don't need anything returned except a successful match, or not. I don't need any string data returned.



Edited by GadgetGuy - November 10 2014 at 16:42


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 10 2014 at 16:35 | IP Logged Quote GadgetGuy

Did a re-Init and apparently the URL Scrapper started for the first time but it threw an error of -2.

What are the error code meanings?

__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: November 10 2014 at 21:16 | IP Logged Quote dhoward

Ken,

Can you post the text of the error message? There are several sections of code where an error can occur and I'll need to know the text to know which section to check.

Thanks,

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 11 2014 at 06:30 | IP Logged Quote GadgetGuy



__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 
GadgetGuy
Super User
Super User
Avatar

Joined: June 01 2008
Location: United States
Online Status: Offline
Posts: 942
Posted: November 11 2014 at 06:36 | IP Logged Quote GadgetGuy

Dave-

This URL Scraper PlugIn is awesome, but I must say the extraordinary capability creates a bit of a learning curve wall.

Can you suggest a good way to debug what "results" are achieved with a search. In PH one could just set a LOCAL to the results of a search and ph_msgbox() it to see what happened.

With the Scraper, one has no clue what is happening when a Trigger doesn't fire, thus making it difficult to debug.

Is the only way to get output to see, to write a small VB pgm to print out the search results, or is there an easier way?


__________________
Ken B - Live every day like it's your last. Eventually, you'll get it right!
Back to Top View GadgetGuy's Profile Search for other posts by GadgetGuy
 

<< Prev Page of 3 Next >>
  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum