Home AMX User Forum NetLinx Studio

Netlinx as RSS reader

2»

Comments

  • flcusatflcusat Posts: 309
    Vining, when I clicked in your link all I get is what it is showing in the attachement. What am I missing? And yes all the parameter showing in the link are the ones that I have in my code.
  • flcusatflcusat Posts: 309
    I just did what Dave suggested and just kept the zip code value. At this moment the data at the panel is identical than the one at the web site is showing but I would need to test this more extensively to make sure that there is not any differences like before. Still nothing showing on the Heat Index window which should be N/A if the value were not found in the string.
  • viningvining Posts: 4,368
    The URL I posted before was for only 3 days because that's max option the RSS customize page allows. You can change this to 5 as I did below or even ten but the module is made to parse just five.

    I attached the screen shot of what this page delivers in HTML form.
    http://www.rssweather.com/rss.php?hwvUT=F&hwvUP=in&hwvUS=mph&hwvUV=mi&hwvCCChange=forecast&hwvSF=Y&maxdays=5&daysonly=0&hwvStyle=ce&place=miami&state=fl&zipcode=33184&country=us&county=12086&zone=FLZ074&alt=rss20a
    

    If the heat index isn't showing anything when at the minimum it should show N/A I would check in TPD4 and make sure the address port & channel are correct. Check button text color and tranparencies and see if that's off some how.
  • flcusatflcusat Posts: 309
    I checked TPD4 and address port and channel for the Heat Index are both 23 which is what it is in the code. I'm not receiving the html content in the page, just what I posted in the picture before. Is this because a setting in my browser?
  • flcusatflcusat Posts: 309
    Ok, when I get to the page where I only have the header, if I right click and select view source, then I get the html in a notepad window. But still not getting what you are getting in the attachment that you posted; even when I tried the three available options: Plain Text, Content Encoded or XHTML Body.
  • flcusatflcusat Posts: 309
    I think that I found something regarding the heat index in the module. In the section where the feedback is sent to the panels, for the heat index reads:
      SEND_COMMAND dvTPWeatherArray,"'!T',13,sRSS.heatindex"
      sRSSsent.heatindex = sRSS.heatindex
    

    When I compare that command to the rest of the commands for the other parameters, them the command structure should be:
     SEND_COMMANDdvTPWeatherArray,"'!T',nFeedback[VT_heatindex],sRSS.heatindex"
     sRSSsent.heatindex = sRSS.heatindex
    
    

    I change it in the module, compile it and send it to the controller but still not getting the Heat Index feedback
  • flcusatflcusat Posts: 309
    Vining or Dave. Did you have a chance to take a look at the code and figure it out why the heat index is not updating?
  • DHawthorneDHawthorne Posts: 4,584
    There is definitely a parsing issue going on. Today is my first day in the office after a lot of on-the-road time, and I put in the Miami zip code just to check this out. It's failing pretty early on, and my fix for the VRB wind direction isn't working (so it's obviously flawed). I may be able to get something going here, maybe not ... I'm going to be on the road again a lot very soon, but I'll see how far I can take it meanwhile.
  • viningvining Posts: 4,368
    Do you get it to work when the default city/state are specified? If it does, which it should as I have never had a issue with it, then it's likely a slight difference in the return format from RSS.Weather.com. If that's the case then the parser may need to be customized for different style of returns.

    I've finally got my NI-4000s back from repair so I can acutally give it a test when I get back tonight.
  • DHawthorneDHawthorne Posts: 4,584
    vining wrote:
    Do you get it to work when the default city/state are specified? If it does, which it should as I have never had a issue with it, then it's likely a slight difference in the return format from RSS.Weather.com. If that's the case then the parser may need to be customized for different style of returns.

    I've finally got my NI-4000s back from repair so I can acutally give it a test when I get back tonight.

    It was working today with my local zip code, but when I changed it to Miami, it only got 9 fields before failing, and I had some XML tags in the wind direction field. Unfortunately, my boos grabbed my bench MVP-8400 to show to a client, so I can't test on a live panel today. I suspect it's a similar issue to the wind direction one - you are searching in the data field for a value that sometimes isn't there.
  • viningvining Posts: 4,368
    Ididn't actually check the code your are using but when looking through mine running your paremeters I found this oddity in regard to the Heat Index.

    In the module,

    in:
    DEFINE_FUNCTION CHAR fnVAV_MyWeatherFB()
    
    find this. I don't know where 13 ever came from cuz everything else is array indexed, so beets the f out of me.
    if (sRSSsent.heatindex != sRSS.heatindex)                             
    	  {               
    	  SEND_COMMAND dvTPWeatherArray,"'!T',13,sRSS.heatindex"
    	  sRSSsent.heatindex = sRSS.heatindex
    	  }
    
    Change to:
    if (sRSSsent.heatindex != sRSS.heatindex)                             
    	  {               
    	  SEND_COMMAND dvTPWeatherArray,"'!T',nFeedback[VT_heatindex],sRSS.heatindex"
    	  sRSSsent.heatindex = sRSS.heatindex
    	  }
    
    With this line changed the heat index value updates as it should.

    I used the below values and I received Miami info w/o any problems. I changed it from persistent to non_volatile cuz I also had a hard time getting the values to change. Seems odd to me but just cuz they were delcared persistent I should be able to change the values when I want. I went through all that file checking crap that I suggested you do before changing it and then it worked fine.
    NON_VOLATILE CHAR CityData[][30] = 
         {
    		    // leave unkown fields as '' (no space between)
    		    // (you should get info back with just city,state, country & zip)
         {'us'},	    // Country: figure this out yourself
         {'12086'},	    // go to >>> http://www.itl.nist.gov/fipspubs/co-codes/states.htm 
    		    // (to find code for your area)
         {'fl'},	    // State: figure this out yourself
         {'FLZ074'},    // go to >>> http://weather.noaa.gov/pub/data/forecasts/marine/coastal/
    		    // (coastal and inland waterways) (you could parse this page it you want!!)
         {'Miami'},   // City: figure this out yourself
         {'33184'}	    // Zipcode: figure this out yourself
         
         } ;
    

    Here's the entire file that RSSweather returned. You can see in this one there was no value for "Gusts" and maybe one or two others. I think the automated system just includes the values they have which is why when I made the parser it would check for it but if it doesn't see it, it places the N/A in the field.
    HTTP/1.1 200 OK
    Date: Mon, 16 Jul 2007 23:34:03 GMT
    Server: Apache
    X-Powered-By: PHP/4.4.4
    X-Cache: jpcache vv2 - file
    ETag: "jpd-1620502544.6680"
    Transfer-Encoding: chunked
    Content-Type: text/xml
    
    1a18
    <?xml version="1.0" encoding="ISO-8859-1"  ?><?xml-stylesheet type="text/xsl" href="http://www.rssweather.com/xslt.php" ?><?xml-stylesheet type="text/css" href="http://www.rssweather.com/rss.css" ?><rss version="2.0"><channel><title>Miami, Florida Weather</title><link>http://www.rssweather.com/zipcode/33184/wx.php</link><description><![CDATA[Current weather, forecasts and alerts delivered using RSS.<p>The weather information for this RSS feed is taken from the National Weather Service (http://weather.noaa.gov/), and powered by HamWeather (http://www.hamweather.com/).  The RSS feed is provided so that you don't have to look out of the window to find out the weather, do not use it for making decisions that involve yours or anybody elses life.</p><p><b>Using the Feeds</b><ul><li>Request Frequency - The feeds are updated once per hour.  More frequent requests may result in your access being limited.</li><li>Web Site Usage - If you are using the feed on your web site, you are required to maintain a link to rssWeather.com and hamweather.com</li></ul></b></p>]]></description><ttl>60</ttl><generator>HamWeather 3.084 (http://www.hamweather.com/)</generator><language>en</language><item><title>Miami, Florida Weather :: 87F Partly cloudy</title><link>http://www.rssweather.com/zipcode/33184/wx.php</link><category>Current Conditions</category><pubDate>Mon, 16 Jul 2007 00:00:00 -0400</pubDate><description>87F Partly cloudy</description><body xmlns="http://www.w3.org/1999/xhtml"><h4><a href="http://www.rssweather.com/zipcode/33184/wx.php"><img src="http://www.rssweather.com/images/fcicons/pcloudy.gif" alt="partly cloudy" class="icon" width="55" height="58" id="pcloudy.gif" border="0"/></a><span class="sky">Partly cloudy</span> <span class="temp">87?F</span></h4><dl style="display: inline;">
    <dt style="display: inline; font-weight: bold;">Humidity:</dt><dd id="humidity" style="display: inline;">59%</dd>
    <dt style="display: inline; font-weight: bold;">Wind Speed:</dt><dd id="windspeed" style="display: inline;">10 MPH</dd>
    <dt style="display: inline; font-weight: bold;">Wind Direction:</dt><dd id="winddir" style="display: inline;">ESE (120?)</dd> 
    <dt style="display: inline; font-weight: bold;">Barometer:</dt><dd id="pressure" style="display: inline;"> 30.01 in.</dd>
    <dt style="display: inline; font-weight: bold;">Dewpoint:</dt><dd id="dewpoint" style="display: inline;">71?F</dd>
    <dt style="display: inline; font-weight: bold;">Heat Index:</dt><dd id="heatindex" style="display: inline;">93?F</dd>
    <dt style="display: inline; font-weight: bold;">Wind Chill:</dt><dd id="windchill" style="display: inline;">87?F</dd>
    <dt style="display: inline; font-weight: bold;">Visibility:</dt><dd id="visibility" style="display: inline;">10 mi</dd></dl></body><guid isPermaLink="false">C-1853 EDT MON JUL 16 2007</guid></item><item><title>Forecast for Rest Of This Afternoon</title><category>Weather Forecast</category><link>http://www.rssweather.com/zipcode/33184/wx.php</link><description>Mostly sunny. Isolated showers
    and thunderstorms. </description><body xmlns="http://www.w3.org/1999/xhtml"><p id="fText">Mostly sunny. Isolated showers
    and thunderstorms. <dl style="display: inline;"></dl></p></body><pubDate>Mon, 16 Jul 2007 14:37:00 -0400</pubDate><guid isPermaLink="false">F-KMIA-237 PM EDT MON JUL 16 2007-REST OF THIS AFTERNOON</guid></item><item><title>Forecast for Evening</title><category>Weather Forecast</category><link>http://www.rssweather.com/zipcode/33184/wx.php</link><description>Mostly sunny. Isolated showers
    and thunderstorms. </description><body xmlns="http://www.w3.org/1999/xhtml"><p id="fText">Mostly sunny. Isolated showers
    and thunderstorms. <dl style="display: inline;"></dl></p></body><pubDate>Mon, 16 Jul 2007 14:37:00 -0400</pubDate><guid isPermaLink="false">F-KMIA-237 PM EDT MON JUL 16 2007-EVENING</guid></item><item><title>Forecast for Tonight</title><category>Weather Forecast</category><link>http://www.rssweather.com/zipcode/33184/wx.php</link><description>Mostly clear. Isolated showers and thunderstorms. Lows in
    the upper 70s. East winds 5 to 10 mph. Chance of rain 20 percent. </description><body xmlns="http://www.w3.org/1999/xhtml"><p id="fText">Mostly clear. Isolated showers and thunderstorms. Lows in
    the upper 70s. East winds 5 to 10 mph. Chance of rain 20 percent. <dl style="display: inline;"><dt style="display:inline;">Lo:</dt><dd id="min" style="display:inline">79?F</dd><dt style="display:inline;">Rain:</dt><dd id="rain" style="display:inline">20%</dd></dl></p></body><pubDate>Mon, 16 Jul 2007 14:37:00 -0400</pubDate><guid isPermaLink="false">F-KMIA-237 PM EDT MON JUL 16 2007-TONIGHT</guid></item><item><title>Forecast for Tuesday</title><category>Weather Forecast</category><link>http://www.rssweather.com/zipcode/33184/wx.php</link><description>Partly sunny. Isolated showers and thunderstorms early in
    the morning. Then scattered showers and thunderstorms in the
    afternoon. Highs in the upper 80s. East winds 10 to 15 mph. Chance
    of rain 30 percent. </description><body xmlns="http://www.w3.org/1999/xhtml"><p id="fText">Partly sunny. Isolated showers and thunderstorms early in
    the morning. Then scattered showers and thunderstorms in the
    afternoon. Highs in the upper 80s. East winds 10 to 15 mph. Chance
    of rain 30 percent. <dl style="display: inline;"><dt style="display:inline;">Hi:</dt><dd id="max" style="display:inline">89?F</dd><dt style="display:inline;">Rain:</dt><dd id="rain" style="display:inline">30%</dd></dl></p></body><pubDate>Mon, 16 Jul 2007 14:37:00 -0400</pubDate><guid isPermaLink="false">F-KMIA-237 PM EDT MON JUL 16 2007-TUESDAY</guid></item><item><title>Forecast for Tuesday Night</title><category>Weather Forecast</category><link>http://www.rssweather.com/zipcode/33184/wx.php</link><description>Partly cloudy. Scattered showers and thunderstorms
    in the evening. Then isolated showers and thunderstorms in the late
    evening and overnight. Lows around 80. East winds 10 mph. Chance of
    rain 30 percent. </description><body xmlns="http://www.w3.org/1999/xhtml"><p id="fText">Partly cloudy. Scattered showers and thunderstorms
    in the evening. Then isolated showers and thunderstorms in the late
    evening and overnight. Lows around 80. East winds 10 mph. Chance of
    rain 30 percent. <dl style="display: inline;"><dt style="display:inline;">Lo:</dt><dd id="min" style="display:inline">80?F</dd><dt style="display:inline;">Rain:</dt><dd id="rain" style="display:inline">30%</dd></dl></p></body><pubDate>Mon, 16 Jul 2007 14:37:00 -0400</pubDate><guid isPermaLink="false">F-KMIA-237 PM EDT MON JUL 16 2007-TUESDAY NIGHT</guid></item></channel></rss>
    0
    
  • viningvining Posts: 4,368
    I just checked the code you posted and you have that "13" too. Wish I knew where that came from!
  • flcusatflcusat Posts: 309
    vining wrote:
    I just checked the code you posted and you have that "13" too. Wish I knew where that came from!

    Vining, I reported the 13 issue in a thread above. At that time, when I made the change and recompiled I didn't have any value returned at the heat index, but that day I had to leave for a job I was doing in the Bahamas and didn't play with it anymore. After I read your thread I changed the values from persistent to non volatile and recompiled and now I have the heat index working.
  • DHawthorneDHawthorne Posts: 4,584
    There is still a problem, but it's rare and dependent on the weather you are getting. The Miami zip was not working for me yesterday morning, but it cleared up by the time I got to it in the afternoon. I'm going to keep watching this; it is very sporadic, but sometimes the feed can send something that breaks the parsing. It's just a matter of what it is.

    t's possible the RSS buffer isn't always big enough. I added a trap to the line that searches for </rss> that writes the buffer to a file for troubleshooting. When Miami was acting up, that file never got written. I've doubled the size of the buffer, but it started behaving in any case, so I don't know if that had anything to do with it ...
  • flcusatflcusat Posts: 309
    Thanks Dave.
  • viningvining Posts: 4,368
    flcusat wrote:
    Originally Posted by vining
    I just checked the code you posted and you have that "13" too. Wish I knew where that came from!

    Vining, I reported the 13 issue in a thread above.

    Sorry, but I barely read what I write!

    I've been runnning the Miami parameters all day and I've been consistently getting 19 of a possible 20 returned values displayed. Still nothing for "Gusts".

    Because I'll likely not be looking at the TP to notice if a bad format is returned from RRSweather.com I added a section in my code so that if the number of succesful parsed values is less than the MAX 20 possible it will send an email stating the TIME, number of values correctly parsed and the entire message returned by RSSWeather so if I get an email with the subject line telling me I've only got 3 of a possible 20 values I'll have that entire message so I can see what they are sending that's screwing up the parsing function.

    I can add you to the send email list if you like so you can check the hourly updates and see what may be causing the problem first hand. I had to modify the body of the RSSWeather returned message to eliminate BARE LFs because the smtp servers for yahoo, msn don't like them and subsequently won't pass the email to it's intended recipient.
  • flcusatflcusat Posts: 309
    vining wrote:

    I can add you to the send email list if you like so you can check the hourly updates and see what may be causing the problem first hand.

    Thanks Vining, My e-mail is flcusat@bellsouth.net. Now, the issue with the guts not being returned is only with the Miami parameters or with any parameters you put in?
  • viningvining Posts: 4,368
    flcusat

    You should start receiving hourly emails now providing they don't get blocked by your email provider. I've been recieving these emails hourly since last night but my MSN account is missing a couple while my YAHOO account shows them all. If you have issues recieving them let me know cuzl I can always send the RSSWeather return as an attachment instead of in the body of the email.


    I don't know why they sometime send values and other times they don't. I would watch the "Gusts" over a period of time and if it they never give them I would change the VT address to something useful that's normally displayed on the 2nd page.
  • flcusatflcusat Posts: 309
    Thanks Vining, I already started geting them.
  • viningvining Posts: 4,368
    flcusat
    I modified the email to send the returned RSSWeather data as an attachment. This seems to make my MSN account more reliable. Even after correcting the BARE LFs I would still get a Mail Daemon response in my Yahoo account which I use to send them.

    I also modified the code so it will send the email w/ attachment when less than 20 values are returned and w/o the attachment if all 20 values are received. There was a period this afternoon when all 20 values were returned and with only 1/2 the emails coming in through my Outlook MSN account I didn't know if it was because everything was good or the email just didn't get through. Now there should be at least one every hour regardless and possibly more if I manual update.
  • flcusatflcusat Posts: 309
    vining wrote:
    There was a period this afternoon when all 20 values were returned .

    Thanks Vining. I saw that. Had you determine if the problem is only with the Miami parameters?
  • viningvining Posts: 4,368
    I don't know if it's really a problem at all. So far I've seen 18s, 19s and 20s returned and as from I've seenthat's pretty much the norm when properly working. I get the same thing up here in the North East and I've haven't really seen it much worse. Some times if there isn't a significant value for a parameter like Gusts they just omit it. So if it's dead calm and there aren't any Gusts and no real Wind Direction they excude them is their feeds. It's more effecient when working on a large scale large volume server system that RSSWeather.com needs to provide this service. With millions of feed and racks of servers and hard drives I'm sure they count every bit that has to be stored and streamed.

    I'm still waiting to see something really odd get returned like you and Dave have seen but so far it seems to be working very well.

    At least now if and when this odd return appears it will be captured for a side by side comparison so we'll know exactly what to do if there actually is anything we can do on our end. It may be that RSSWeather occasionaly just sends out a completely messed up weather feed. Possibly you and Dave just caught them in the middle of working there coding for the automated responses. We'll see, then again maybe we won't.

    The other little quircks like VT line lengths, new icon that haven't been captured yet are to expected. And by time we get it all tweaked and flawless they'll stop or overhaul the service and we'll start all over again.

    As far as the Miami feed in general they do seem to use much longer text strings than we do up here in the NE or maybe we just don't get thse funky cloud formations that you seem to get.
  • flcusatflcusat Posts: 309
    vining wrote:

    As far as the Miami feed in general they do seem to use much longer text strings than we do up here in the NE or maybe we just don't get thse funky cloud formations that you seem to get.

    Yeah, As I mentioned earlier, I had to increase the description field from 30 to 50 due to something like: Cumulonimbus Clouds Observed plus the actual temperature.
  • BinuBinu Posts: 49
    Weather Module

    Hi, Friends

    Find the attached module for yahoo weather. I am using this for my projects.

    Can be modify or add more locations.
  • flcusatflcusat Posts: 309
    Binu wrote:
    Hi, Friends

    Find the attached module for yahoo weather. I am using this for my projects.

    Can be modify or add more locations.

    Nice set up but I noticed a couple of issues. The temperature it is in Centigrade instead of Fahrenheit even when the feed gives it in Fahrenheit so there is a conversion in the module. The same thing happens with the visibility which is in KM instead of Miles. Also it looks like the satellite image it is just showing the image to the middle east even when you select a different region. Also while I was trying to browse through different regions my master got locked up and I had to reboot it manually.
  • First off nice job Vining on this weather module and thanks for sharing it.

    I'm having trouble getting the module to receive any data, so I was wondering if anyone had any insight on what might be going on. Basically I'm able to get an online connection no problem, and even send out the GET line. Problem is that the port goes offline and the rss feed doesn't look like it's getting received. If you notice I added a send_string 0 to make sure of what was in the GET request (the send_string 0 msg is truncated to only 131 characters in diagnostics). Here's the log from the telnet session:
    (0000120132) Time 16:21:30 - Updating RSS Weather! From: *-Define_Start-* line-<
    620>

    (0000120267) Connected Successfully
    (0000120268) CIpEvent::OnLine 0:8:4
    (0000120268) RSS Connected! line-<632>

    (0000120270) /rss.php?hwvUT=F&hwvUP=in&hwvUS=mph&hwvUV=mi&hwvCCChange=time&hwvSF
    =Y&maxdays=5&daysonly=0&hwvStyle=body&place=san diego&state=ca&z
    (0000120271) RSS Get Request Sent! line-<658>

    (0000120391) Exiting TCP Read thread - closing this socket for local port 8
    (0000120391) CIpEvent::OffLine 0:8:4
    (0000120392) RSS server disconnected! line-<819>

    When I type in the string from the get command directly in a browser, I'm able to get the correct page with the correct information.


    Thanks for the help.

    --John
  • viningvining Posts: 4,368
    If you start debugging in NS2 and set nWeather_DeBug to 1 you'll get debug feed back in diagnostics.

    You can only connect to RSS weather once per hour and if you try you will get a slow down response and no weather. Of course this doesn't make the parsing routine happy so you get nothing. Keep in mind that every time you compile, upload and reboot you're sending out this request which means if you do this more than once in an hour you'll get the slow down meassage.

    The slow down meassage is a new feature of RSS weather so there is nothing in place in the module to handle it like a pop up or even a message in diagnostics saying "recieved slow down meassge" which would be nice.

    There's also a patch posted on the forum that changed a section of the parser to look for .png icons and not just .gif which was what they original used when this module was written.

    I also install a version of this with email notification that saves the last return in a file on the master and then emails me that return if the parser finds less than x of the the 20 values its looking for. This way when it's not working completely I can see if is because of a change in the returned format or if maybe RSS Weather just sent out incomplete data.

    The patch is in this thread:
    http://amxforums.com/showthread.php?t=1804&highlight=rss+weather
  • Thanks for the response Dan.

    I just got a chance to play with this again. It seems that I wasn't receiving any data back from the website at all (not even the slow-down message) so the cRSSBuf buffer wasn't getting populated. I changed the GET line from the really long string to
    SEND_STRING dvRSS, "'GET /zipcode/',sCity.zip,'/rss.php&alt=rss20a HTTP/1.1',crlf"
    
    and that seems to work perfectly.


    The weird thing is that for whatever reason after compiling it a few times, the original GET string started pulling the data (~6000 bytes) from the website but it didn't parse all of it properly. Then it just stopped receiving data completely again. But like I said, with the different GET string, I'm able to receive the data again. It was confusing because manually typing in the info from the original GET string gave me data back in a browser.

    If anyone's interested in how I determined there was no data being returned, I just used a SEND_STRING 0, "'Data Received at cRSSBuf'" in the STRING: section of the DATA_EVENT for the dvRSS to let me know if there was any data received. Then, to make sure everything else was set correctly I used "Emulate a Device" in Studio to send a string to 0:8:4 which was my port for the RSS feed. The string I sent was the data I received when I went to the website manually. I just viewed the page source in my browser , then cut and paste. Firing that at the port caused the buffer to populate, and the parser to fire off.

    Thanks again everyone!

    --John
Sign In or Register to comment.