SOLVED Weather By Zip Code and Airport Code

Trimline2

Guru
Joined
May 23, 2013
Messages
524
Reaction score
96
Seems to be broken again, would someone else confirm before I dive in?

Thanks.
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
"Seems to be broken again" tells us very little. Logs?
I just ran it on mine to check, and it doesn't work. NOAA probably changed their website around again.

Code:
    -- Executing [947@distinctive-internal:1] Answer("SIP/215-000000ac", "") in new stack
  == Extension Changed 215[ext-local] new state InUse for Notify User 228 
    -- Executing [947@distinctive-internal:2] Wait("SIP/215-000000ac", "1") in new stack
    -- Executing [947@distinctive-internal:3] Set("SIP/215-000000ac", "TIMEOUT(digit)=7") in new stack
    -- Digit timeout set to 7.000
    -- Executing [947@distinctive-internal:4] Set("SIP/215-000000ac", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10.000
    -- Executing [947@distinctive-internal:5] Flite("SIP/215-000000ac", ""At the beep enter the five digit code for the weather report you wish to retrieve."") in new stack
  == Parsing '/etc/asterisk/flite.conf':   == Found
    -- <SIP/215-000000ac> Playing '/tmp/Flite_1242710611.slin' (language 'en')
    -- Executing [947@distinctive-internal:6] Read("SIP/215-000000ac", "ZIPCODE,beep,5") in new stack
    -- Accepting a maximum of 5 digits.
    -- <SIP/215-000000ac> Playing 'beep.ulaw' (language 'en')
    -- User entered '29585'
    -- Executing [947@distinctive-internal:7] Flite("SIP/215-000000ac", ""Please hold a moment while we contact the National Weather Service for your report."") in new stack
  == Parsing '/etc/asterisk/flite.conf':   == Found
    -- <SIP/215-000000ac> Playing '/tmp/Flite_352867013.slin' (language 'en')
    -- Executing [947@distinctive-internal:8] AGI("SIP/215-000000ac", "nv-weather-zip.php,29585") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/nv-weather-zip.php
    -- <SIP/215-000000ac>AGI Script nv-weather-zip.php completed, returning 0
    -- Executing [947@distinctive-internal:9] NoOp("SIP/215-000000ac", "Wave file: ") in new stack
    -- Executing [947@distinctive-internal:10] Playback("SIP/215-000000ac", "") in new stack
[2013-06-09 17:46:01] WARNING[7411]: app_playback.c:437 playback_exec: Playback requires an argument (filename)
  == Spawn extension (distinctive-internal, 947, 10) exited non-zero on 'SIP/215-000000ac'
    -- Executing [h@distinctive-internal:1] Hangup("SIP/215-000000ac", "") in new stack
  == Spawn extension (distinctive-internal, h, 1) exited non-zero on 'SIP/215-000000ac'
  == Extension Changed 215[ext-local] new state Idle for Notify User 228 
pbx*CLI>
 

Trimline2

Guru
Joined
May 23, 2013
Messages
524
Reaction score
96
Definitely broken.

In the nvweather-zip.php, I replaced the line:

//$thetext="point-forecast-area-title";

with:

$thetext="current-conditions";

This definitely helps, but there is some erroneous info at the beginning of the forecast reading. I just can't figure out the entry point from looking at the page for current conditions. I believe the line that needs updating now is $newvalue=$cityupdate."Current local conditions " . substr($value,27, $start-27). ": ";

And yes, I am driving blind in a snow storm.... without a seat belt. :cool:
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Thanks for the head start. Here's the updated script to resolve the latest National Weather Service "improvements."

weatherdude.jpg


Log into your server as root, and...
Code:
cd /var/lib/asterisk/agi-bin
mv nv-weather-zip.php nv-weather-zip-last.php
wget http://incrediblepbx.com/nv-weather-zip-patch.tar.gz
tar zxvf nv-weather-zip-patch.tar.gz
rm nv-weather-zip-patch.tar.gz
 

Trimline2

Guru
Joined
May 23, 2013
Messages
524
Reaction score
96
Thanks for the head start. Here's the updated script to resolve the latest National Weather Service "improvements."

weatherdude.jpg


Log into your server as root, and...
Code:
cd /var/lib/asterisk/agi-bin
mv nv-weather-zip.php nv-weather-zip-last.php
wget http://incrediblepbx.com/nv-weather-zip-patch.tar.gz
tar zxvf nv-weather-zip-patch.tar.gz
rm nv-weather-zip-patch.tar.gz


Yep, that's a winner. Lucky number 79... thanks.
 
Joined
May 23, 2013
Messages
223
Reaction score
28
Still not working for me, at least when I try DAY I didn't try any other local but I just get it reading back HTML to me.
 

Trimline2

Guru
Joined
May 23, 2013
Messages
524
Reaction score
96
Are you entering a valid zip code? Not sure what "DAY" is.

Also, make sure that when you edit custom_weatherzip.conf via Other --> Config Edit, that nv-weather-zip.php is properly referenced. I've seen on older systems, it is referenced as nvweather-zip.php.
 

omunni

Guru
Joined
Feb 12, 2010
Messages
27
Reaction score
7
Note: For those using Incredible PBX for raspberry pi.
After running the codes posted by Ward above; edit nvweather-zip.php and replace the line:
$link = mysql_connect("localhost", "root", "passw0rd")
with
$link = mysql_connect("localhost", "root", "raspberry")

Otherwise it won't work.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Incredible PBX 11 and Incredible PBX 3.11 for Raspberry Pi automatic patches have been released. Thanks for all the help!
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Here's the patch for the Weather by Airport Code (611) application. This is the result of NWS "improvements" recently. Log into your server as root and...

Code:
cd /var/lib/asterisk/agi-bin
mv nv-weather.php nv-weather-old.php
wget http://incrediblepbx.com/nv-weather-patch.tar.gz
tar zxvf nv-weather-patch.tar.gz
rm nv-weather-patch.tar.gz
 
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top