OpenSprinkler › Forums › Hardware Questions › OpenSprinkler Pi (OSPi) › Rain delay from Yahoo Weather › Re: Re: Rain delay from Yahoo Weather
andrew
salbahra: I uploaded a bash script to obtain the woeid from Yahoo. it can be found here:
https://github.com/andrewshilliday/OpenSprinkler-WebRainDelay/blob/master/get_woeid.sh
Pass in an argument with the string that you want to search for. For example:
> ./get_woeid.sh "Washington, DC"
2514815 Washington, DC
> ./get_woeid.sh "12345"
12762240 Schenectady, NY 12345
> ./get_woeid.sh "Disneyworld"
23686031 Walt Disney World Resort
> ./get_woeid.sh "Beijing"
2151330 Beijing
It will return the woeid and the name of the matched location. They’re separated by a tab, so you can pipe it to cut -f 1 to get just the woeid.
I wouldn’t recommend calling this every time you want to query the weather. Rather, I would run it once to obtain the weoid and somehow save that along with the user-specified location. Yahoo limits the number of times this part of their API can be accessed.