Getting weather data from Weather Display

Posted on
Tue Feb 09, 2010 10:37 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

jimM wrote:
Do you think it could be configured either at the WD end (via POST) or in Indigo as I'm sure users would have many different reasons as I for wanting different intervals. Also, just for my own info, WD does a lot of posting to other websites both through file transfer and through a URL which the user actually selects some parameters as well as the timing, so could the plugin be like a "listener" that once active, just listens for posts from WD to a port (tcp or otherwise) then sets and or creates/sets the variable? or am I way off base here.


That's exactly how the LWC plugin works. It's just a URL in IWS that receives a POST or GET, takes the values from the HTTP request, and populates Indigo variables with the value. So no polling because it's passive until something else (LWC, WD, etc) hits the URL with data. If WD's generic POST/GET mechanism can be set up to post once a minute, then that's great.

I don't believe I made it completely general (like the AppleScript for instance - to autocreate variables), but a bit of work could probably do something like that. That plugin, in fact, could be made into a general purpose POST/GET catcher - anything posted to the plugin could get autopopulated - although I think I'd rather have only specific values inserted rather than random values updated.

BTW, since IWS plugins are really just Python code, anyone can write them - and any of the plugins you download will have the source clearly visible/editable (including LWC) so it doesn't take us doing anything - rename and update the LWC plugin as you (or anyone else) sees fit.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Feb 09, 2010 11:14 am
jimM offline
Posts: 68
Joined: Jun 16, 2008
Location: Atlantic Canada

Re: Getting weather data from Weather Display

I downloaded the plugin. If I edited it, would it be just the reqhandler to localize to WD and save? I would like to offer to test it with WD if the developer offers a solution. Looks like just changing the param = "LWC_" , the llogmessage = "LWC ... and the self._log method, EDIT - &change the folder name (port) to WD and the url from the sender to the new port, and save? It can't be that easy? :) Then I would resubmit it to you for review if that is acceptable?

Posted on
Tue Feb 09, 2010 11:35 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

jimM wrote:
I downloaded the plugin. If I edited it, would it be just the reqhandler to localize to WD and save? I would like to offer to test it with WD if the developer offers a solution. Looks like just changing the param = "LWC_" , the llogmessage = "LWC ... and the self._log method, and save? It can't be that easy? :) Then I would resubmit it to you for review if that is acceptable?


LOL - it's been a really long time (>1 week) so I had to go refresh my memory. Apparently, I did make it quite generic. Pretty much any post/get that comes into the plugin will result in a new variable created with "LWC_" prepended to the name or if it exists the value updated. I did it this way so that I could easily add more values as LWC introduces them without having to rev the plugin.

So, yes, I'd change lines 13, 39, 56, and 61 in reqhandler.py. Everything else should just work, and those lines are only changing strings. Be sure to rename the folder from lwc to something else (no need to mess with ports - from IWS perspective it's just another document in the tree). So, if you named the plugin folder "wd", then your url would be:

Code: Select all
http://host:port/wd/importData?...


same host:port as you use to connect to IWS to begin with.

Once you're satisfied it works, then package it up just like the LWC zip file that you downloaded and submit it to the library for anyone to use - it'll be a very welcome addition. This type of mechanism is a wonderful way of getting data into Indigo - no scripts or anything else to muck about with - just install the plugin. The rest is left up to configuring the other end.

If you check out the ReadMe that comes with the LWC plugin, you'll see an example of what a GET would look like. Cherrypy makes it so that it will work for either GET parameters OR POST parameters with no code change.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Feb 09, 2010 11:40 am
jimM offline
Posts: 68
Joined: Jun 16, 2008
Location: Atlantic Canada

Re: Getting weather data from Weather Display

Jay, got it. Wow.

Ok, I will go on over to the WD forum and see what might be done to get the url sent out with selected parms. I am metric so I think this will be a great test experience, as I believe WD can send out in the user's internal settings on all the data from seeing the Weather Underground and other urls.
EDIT - lol, just for my own sleep enhancement , IWS is Indigo Web Server right?
Talk soon.
Jim

Posted on
Tue Feb 09, 2010 11:55 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

jimM wrote:
IWS is Indigo Web Server right?


Exactly.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Feb 09, 2010 12:43 pm
jimM offline
Posts: 68
Joined: Jun 16, 2008
Location: Atlantic Canada

Re: Getting weather data from Weather Display

host:port - 127.0.0.1:8176? (I am getting auth failures)

EDIT - scratch that. I don't think I need the user id and pass, but the host and port should be localhost or 127.0.0.1 and port - 8176 right? (if default port is selected)

Posted on
Tue Feb 09, 2010 12:52 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

jimM wrote:
host:port - 127.0.0.1:8176? (I am getting auth failures)


Post the relevant Event Log entries (and, if you're trying it from Safari, what Safari says). Try this URL in Safari:

Code: Select all
http://127.0.0.1:8176/lwc/importData?&stuff=fun


If it works, Safari will show "OK" and the variable will be created. Note, you'll get an error in the log that looks like this:

Error variable "LWC_stuff" not in database -- adding

But that's OK - we really should make that information rather than an error.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Feb 09, 2010 1:16 pm
artpics offline
Posts: 232
Joined: Feb 24, 2009
Location: Calabasas CA

Re: Getting weather data from Weather Display

jimM wrote:
Jay, got it. Wow.

Ok, I will go on over to the WD forum and see what might be done to get the url sent out with selected parms. I am metric so I think this will be a great test experience, as I believe WD can send out in the user's internal settings on all the data from seeing the Weather Underground and other urls.
EDIT - lol, just for my own sleep enhancement , IWS is Indigo Web Server right?
Talk soon.
Jim


i have made a post on WD "windy" the programer is going to install the get post url into the mac version soon. :D

Posted on
Tue Feb 09, 2010 1:25 pm
jimM offline
Posts: 68
Joined: Jun 16, 2008
Location: Atlantic Canada

Re: Getting weather data from Weather Display

jay wrote:
jimM wrote:
host:port - 127.0.0.1:8176? (I am getting auth failures)


Post the relevant Event Log entries (and, if you're trying it from Safari, what Safari says). Try this URL in Safari:

Code: Select all
http://127.0.0.1:8176/lwc/importData?&stuff=fun


If it works, Safari will show "OK" and the variable will be created. Note, you'll get an error in the log that looks like this:

Error variable "LWC_stuff" not in database -- adding

]But that's OK - we really should make that information rather than an error.

Code: Select all
 2010-02-09 3:13:03 PM
  WebServer          undefined page requested "http://localhost:8176/wd/importData" from 127.0.0.1

2010-02-09 3:19:49 PM
  WebServer          undefined page requested "http://127.0.0.1:8176/wd/importData" from 127.0.0.1


That's all I get. Checked the default port is selected 8176. (Safari 4.04) I changed the namee of the folder to wd, and edited all the lines as directed, using WD.

Posted on
Tue Feb 09, 2010 1:57 pm
jimM offline
Posts: 68
Joined: Jun 16, 2008
Location: Atlantic Canada

Re: Getting weather data from Weather Display

I figured it out. If I do all the changes and rename the folder to wd and place it in plugins, it won't work. BUT if I rename the folder back to lwc, everything works fine. Is there something hard coded in Indigo about the lwc folder?

EDIT - this HAD to be a finder issue. After renaming back to wd, deleting the vars and restarting the server again, everything worked! added 4 more vars just for good measure.

I am going to put it on another mac here and run the url test again but as it now stands we do have a working plugin!

:)

Posted on
Tue Feb 09, 2010 2:10 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Getting weather data from Weather Display

Excellent. Now to get it added to WD and you're good to go.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Feb 09, 2010 8:04 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Getting weather data from Weather Display

jimM wrote:
I figured it out. If I do all the changes and rename the folder to wd and place it in plugins, it won't work. BUT if I rename the folder back to lwc, everything works fine. Is there something hard coded in Indigo about the lwc folder?

You might just need to tell the IndigoWebServer to restart. You can do that without restarting Indigo by requesting this URL from IWS::

http://127.0.0.1:8176/indigocommand?name=restart

That URL will probably return an error because it restarts the Web server, but you can watch the Indigo Event Log window to see if it worked. It can take a few seconds for it to shutdown before it restarts.

Image

Posted on
Sat Mar 06, 2010 4:27 pm
jimM offline
Posts: 68
Joined: Jun 16, 2008
Location: Atlantic Canada

Re: Getting weather data from Weather Display

Hi all, I know it's been a while. Just wanted to give a progress report.

The Indigo-Weather Display Mac plugin is complete and ready for prime time! :) . Also the Weather Display developer (Brian Hamilton) has added the feature to WD Mac and it has been running smoothly here for a few days now on one minute updates. During the initial testing not only was the Indigo-Weather Display plugin able to accept WD data locally, but testing on the feature allowed regular updates to the variable on my server from the test site in NewZealand (Nova Scotia to NZ - 9500 miles) with just a change in the url and the Indigo server accepted it using it's built in authorization.

The plugin will allow the user to select any of the more than 2,000 data points/fields in Weather Display and communicate them to Indigo variables live , either running on the same machine or remotely (across the LAN or WAN) to another Indigo equipped server, at intervals ranging from one minute, to 5 10, 15, 60 minute cycles, or at custom times selected by the user. Again any field from temp, to rain, to records, to FWI to days since last rain/rain this week/solar percent (using your solar sensor to tell if it's cloudy or sunny for drapery controls or if it's really dusk versus timed dusk in cloudy weather) right on down the line, can be added to customize the environmental data required to trigger events with Indigo. I tested with 15 data points at a time so there is lots of room for multiple parameters (both real time and historical data) to be monitored so it is very flexible and open to customization.

Will get the plugin polished up in the next day or so and submit for your approval and posting.

All the best
Jim

Posted on
Sat Mar 06, 2010 8:30 pm
artpics offline
Posts: 232
Joined: Feb 24, 2009
Location: Calabasas CA

Re: Getting weather data from Weather Display

Thanks Jim,

And brian for writing the code into WD indigo now has it's own tab :D
also since this thread was started WD has quite a few improvement it now runs using only 91mb of ram compared to 1 month ago it took 380mb.

Brian just like Matt and Jay are programers that listen. Thanks

Posted on
Sun Mar 07, 2010 10:05 am
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Getting weather data from Weather Display

That is great news. Thanks for working on this and coordinating with Brian!

Image

Who is online

Users browsing this forum: No registered users and 12 guests

cron