Home AMX User Forum AMX Technical Discussion

Y-Weather Replacement module for ENV-VST-C and i-Weather

2»

Comments

  • youstrayoustra Posts: 135
    Is this still working?

    I'm just trying this for the first time and not getting any RSS feedback to parse. I'm wondering if it's still working w/ Yahoo before I dig in...
  • amdpoweramdpower Posts: 110
    As far as I know, it should still be working. Make sure to use the latest version from my website which was a couple posts ago. Yahoo changed the API a bit. I recently moved to a new house and weather data is WAY DOWN on the Honey Do list!
  • yanbinyanbin Posts: 86
    It works awesome.


    Thanks,

    Yanbin
  • amdpoweramdpower Posts: 110
    Yahoo appears to have screwed us up again. I've gotta dig deeper but this should at least get you running again.
    DEFINE_FUNCTION FetchRSSData(){ //Goes to an external site and gets the RSS Data
        cRSSBuffer=""
       IP_CLIENT_OPEN(dvRSS.PORT,'weather.yahooapis.com',80,1)
        WAIT_UNTIL(nRSSOnline){
    	SEND_STRING dvRSS,"'GET /forecastrss?p=',cZipCode,' HTTP/1.1',13,10"
    	SEND_STRING dvRSS,"'Host: weather.yahooapis.com',13,10"
    	SEND_STRING dvRSS,"'User-Agent: Mozilla/5.0',13,10"
    	SEND_STRING dvRSS,"'CONNECTION: Keep-Alive',13,10"
    	SEND_STRING dvRSS,"'Cache-Control: no-cache',13,10"
    	SEND_STRING dvRSS,"13,10"
        }
    }
    
  • amdpoweramdpower Posts: 110
    OK. An updated module has been posted to my site which includes F/C selection along with some multi-zone fixes.

    http://www.jackkolesar.com/code.html

    Thanks.
  • viningvining Posts: 4,368
    amdpower wrote: »
    Yahoo appears to have screwed us up again. I've gotta dig deeper but this should at least get you running again.
    DEFINE_FUNCTION FetchRSSData(){ //Goes to an external site and gets the RSS Data
        cRSSBuffer=""
       IP_CLIENT_OPEN(dvRSS.PORT,'weather.yahooapis.com',80,1)
        WAIT_UNTIL(nRSSOnline){
    	SEND_STRING dvRSS,"'GET /forecastrss?p=',cZipCode,' HTTP/1.1',13,10"
    	SEND_STRING dvRSS,"'Host: weather.yahooapis.com',13,10"
    	SEND_STRING dvRSS,"'User-Agent: Mozilla/5.0',13,10"
    	SEND_STRING dvRSS,"'CONNECTION: Keep-Alive',13,10"
    	SEND_STRING dvRSS,"'Cache-Control: no-cache',13,10"
    	SEND_STRING dvRSS,"13,10"
        }
    }
    
    Not to knit pick but why the wait_until? Wouldn't you be better off just having the online event handler with those send_strings in it or have the online event handler call a function which has them called Get_RSS() or something. For clarity maybe call the IP_Open in Connect_RSS() then when online call Get_RSS() for example.

    I thought wait_until doesn't time out and stops the mainline while waiting or something similar. Never used it so I could be wrong but if that were the case and the network or WAN is down wouldn't that hang the processor?
  • amdpoweramdpower Posts: 110
    Honestly, I don't have a clue as to why I wrote it like that. It was literally years ago that I worked on it. But, you are probably right. If anything, it should be a TIMED_WAIT_UNTIL. Though, I've never had a problem with this module. In this particular instance, you probably could do the SEND_STRINGS in an ONLINE event. However, that may not be desirable if you were going to visit different web pages. I'm not sure why I have a keep-alive specified as well. I think maybe I had problems fetching the whole page but I really cannot remember. I just know my weather stopped updating and I started getting emails from people who must have used this! Anyway, good suggestions which I don't consider nitpicking. I'm sure when I have time, I'll clean it up more and go through it again.

    Thanks.
  • nielsynielsy Posts: 32
    Thanx!
    I also use your module, and stopt working last week.
    But now with the new change it's working again...

    so thanx for the little update!
  • DHawthorneDHawthorne Posts: 4,584
    I have been using a Weatherbug feed, and they hosed me by requiring a developer's license that cost way too much for me to justify to add what essentially amounts to a freebie I give clients. So I have adapted this module as a stand-alone without the Viewstat portion.

    Something I noticed right away is that the "CONNECTION: keep-alive" header field slows this module down by a factor of several times. With that in the header, it can take a good 5-6 seconds to disconnect and process. The server is done sending the data, it's just sitting there at that point waiting for the connection to drop. Replace it with "CONNECTION: close," and it's near instantaneous. The user-agent field is not only unnecessary, it's inaccurate, as an AMX controller is not a Mozzila based browser. It's harmless, but not needed. Ditto for the cache control. All you need to have is the HOST and CONNECTION fields (technically, you don't really need the connection field either, but without that, it defaults to keep_alive, and close is so much faster, but needs to be stated explicitly).

    Also, forget the WAITs of any flavor. Put the GET and it's associated headers in the ONLINE event. Put the parsing routine in the OFFLINE event. No waits are needed. I have my version set up to used several cities for presets, and you can flip between them as fast as you can hit the buttons, and everything processes just fine.

    Looking at the Yahoo API, I see that the p=<zipcode> is supposedly depreciated. It still works, but I wonder for how long. I really don't want to have to go looking up location codes, but that's the direction Yahoo seems to want us to go.
  • DavidRDavidR Posts: 62
    Just trying this module on a NX-3200 and seem to be running into a problem.

    The module doesn't work but I'm receiving a clue in telnet... not sure why I'm seeing the IPv6 address as nothing is defined that way. If I dump this code into a NI3100 it works fine.

    just telnet sample below is from startup and the error repeats with every press of the 'refresh' button.

    any ideas?

    Welcome to NetLinx v1.2.313 , AMX LLC
    >msg on debug
    Extended diagnostic information messages turned on.
    >(0001739920) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001739920) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001739921) CIpEvent::OnError 0:4:1
    (0001740026) Memory Available = 467152896 <81920>
    (0001740174) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001740174) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001740175) CIpEvent::OnError 0:4:1
    (0001740305) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001740305) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001740306) CIpEvent::OnError 0:4:1
    (0001740477) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001740477) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001740478) CIpEvent::OnError 0:4:1
    (0001740647) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001740648) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001740648) CIpEvent::OnError 0:4:1
    (0001740826) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001740827) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001740828) CIpEvent::OnError 0:4:1
    (0001741005) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001741005) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001741006) CIpEvent::OnError 0:4:1
    (0001743192) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001743192) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001743193) CIpEvent::OnError 0:4:1
    (0001743362) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001743362) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001743363) CIpEvent::OnError 0:4:1
    (0001743554) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001743554) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001743555) CIpEvent::OnError 0:4:1
    (0001743733) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001743733) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001743733) CIpEvent::OnError 0:4:1
    (0001743929) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001743929) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001743930) CIpEvent::OnError 0:4:1
    (0001747944) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001747944) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001747945) CIpEvent::OnError 0:4:1
    (0001750442) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001750442) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001750443) CIpEvent::OnError 0:4:1
    (0001750656) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001750656) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001750657) CIpEvent::OnError 0:4:1
    (0001750838) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001750838) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001750839) CIpEvent::OnError 0:4:1
    (0001752468) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001752468) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001752469) CIpEvent::OnError 0:4:1
    (0001752754) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001752754) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001752755) CIpEvent::OnError 0:4:1
    (0001752972) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001752973) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001752974) CIpEvent::OnError 0:4:1
    (0001753254) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:4:2::3000:20480
    (0001753254) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001753255) CIpEvent::OnError 0:4:1
    (0001753551) IPSocketManConnectTask - errno = 101 (Network is unreachable) addr:2001:4998:f00d:1fe::3001:20480
    (0001753551) IPSocketManConnectTask 'tcp-client:1:4' exiting
    (0001753552) CIpEvent::OnError 0:4:1
  • amdpoweramdpower Posts: 110
    Yahoo did it again... This hack should get you through. This thing really needs rewritten though. Embarrassed at some of the slop and need a more reliable source. Pass a virtual device to vdvAstro if you need to. This is from my own system and I can't remember what I was using that for. Hopefully it's not too different from the master file I used in the example. I'll update the rest when I have time.
  • ericmedleyericmedley Posts: 4,177
    amdpower wrote: »
    Yahoo did it again... This hack should get you through. This thing really needs rewritten though. Embarrassed at some of the slop and need a more reliable source. Pass a virtual device to vdvAstro if you need to. This is from my own system and I can't remember what I was using that for. Hopefully it's not too different from the master file I used in the example. I'll update the rest when I have time.


    I wrote a module that grabs weather from an RSS feed that's been working quite well. I know some have had issues with the server closing them out if they happen to bang on it too much. but, I can say that mine has hourly updates on 5 or more different weather sites and it hasn't shut me down once. The module comes with a TP file with the various fields you can use (or not)

    It costs nothing and is worth every penny.

    http://www.amxforums.com/forum/modpedia-the-public-repository-of-modules-for-everyone/121226-weather-by-zip-code-us-only-from-rss-feed
  • DavidRDavidR Posts: 62
    amdpower wrote: »
    Yahoo did it again... This hack should get you through. This thing really needs rewritten though. Embarrassed at some of the slop and need a more reliable source. Pass a virtual device to vdvAstro if you need to. This is from my own system and I can't remember what I was using that for. Hopefully it's not too different from the master file I used in the example. I'll update the rest when I have time.


    tried the new code and it appears the city is stuck on Cache, PI, BR... whatever that is. any idea what could be going on?
  • DavidRDavidR Posts: 62
    looks like the yahoo! city addresses aren't working any longer. I used to be able to enter Toronto as CAXX0504 and it would work. Now all I get back with "named" addresses is the above mentioned Cache message. The actual Canadian and american postal codes work.

    Celsius however doesn't seem to.

  • It appears the latest update to the Yahoo module has stopped working. Is anyone else seeing this, or is it just me?
  • ericmedleyericmedley Posts: 4,177
    It appears the latest update to the Yahoo module has stopped working. Is anyone else seeing this, or is it just me?
    The weather module I wrote is still working well. It pulls from an RSS feed. Here's the link to the forum post.

    http://www.amxforums.com/forum/modpedia-the-public-repository-of-modules-for-everyone/121226-weather-by-zip-code-us-only-from-rss-feed
  • nickmnickm Posts: 152
    We've moved on to the Weather Underground API. I can't post the module here, unfortunately, but the API is well documented and easy enough to implement via HTTP GETs.
  • Team, can someone reanimate this module, please? Beauty of this module is that no reprogramming require to migrate from AMX !i-Weather based systems.
    I am sure some of the AMX gurus living on this forum can accept the challenge :)
Sign In or Register to comment.