PDA

View Full Version : Weather



MMcM
October 13th, 2002, 04:55 PM
Attached is some Girder and some JavaScript that together download the current weather conditions into some variables. From there, you can display it on your LCD / VFD.

You'll need to edit the ZIP code in the command line passed by Execute to the script in order to get weather where you are.

MMcM
October 13th, 2002, 04:55 PM
Here is an update for LUA, which effectively removed integer valued registers.

Promixis
November 11th, 2002, 10:28 AM
MMcM,

I have the weather script working for me. Their seems to be a problem with the load reg destroying other girder registers/variables. Unfortunately, I do not know java at all. BUT, wouldn't it be simpler to have the java script write a text file that is then opened and parsed using LUA?

Mike

MMcM
November 11th, 2002, 09:20 PM
Java and JavaScript are two fairly different languages, with only a little bit of syntax and part of their name in common. Someone intended them to be confused for marketing reasons.

When the script was first written, file parsing wasn't possible in GVMS. It is now and you're right that it would be more robust to do it that way. I don't really think it would be simpler, though.

Perhaps if Girder had a Merge Registers, as well as Load Registers, that didn't clobber variables not mentioned in the file, trouble could be avoided.

Promixis
November 11th, 2002, 10:08 PM
SOMEONE :) I wonder who....

I really like the weather for my VFD but current save/load reg kills my other scripts.

I guess I could use LUA to parse the current wthr.xml file instead. If I get around to it I will let you know.

Mike

vynce
November 11th, 2002, 10:28 PM
I guess it might be possible to implement the whole thing in Lua using the LuaSockets plugin.

Just a thought...

Promixis
November 17th, 2002, 07:34 PM
Mike,

I wrote a lua program to parse the xml file rather then load the registers. BUT :) It would be nice if the weather script just wrote a simple text file with the variable names and results. The script fails if there is no preexisting register file saved by girder. It would make the scipt more robust if the if gider could call the program with a temp filename. I would also change the script to return payload to girder with the name of the tempfile and the accid id used to get the data. I have a complicated lua script that retrieves the weather from 3 locations but it requires a lot of check to make sure there that a only one weather request is run at a time. It should be quick and easy but I simply don't know javascipt at all. I had a look at the online documentation and well, it will take me a weekend at least..

Thanks,

Mike

BTW have you had a chance to play around with the lcd screen manager?

Promixis
November 20th, 2002, 10:26 PM
Mike,

I made the changes to the javascipt myself. I will send them to you to look at.

MMcM
December 9th, 2002, 08:07 PM
I've continued revising weather along the lines that you've started, eliminating XML and temporary files altogether. I've allowed the script to fetch more than one location at a time and made the GML keep track of several states in a table, as you did. I wasn't sure of the best way to share this state with the rest of Girder, so I stuck to global variables for the latest. I imagine that once there is "standard" support for cycling through multiple screens, the best approach will become clearer. And no, I haven't forgotten about the LCD script. Other things have been demanding time.

Promixis
December 9th, 2002, 09:56 PM
Looking good. Didn't realize that girder could take so many pld variables :)

siwilson
January 2nd, 2003, 06:04 AM
Mike,

I have the weather and MBM stuff all working nicely, except that it overwrites active appliations using the display.

I thought that according to your demo GML file MBM and weather are only displayed of the display is idle.

Thoughts ?

MMcM
January 3rd, 2003, 10:23 AM
The idle handling depends on the event handlers for the other applications clearing the idle flag. In the sample GML scripts, there is an Open command that sets Idle to nil and clears the screen if it was non-nil. And a corresponding Close command that clears the screen and sets Idle to 1. What application is having conflicts? Do you have similar logic in your GML file?

siwilson
January 3rd, 2003, 11:46 AM
OK, I get it now. :oops:

I didn't realize that 'idle' was a variable. I see now how it is set and reset. I'll play around with this a bit more. After looking at all the links and jumps in your example I might be better off starting with that and importing my stuff.

Thanks

Cam_Man
March 3rd, 2003, 07:30 PM
Where can I find these files?

MMcM
March 8th, 2003, 06:13 PM
The DVDSpy distribution contains the Weather.js script and a DVD2LCD2.gml Girder file with a Weather group that uses it.