123
Senior Member
{Note: this file will be posted in this forum's Downloads section in the near future.}
This module utilizes XML-based data sources for weather.
There are two classes that can be used. The first is called XMLWeather. That feeds off of the NOAA XML data service. The NOAA data service is very complicated and not very easy to work with. Hence, the limited functionality of this particular class.
The second class uses The Weather Channel's XML data feed (TWCi). TWCi is very easy to work with and allows for much more functionality. This class is recommended over the NOAA-based class for general use.
Both classes expose a significant number of data elements for use by other applications. In my case, I use the CurrentConditions property of the TWCiWeather class to "speak" the weather when asked.
To install:
John,
Thanks for this. Works great. I'm using TWCi.
Sam
======================
Minor update. Fixed a few bugs with type conversions and added zipcode to the TWCiWeather class. If you leave it blank, TWCi will use the zipcode configured in Premise under "Schedule", otherwise, the entered zipcode will be used.
======================
Sam
I got tired of the NWS changing the format used by the Forecast module, so I wrote this.
John
======================
I've started using the TWCiWeather plugin. This is great and I've learned a lot from it! I ran into an issue and I wonder if anyone has an explanation.
I noticed that when the plugin updates after its 30 minute timer expires (or when I force it to update by manually setting Update to True on the TWCiWeather object under Home in the Premise Builder) the per-day information isn't displayed in the browser but the current
conditions are. I did some troubleshooting and noticed a couple things.
First, the TWCiWeatherPlugin.RenderPlugin method is invoked each time one of the DayWeather objects is deleted in the loop near the beginning of TWCiWeather.OnChangeUpdate. This itself is not a problem; it's just inefficient. I wonder, is there a way to prevent the re-rendering while the plugin is being recomputed?
Second, and most importantly, TWCiWeatherPlugin.RenderPlugin does NOT execute during or after the addition of new DayWeather objects later in TWCiWeather.OnChangeUpdate. So the last execution of RenderPlugin happens after all the DayWeather objects were deleted, and that is why I only see current conditions displayed after an update. I found I can work around this by adding the program line
Modules.Plugins.Selectors.TWCiWeather.TWCiWeatherPlugin.UpdatePlugin=t
rue near the end of the TWCiWeather.OnChangeUpdate method. Why does
TWCiWeatherPlugin.RenderPlugin automatically when the DayWeather objects are deleted but not when new ones are created?
Frank
======================
Good catches. I'll look at the code when I get home.
This module utilizes XML-based data sources for weather.
There are two classes that can be used. The first is called XMLWeather. That feeds off of the NOAA XML data service. The NOAA data service is very complicated and not very easy to work with. Hence, the limited functionality of this particular class.
The second class uses The Weather Channel's XML data feed (TWCi). TWCi is very easy to work with and allows for much more functionality. This class is recommended over the NOAA-based class for general use.
Both classes expose a significant number of data elements for use by other applications. In my case, I use the CurrentConditions property of the TWCiWeather class to "speak" the weather when asked.
To install:
- Copy the TWCi folder (in its entirety) to the C:\Program Files\Premise\SYS\web\Images\icons\ folder. There should be a sub folder called TWCi in the Icons folder after you are done. It's very important that this gets done prior to importing the module.
- Import the module. Navigate to someplace under Home, right click, and select "New". Both the TWCiWeather and XML Weather classes will be available (although I would only use TWCiWeather because it's better ).
- Create an instance of the class. After the instance is created, it should automatically update the current weather based on the zip-code you've entered under "Schedule" in the Builder.
John,
Thanks for this. Works great. I'm using TWCi.
Sam
======================
Minor update. Fixed a few bugs with type conversions and added zipcode to the TWCiWeather class. If you leave it blank, TWCi will use the zipcode configured in Premise under "Schedule", otherwise, the entered zipcode will be used.
======================
Sam
I got tired of the NWS changing the format used by the Forecast module, so I wrote this.
John
======================
I've started using the TWCiWeather plugin. This is great and I've learned a lot from it! I ran into an issue and I wonder if anyone has an explanation.
I noticed that when the plugin updates after its 30 minute timer expires (or when I force it to update by manually setting Update to True on the TWCiWeather object under Home in the Premise Builder) the per-day information isn't displayed in the browser but the current
conditions are. I did some troubleshooting and noticed a couple things.
First, the TWCiWeatherPlugin.RenderPlugin method is invoked each time one of the DayWeather objects is deleted in the loop near the beginning of TWCiWeather.OnChangeUpdate. This itself is not a problem; it's just inefficient. I wonder, is there a way to prevent the re-rendering while the plugin is being recomputed?
Second, and most importantly, TWCiWeatherPlugin.RenderPlugin does NOT execute during or after the addition of new DayWeather objects later in TWCiWeather.OnChangeUpdate. So the last execution of RenderPlugin happens after all the DayWeather objects were deleted, and that is why I only see current conditions displayed after an update. I found I can work around this by adding the program line
Modules.Plugins.Selectors.TWCiWeather.TWCiWeatherPlugin.UpdatePlugin=t
rue near the end of the TWCiWeather.OnChangeUpdate method. Why does
TWCiWeatherPlugin.RenderPlugin automatically when the DayWeather objects are deleted but not when new ones are created?
Frank
======================
Good catches. I'll look at the code when I get home.